summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig2
-rw-r--r--.gitattributes19
-rw-r--r--.travis.yml4
-rw-r--r--AUTHORS.md2
-rw-r--r--CODEOWNERS15
-rw-r--r--DONORS.md80
-rw-r--r--SConstruct33
-rw-r--r--core/SCsub9
-rw-r--r--core/bind/core_bind.cpp147
-rw-r--r--core/bind/core_bind.h41
-rw-r--r--core/color_names.inc1
-rw-r--r--core/core_string_names.cpp1
-rw-r--r--core/core_string_names.h1
-rw-r--r--core/error_macros.h2
-rw-r--r--core/func_ref.cpp13
-rw-r--r--core/func_ref.h1
-rw-r--r--core/image.cpp151
-rw-r--r--core/image.h1
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/marshalls.cpp6
-rw-r--r--core/io/multiplayer_api.cpp26
-rw-r--r--core/io/resource_importer.cpp3
-rw-r--r--core/io/resource_importer.h2
-rw-r--r--core/io/zip_io.h2
-rw-r--r--core/list.h6
-rw-r--r--core/math/a_star.cpp91
-rw-r--r--core/math/a_star.h22
-rw-r--r--core/math/basis.cpp29
-rw-r--r--core/math/expression.cpp7
-rw-r--r--core/math/expression.h1
-rw-r--r--core/math/geometry.cpp106
-rw-r--r--core/math/geometry.h93
-rw-r--r--core/math/math_funcs.h6
-rw-r--r--core/math/rect2.h41
-rw-r--r--core/message_queue.cpp22
-rw-r--r--core/message_queue.h2
-rw-r--r--core/object.cpp34
-rw-r--r--core/object.h7
-rw-r--r--core/os/input.cpp8
-rw-r--r--core/os/input_event.cpp13
-rw-r--r--core/os/os.cpp3
-rw-r--r--core/os/os.h3
-rw-r--r--core/script_language.cpp1
-rw-r--r--core/script_language.h5
-rw-r--r--core/translation.cpp18
-rw-r--r--core/undo_redo.cpp16
-rw-r--r--core/undo_redo.h4
-rw-r--r--core/variant.cpp2
-rw-r--r--doc/classes/@GDScript.xml25
-rw-r--r--doc/classes/AcceptDialog.xml4
-rw-r--r--doc/classes/AnimatedSprite.xml3
-rw-r--r--doc/classes/AnimatedSprite3D.xml2
-rw-r--r--doc/classes/Animation.xml40
-rw-r--r--doc/classes/AnimationNode.xml6
-rw-r--r--doc/classes/AnimationNodeStateMachine.xml31
-rw-r--r--doc/classes/AnimationNodeStateMachinePlayback.xml12
-rw-r--r--doc/classes/AnimationNodeStateMachineTransition.xml5
-rw-r--r--doc/classes/AnimationTreePlayer.xml4
-rw-r--r--doc/classes/Area2D.xml4
-rw-r--r--doc/classes/Array.xml2
-rw-r--r--doc/classes/ArrayMesh.xml10
-rw-r--r--doc/classes/AudioStreamPlayer.xml9
-rw-r--r--doc/classes/BaseButton.xml7
-rw-r--r--doc/classes/Basis.xml12
-rw-r--r--doc/classes/Camera.xml9
-rw-r--r--doc/classes/Camera2D.xml2
-rw-r--r--doc/classes/CanvasItem.xml46
-rw-r--r--doc/classes/CheckButton.xml4
-rw-r--r--doc/classes/ClassDB.xml6
-rw-r--r--doc/classes/CollisionObject2D.xml8
-rw-r--r--doc/classes/ColorPicker.xml6
-rw-r--r--doc/classes/ConcavePolygonShape.xml2
-rw-r--r--doc/classes/ConfirmationDialog.xml2
-rw-r--r--doc/classes/Control.xml34
-rw-r--r--doc/classes/Dictionary.xml16
-rw-r--r--doc/classes/Directory.xml16
-rw-r--r--doc/classes/EditorExportPlugin.xml6
-rw-r--r--doc/classes/EditorFileSystem.xml4
-rw-r--r--doc/classes/EditorInspectorPlugin.xml4
-rw-r--r--doc/classes/EditorPlugin.xml5
-rw-r--r--doc/classes/EditorResourcePreviewGenerator.xml18
-rw-r--r--doc/classes/EditorSpatialGizmo.xml2
-rw-r--r--doc/classes/FileDialog.xml2
-rw-r--r--doc/classes/Font.xml18
-rw-r--r--doc/classes/FuncRef.xml6
-rw-r--r--doc/classes/Geometry.xml169
-rw-r--r--doc/classes/GraphEdit.xml4
-rw-r--r--doc/classes/GraphNode.xml28
-rw-r--r--doc/classes/HeightMapShape.xml2
-rw-r--r--doc/classes/Image.xml2
-rw-r--r--doc/classes/ImageTexture.xml2
-rw-r--r--doc/classes/Input.xml2
-rw-r--r--doc/classes/ItemList.xml6
-rw-r--r--doc/classes/KinematicBody2D.xml2
-rw-r--r--doc/classes/Line2D.xml3
-rw-r--r--doc/classes/LineEdit.xml13
-rw-r--r--doc/classes/Marshalls.xml12
-rw-r--r--doc/classes/MenuButton.xml2
-rw-r--r--doc/classes/Mesh.xml4
-rw-r--r--doc/classes/MeshLibrary.xml6
-rw-r--r--doc/classes/MultiMesh.xml24
-rw-r--r--doc/classes/NodePath.xml4
-rw-r--r--doc/classes/OS.xml14
-rw-r--r--doc/classes/Object.xml24
-rw-r--r--doc/classes/OptionButton.xml16
-rw-r--r--doc/classes/PacketPeer.xml4
-rw-r--r--doc/classes/PacketPeerUDP.xml6
-rw-r--r--doc/classes/Panel.xml4
-rw-r--r--doc/classes/Path2D.xml1
-rw-r--r--doc/classes/Physics2DServer.xml8
-rw-r--r--doc/classes/PhysicsBody.xml12
-rw-r--r--doc/classes/PhysicsBody2D.xml12
-rw-r--r--doc/classes/PhysicsServer.xml28
-rw-r--r--doc/classes/PoolByteArray.xml4
-rw-r--r--doc/classes/PoolColorArray.xml2
-rw-r--r--doc/classes/PoolIntArray.xml2
-rw-r--r--doc/classes/PoolRealArray.xml2
-rw-r--r--doc/classes/PoolStringArray.xml2
-rw-r--r--doc/classes/PoolVector2Array.xml2
-rw-r--r--doc/classes/PoolVector3Array.xml2
-rw-r--r--doc/classes/PopupMenu.xml28
-rw-r--r--doc/classes/PrismMesh.xml2
-rw-r--r--doc/classes/ProjectSettings.xml4
-rw-r--r--doc/classes/Quat.xml2
-rw-r--r--doc/classes/RayCast.xml4
-rw-r--r--doc/classes/RayCast2D.xml6
-rw-r--r--doc/classes/ResourceInteractiveLoader.xml6
-rw-r--r--doc/classes/ResourceLoader.xml2
-rw-r--r--doc/classes/RigidBody.xml2
-rw-r--r--doc/classes/RigidBody2D.xml3
-rw-r--r--doc/classes/ScriptEditor.xml9
-rw-r--r--doc/classes/Shape2D.xml2
-rw-r--r--doc/classes/Skeleton.xml20
-rw-r--r--doc/classes/Sprite.xml10
-rw-r--r--doc/classes/StreamPeer.xml6
-rw-r--r--doc/classes/StreamPeerSSL.xml2
-rw-r--r--doc/classes/StreamPeerTCP.xml6
-rw-r--r--doc/classes/String.xml1
-rw-r--r--doc/classes/StyleBox.xml6
-rw-r--r--doc/classes/TCP_Server.xml2
-rw-r--r--doc/classes/TextEdit.xml35
-rw-r--r--doc/classes/Texture.xml6
-rw-r--r--doc/classes/Theme.xml1
-rw-r--r--doc/classes/Vector2.xml2
-rw-r--r--doc/classes/Viewport.xml3
-rw-r--r--doc/classes/VisualServer.xml31
-rw-r--r--doc/classes/VisualShaderNodeFresnel.xml (renamed from modules/gdnative/doc_classes/WebRTCPeerGDNative.xml)2
-rw-r--r--doc/classes/VisualShaderNodeScalarFunc.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorFunc.xml2
-rw-r--r--doc/classes/WindowDialog.xml2
-rwxr-xr-xdoc/tools/makerst.py15
-rw-r--r--drivers/dummy/rasterizer_dummy.h3
-rw-r--r--drivers/gl_context/SCsub2
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp26
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp4
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp133
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h26
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp323
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h20
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp10
-rw-r--r--drivers/gles2/shaders/canvas.glsl2
-rw-r--r--drivers/gles2/shaders/scene.glsl96
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp28
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h4
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp1
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl2
-rw-r--r--drivers/gles3/shaders/scene.glsl229
-rw-r--r--drivers/png/SCsub4
-rw-r--r--drivers/unix/net_socket_posix.cpp11
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--editor/SCsub3
-rw-r--r--editor/animation_bezier_editor.cpp54
-rw-r--r--editor/animation_track_editor.cpp133
-rw-r--r--editor/animation_track_editor.h5
-rw-r--r--editor/code_editor.cpp78
-rw-r--r--editor/code_editor.h5
-rw-r--r--editor/create_dialog.cpp2
-rw-r--r--editor/dependency_editor.cpp4
-rw-r--r--editor/doc/doc_dump.cpp2
-rw-r--r--editor/editor_audio_buses.cpp22
-rw-r--r--editor/editor_autoload_settings.cpp4
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_export.cpp35
-rw-r--r--editor/editor_file_system.cpp8
-rw-r--r--editor/editor_file_system.h2
-rw-r--r--editor/editor_folding.cpp6
-rw-r--r--editor/editor_fonts.cpp3
-rw-r--r--editor/editor_log.cpp17
-rw-r--r--editor/editor_log.h3
-rw-r--r--editor/editor_node.cpp35
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/editor_resource_preview.cpp35
-rw-r--r--editor/editor_resource_preview.h3
-rw-r--r--editor/editor_settings.cpp28
-rw-r--r--editor/editor_themes.cpp7
-rw-r--r--editor/export_template_manager.cpp6
-rw-r--r--editor/filesystem_dock.cpp38
-rw-r--r--editor/filesystem_dock.h1
-rw-r--r--editor/find_in_files.cpp3
-rw-r--r--editor/icons/icon_GUI_space.svg71
-rw-r--r--editor/import/resource_importer_scene.cpp23
-rw-r--r--editor/import/resource_importer_texture.cpp2
-rw-r--r--editor/import/resource_importer_wav.cpp4
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp156
-rw-r--r--editor/plugins/animation_player_editor_plugin.h6
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp245
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h13
-rw-r--r--editor/plugins/curve_editor_plugin.cpp18
-rw-r--r--editor/plugins/editor_preview_plugins.cpp8
-rw-r--r--editor/plugins/editor_preview_plugins.h8
-rw-r--r--editor/plugins/physical_bone_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp38
-rw-r--r--editor/plugins/script_editor_plugin.h1
-rw-r--r--editor/plugins/script_text_editor.cpp43
-rw-r--r--editor/plugins/script_text_editor.h4
-rw-r--r--editor/plugins/shader_editor_plugin.cpp28
-rw-r--r--editor/plugins/shader_editor_plugin.h4
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp16
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp47
-rw-r--r--editor/plugins/text_editor.cpp29
-rw-r--r--editor/plugins/text_editor.h4
-rw-r--r--editor/plugins/theme_editor_plugin.cpp9
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp83
-rw-r--r--editor/plugins/tile_map_editor_plugin.h4
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp755
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h29
-rw-r--r--editor/project_export.cpp12
-rw-r--r--editor/project_manager.cpp135
-rw-r--r--editor/project_manager.h6
-rw-r--r--editor/project_settings_editor.cpp11
-rw-r--r--editor/quick_open.cpp18
-rw-r--r--editor/rename_dialog.cpp2
-rw-r--r--editor/scene_tree_dock.cpp3
-rw-r--r--editor/scene_tree_editor.cpp28
-rw-r--r--editor/scene_tree_editor.h1
-rw-r--r--editor/script_create_dialog.cpp303
-rw-r--r--editor/script_create_dialog.h11
-rw-r--r--editor/script_editor_debugger.cpp20
-rw-r--r--editor/script_editor_debugger.h1
-rw-r--r--editor/settings_config_dialog.cpp2
-rw-r--r--editor/spatial_editor_gizmos.cpp6
-rw-r--r--editor/translations/af.po11
-rw-r--r--editor/translations/ar.po70
-rw-r--r--editor/translations/bg.po14
-rw-r--r--editor/translations/bn.po11
-rw-r--r--editor/translations/ca.po460
-rw-r--r--editor/translations/cs.po12
-rw-r--r--editor/translations/da.po12
-rw-r--r--editor/translations/de.po80
-rw-r--r--editor/translations/de_CH.po12
-rw-r--r--editor/translations/editor.pot10
-rw-r--r--editor/translations/el.po12
-rw-r--r--editor/translations/eo.po9952
-rw-r--r--editor/translations/es.po82
-rw-r--r--editor/translations/es_AR.po84
-rw-r--r--editor/translations/et.po8
-rw-r--r--editor/translations/fa.po12
-rw-r--r--editor/translations/fi.po77
-rw-r--r--editor/translations/fil.po8
-rw-r--r--editor/translations/fr.po118
-rw-r--r--editor/translations/he.po12
-rw-r--r--editor/translations/hi.po23
-rw-r--r--editor/translations/hr.po144
-rw-r--r--editor/translations/hu.po11
-rw-r--r--editor/translations/id.po12
-rw-r--r--editor/translations/is.po12
-rw-r--r--editor/translations/it.po153
-rw-r--r--editor/translations/ja.po30
-rw-r--r--editor/translations/ka.po11
-rw-r--r--editor/translations/ko.po85
-rw-r--r--editor/translations/lt.po14
-rw-r--r--editor/translations/lv.po12
-rw-r--r--editor/translations/mi.po8
-rw-r--r--editor/translations/ml.po8
-rw-r--r--editor/translations/ms.po12
-rw-r--r--editor/translations/nb.po81
-rw-r--r--editor/translations/nl.po133
-rw-r--r--editor/translations/pl.po78
-rw-r--r--editor/translations/pr.po9
-rw-r--r--editor/translations/pt_BR.po21
-rw-r--r--editor/translations/pt_PT.po90
-rw-r--r--editor/translations/ro.po11
-rw-r--r--editor/translations/ru.po72
-rw-r--r--editor/translations/si.po12
-rw-r--r--editor/translations/sk.po12
-rw-r--r--editor/translations/sl.po27
-rw-r--r--editor/translations/sq.po12
-rw-r--r--editor/translations/sr_Cyrl.po11
-rw-r--r--editor/translations/sr_Latn.po14
-rw-r--r--editor/translations/sv.po11
-rw-r--r--editor/translations/ta.po12
-rw-r--r--editor/translations/te.po8
-rw-r--r--editor/translations/th.po11
-rw-r--r--editor/translations/tr.po345
-rw-r--r--editor/translations/uk.po77
-rw-r--r--editor/translations/ur_PK.po8
-rw-r--r--editor/translations/vi.po11
-rw-r--r--editor/translations/zh_CN.po23
-rw-r--r--editor/translations/zh_HK.po11
-rw-r--r--editor/translations/zh_TW.po12
-rw-r--r--main/main.cpp128
-rw-r--r--main/tests/test_string.cpp18
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj4
-rwxr-xr-xmisc/travis/clang-format.sh2
-rw-r--r--modules/assimp/SCsub26
-rw-r--r--modules/assimp/editor_scene_importer_assimp.cpp12
-rw-r--r--modules/bullet/SCsub2
-rw-r--r--modules/bullet/btRayShape.cpp12
-rw-r--r--modules/bullet/btRayShape.h2
-rw-r--r--modules/bullet/bullet_physics_server.cpp16
-rw-r--r--modules/bullet/bullet_physics_server.h8
-rw-r--r--modules/bullet/collision_object_bullet.cpp35
-rw-r--r--modules/bullet/collision_object_bullet.h3
-rw-r--r--modules/bullet/godot_ray_world_algorithm.cpp7
-rw-r--r--modules/bullet/rigid_body_bullet.cpp10
-rw-r--r--modules/bullet/shape_bullet.cpp8
-rw-r--r--modules/bullet/space_bullet.cpp301
-rw-r--r--modules/bullet/space_bullet.h2
-rw-r--r--modules/csg/csg.cpp2
-rw-r--r--modules/csg/csg_shape.cpp3
-rw-r--r--modules/cvtt/SCsub2
-rw-r--r--modules/enet/SCsub2
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml2
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp2
-rw-r--r--modules/etc/SCsub2
-rw-r--r--modules/freetype/SCsub23
-rw-r--r--modules/gdnative/SCsub4
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.cpp9
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.h1
-rw-r--r--modules/gdnative/config.py3
-rw-r--r--modules/gdnative/doc_classes/WebRTCDataChannelGDNative.xml13
-rw-r--r--modules/gdnative/doc_classes/WebRTCPeerConnectionGDNative.xml13
-rw-r--r--modules/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/gdnative.h4
-rw-r--r--modules/gdnative/gdnative/dictionary.cpp9
-rw-r--r--modules/gdnative/gdnative/variant.cpp2
-rw-r--r--modules/gdnative/gdnative_api.json38
-rw-r--r--modules/gdnative/gdnative_library_singleton_editor.cpp134
-rw-r--r--modules/gdnative/gdnative_library_singleton_editor.h12
-rw-r--r--modules/gdnative/include/arvr/godot_arvr.h1
-rw-r--r--modules/gdnative/include/gdnative/dictionary.h2
-rw-r--r--modules/gdnative/include/net/godot_net.h32
-rw-r--r--modules/gdnative/include/net/godot_webrtc.h122
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp34
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp29
-rw-r--r--modules/gdnative/nativescript/nativescript.h1
-rw-r--r--modules/gdnative/net/webrtc_gdnative.cpp (renamed from modules/gdnative/net/webrtc_peer_gdnative.cpp)23
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.h2
-rw-r--r--modules/gdnative/register_types.cpp122
-rw-r--r--modules/gdnative/videodecoder/SCsub2
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.cpp34
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp2
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.h2
-rw-r--r--modules/gdscript/gdscript.cpp26
-rw-r--r--modules/gdscript/gdscript.h6
-rw-r--r--modules/gdscript/gdscript_editor.cpp47
-rw-r--r--modules/gdscript/gdscript_functions.cpp16
-rw-r--r--modules/gdscript/gdscript_functions.h1
-rw-r--r--modules/gdscript/gdscript_parser.cpp75
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp394
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h44
-rw-r--r--modules/jpg/SCsub2
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp6
-rw-r--r--modules/mobile_vr/mobile_vr_interface.h1
-rw-r--r--modules/mono/build_scripts/mono_configure.py4
-rw-r--r--modules/mono/csharp_script.cpp163
-rw-r--r--modules/mono/csharp_script.h5
-rw-r--r--modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs4
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs5
-rw-r--r--modules/mono/editor/bindings_generator.cpp16
-rw-r--r--modules/mono/editor/bindings_generator.h4
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp23
-rw-r--r--modules/mono/editor/godotsharp_builds.h2
-rw-r--r--modules/mono/editor/godotsharp_export.cpp7
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp5
-rw-r--r--modules/mono/glue/Managed/Files/AABB.cs15
-rw-r--r--modules/mono/glue/Managed/Files/Basis.cs73
-rw-r--r--modules/mono/glue/Managed/Files/DynamicObject.cs2
-rw-r--r--modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs4
-rw-r--r--modules/mono/glue/Managed/Files/MarshalUtils.cs154
-rw-r--r--modules/mono/glue/Managed/Files/Mathf.cs33
-rw-r--r--modules/mono/glue/Managed/Files/MathfEx.cs10
-rw-r--r--modules/mono/glue/Managed/Files/Transform2D.cs1
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Node.cs5
-rw-r--r--modules/mono/glue/collections_glue.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp52
-rw-r--r--modules/mono/mono_gd/gd_mono_field.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp228
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h21
-rw-r--r--modules/mono/mono_gd/gd_mono_method.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_method.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_property.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp165
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h58
-rw-r--r--modules/mono/mono_gd/i_mono_class_member.h6
-rw-r--r--modules/mono/utils/string_utils.cpp7
-rw-r--r--modules/ogg/SCsub2
-rw-r--r--modules/opensimplex/SCsub2
-rw-r--r--modules/opus/SCsub4
-rw-r--r--modules/pvr/SCsub2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp7
-rw-r--r--modules/recast/SCsub2
-rw-r--r--modules/recast/navigation_mesh_editor_plugin.cpp12
-rw-r--r--modules/recast/navigation_mesh_generator.cpp171
-rw-r--r--modules/recast/navigation_mesh_generator.h24
-rw-r--r--modules/recast/register_types.cpp17
-rw-r--r--modules/regex/SCsub2
-rw-r--r--modules/regex/doc_classes/RegEx.xml2
-rw-r--r--modules/squish/SCsub2
-rw-r--r--modules/svg/SCsub4
-rw-r--r--modules/theora/SCsub6
-rw-r--r--modules/theora/video_stream_theora.cpp6
-rw-r--r--modules/tinyexr/SCsub2
-rw-r--r--modules/upnp/SCsub2
-rw-r--r--modules/vhacd/SCsub2
-rw-r--r--modules/visual_script/visual_script.cpp37
-rw-r--r--modules/visual_script/visual_script.h2
-rw-r--r--modules/visual_script/visual_script_editor.cpp156
-rw-r--r--modules/visual_script/visual_script_editor.h2
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp363
-rw-r--r--modules/vorbis/SCsub4
-rw-r--r--modules/webm/SCsub10
-rw-r--r--modules/webm/libvpx/SCsub4
-rw-r--r--modules/webm/video_stream_webm.cpp27
-rw-r--r--modules/webp/SCsub2
-rw-r--r--modules/webrtc/SCsub3
-rw-r--r--modules/webrtc/config.py3
-rw-r--r--modules/webrtc/doc_classes/WebRTCDataChannel.xml95
-rw-r--r--modules/webrtc/doc_classes/WebRTCPeerConnection.xml (renamed from modules/webrtc/doc_classes/WebRTCPeer.xml)56
-rw-r--r--modules/webrtc/register_types.cpp22
-rw-r--r--modules/webrtc/register_types.h4
-rw-r--r--modules/webrtc/webrtc_data_channel.cpp64
-rw-r--r--modules/webrtc/webrtc_data_channel.h (renamed from modules/webrtc/webrtc_peer.h)51
-rw-r--r--modules/webrtc/webrtc_data_channel_gdnative.cpp (renamed from modules/webrtc/webrtc_peer_gdnative.cpp)96
-rw-r--r--modules/webrtc/webrtc_data_channel_gdnative.h (renamed from modules/webrtc/webrtc_peer_gdnative.h)44
-rw-r--r--modules/webrtc/webrtc_data_channel_js.cpp352
-rw-r--r--modules/webrtc/webrtc_data_channel_js.h (renamed from modules/webrtc/webrtc_peer_js.h)63
-rw-r--r--modules/webrtc/webrtc_peer_connection.cpp (renamed from modules/webrtc/webrtc_peer.cpp)52
-rw-r--r--modules/webrtc/webrtc_peer_connection.h74
-rw-r--r--modules/webrtc/webrtc_peer_connection_gdnative.cpp124
-rw-r--r--modules/webrtc/webrtc_peer_connection_gdnative.h73
-rw-r--r--modules/webrtc/webrtc_peer_connection_js.cpp314
-rw-r--r--modules/webrtc/webrtc_peer_connection_js.h66
-rw-r--r--modules/webrtc/webrtc_peer_js.cpp455
-rw-r--r--modules/websocket/SCsub117
-rw-r--r--modules/websocket/lws_client.cpp5
-rw-r--r--modules/xatlas_unwrap/SCsub2
-rw-r--r--platform/android/detect.py9
-rw-r--r--platform/android/export/export.cpp48
-rw-r--r--platform/android/java/AndroidManifest.xml2
-rw-r--r--platform/android/java/gradlew.bat168
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotLib.java4
-rw-r--r--platform/android/java_godot_io_wrapper.cpp6
-rw-r--r--platform/android/java_godot_io_wrapper.h2
-rw-r--r--platform/android/java_godot_lib_jni.h2
-rw-r--r--platform/android/os_android.cpp2
-rw-r--r--platform/android/os_android.h2
-rw-r--r--platform/haiku/detect.py4
-rw-r--r--platform/haiku/os_haiku.cpp2
-rw-r--r--platform/haiku/os_haiku.h2
-rw-r--r--platform/iphone/detect.py20
-rw-r--r--platform/iphone/export/export.cpp24
-rw-r--r--platform/iphone/os_iphone.cpp8
-rw-r--r--platform/iphone/os_iphone.h6
-rw-r--r--platform/javascript/detect.py12
-rw-r--r--platform/javascript/os_javascript.cpp4
-rw-r--r--platform/javascript/os_javascript.h4
-rw-r--r--platform/osx/crash_handler_osx.mm7
-rw-r--r--platform/osx/detect.py2
-rw-r--r--platform/osx/export/export.cpp41
-rw-r--r--platform/osx/os_osx.h3
-rw-r--r--platform/osx/os_osx.mm27
-rw-r--r--platform/server/detect.py4
-rw-r--r--platform/server/os_server.cpp2
-rw-r--r--platform/server/os_server.h2
-rw-r--r--platform/uwp/detect.py4
-rw-r--r--platform/uwp/export/export.cpp46
-rw-r--r--platform/uwp/os_uwp.cpp4
-rw-r--r--platform/uwp/os_uwp.h4
-rw-r--r--platform/windows/crash_handler_windows.cpp9
-rw-r--r--platform/windows/detect.py6
-rw-r--r--platform/windows/os_windows.cpp115
-rw-r--r--platform/windows/os_windows.h23
-rw-r--r--platform/x11/context_gl_x11.cpp1
-rw-r--r--platform/x11/crash_handler_x11.cpp17
-rw-r--r--platform/x11/detect.py4
-rw-r--r--platform/x11/os_x11.cpp137
-rw-r--r--platform/x11/os_x11.h2
-rw-r--r--platform/x11/power_x11.cpp2
-rw-r--r--scene/2d/canvas_modulate.cpp2
-rw-r--r--scene/2d/collision_object_2d.cpp4
-rw-r--r--scene/2d/cpu_particles_2d.cpp2
-rw-r--r--scene/2d/line_2d.cpp10
-rw-r--r--scene/2d/line_2d.h2
-rw-r--r--scene/2d/parallax_layer.cpp5
-rw-r--r--scene/2d/path_2d.cpp24
-rw-r--r--scene/2d/skeleton_2d.h6
-rw-r--r--scene/2d/tile_map.cpp7
-rw-r--r--scene/3d/arvr_nodes.cpp26
-rw-r--r--scene/3d/camera.cpp8
-rw-r--r--scene/3d/collision_object.cpp4
-rw-r--r--scene/3d/collision_shape.cpp6
-rw-r--r--scene/3d/cpu_particles.cpp2
-rw-r--r--scene/3d/light.cpp1
-rw-r--r--scene/3d/navigation.cpp64
-rw-r--r--scene/3d/navigation_mesh.cpp110
-rw-r--r--scene/3d/navigation_mesh.h21
-rw-r--r--scene/3d/particles.cpp2
-rw-r--r--scene/3d/physics_body.cpp22
-rw-r--r--scene/3d/physics_body.h2
-rw-r--r--scene/3d/skeleton.cpp2
-rw-r--r--scene/3d/soft_body.cpp2
-rw-r--r--scene/3d/spatial.cpp21
-rw-r--r--scene/animation/animation_node_state_machine.cpp3
-rw-r--r--scene/animation/animation_player.cpp21
-rw-r--r--scene/animation/skeleton_ik.cpp32
-rw-r--r--scene/animation/skeleton_ik.h2
-rw-r--r--scene/audio/audio_stream_player.cpp30
-rw-r--r--scene/audio/audio_stream_player.h1
-rw-r--r--scene/gui/base_button.cpp223
-rw-r--r--scene/gui/base_button.h5
-rw-r--r--scene/gui/check_button.cpp13
-rw-r--r--scene/gui/color_picker.cpp70
-rw-r--r--scene/gui/color_picker.h11
-rw-r--r--scene/gui/container.cpp2
-rw-r--r--scene/gui/control.cpp191
-rw-r--r--scene/gui/control.h12
-rw-r--r--scene/gui/item_list.cpp5
-rw-r--r--scene/gui/line_edit.cpp70
-rw-r--r--scene/gui/menu_button.cpp4
-rw-r--r--scene/gui/option_button.cpp22
-rw-r--r--scene/gui/option_button.h6
-rw-r--r--scene/gui/popup.cpp2
-rw-r--r--scene/gui/popup_menu.cpp143
-rw-r--r--scene/gui/popup_menu.h36
-rw-r--r--scene/gui/rich_text_label.cpp1
-rw-r--r--scene/gui/scroll_bar.cpp16
-rw-r--r--scene/gui/scroll_container.cpp13
-rw-r--r--scene/gui/spin_box.cpp1
-rw-r--r--scene/gui/tab_container.cpp13
-rw-r--r--scene/gui/tabs.cpp6
-rw-r--r--scene/gui/text_edit.cpp375
-rw-r--r--scene/gui/text_edit.h21
-rw-r--r--scene/gui/texture_button.cpp2
-rw-r--r--scene/gui/texture_rect.cpp2
-rw-r--r--scene/gui/tree.cpp4
-rw-r--r--scene/main/node.cpp13
-rw-r--r--scene/main/scene_tree.cpp10
-rw-r--r--scene/main/scene_tree.h2
-rw-r--r--scene/main/viewport.cpp18
-rw-r--r--scene/main/viewport.h4
-rw-r--r--scene/register_scene_types.cpp3
-rw-r--r--scene/resources/animation.cpp41
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/bit_map.cpp40
-rw-r--r--scene/resources/bit_map.h4
-rw-r--r--scene/resources/curve.cpp9
-rw-r--r--scene/resources/default_theme/default_theme.cpp12
-rw-r--r--scene/resources/default_theme/space.pngbin0 -> 122 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h12
-rw-r--r--scene/resources/default_theme/toggle_off_disabled.pngbin0 -> 1676 bytes
-rw-r--r--scene/resources/default_theme/toggle_on_disabled.pngbin0 -> 1698 bytes
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/font.cpp33
-rw-r--r--scene/resources/font.h1
-rw-r--r--scene/resources/height_map_shape.cpp48
-rw-r--r--scene/resources/material.cpp21
-rw-r--r--scene/resources/material.h1
-rw-r--r--scene/resources/multimesh.cpp62
-rw-r--r--scene/resources/multimesh.h5
-rw-r--r--scene/resources/resource_format_text.cpp11
-rw-r--r--scene/resources/resource_format_text.h3
-rw-r--r--scene/resources/sky.cpp2
-rw-r--r--scene/resources/surface_tool.cpp2
-rw-r--r--scene/resources/texture.cpp17
-rw-r--r--scene/resources/tile_set.cpp28
-rw-r--r--scene/resources/visual_shader.cpp662
-rw-r--r--scene/resources/visual_shader.h93
-rw-r--r--scene/resources/visual_shader_nodes.cpp83
-rw-r--r--scene/resources/visual_shader_nodes.h28
-rw-r--r--servers/arvr/arvr_interface.h1
-rw-r--r--servers/audio/effects/audio_effect_record.cpp4
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.cpp4
-rw-r--r--servers/physics/collision_object_sw.cpp3
-rw-r--r--servers/physics/collision_object_sw.h2
-rw-r--r--servers/physics/physics_server_sw.cpp16
-rw-r--r--servers/physics/physics_server_sw.h8
-rw-r--r--servers/physics/space_sw.cpp2
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp4
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h2
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp24
-rw-r--r--servers/physics_2d/physics_2d_server_sw.h12
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.h4
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp13
-rw-r--r--servers/physics_2d/space_2d_sw.cpp2
-rw-r--r--servers/physics_2d_server.cpp8
-rw-r--r--servers/physics_2d_server.h12
-rw-r--r--servers/physics_server.cpp6
-rw-r--r--servers/physics_server.h8
-rw-r--r--servers/visual/rasterizer.h4
-rw-r--r--servers/visual/shader_language.cpp8
-rw-r--r--servers/visual/shader_types.cpp4
-rw-r--r--servers/visual/visual_server_raster.h2
-rw-r--r--servers/visual/visual_server_scene.cpp22
-rw-r--r--servers/visual/visual_server_scene.h6
-rw-r--r--servers/visual/visual_server_viewport.cpp44
-rw-r--r--servers/visual/visual_server_viewport.h2
-rw-r--r--servers/visual/visual_server_wrap_mt.h2
-rw-r--r--servers/visual_server.cpp2
-rw-r--r--servers/visual_server.h4
-rw-r--r--thirdparty/README.md25
-rw-r--r--thirdparty/assimp/code/res/resource.h14
-rw-r--r--thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp19
-rw-r--r--thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp420
-rw-r--r--thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h21
-rw-r--r--thirdparty/cvtt/LICENSE.txt88
-rw-r--r--thirdparty/enet/godot.cpp41
-rw-r--r--thirdparty/glad/glad.c24
-rw-r--r--thirdparty/glad/glad/glad.h29
-rw-r--r--thirdparty/libsimplewebm/OpusVorbisDecoder.cpp2
-rw-r--r--thirdparty/libsimplewebm/OpusVorbisDecoder.hpp4
-rw-r--r--thirdparty/libsimplewebm/VPXDecoder.cpp14
-rw-r--r--thirdparty/libsimplewebm/VPXDecoder.hpp6
-rw-r--r--thirdparty/libwebsockets/core/alloc.c (renamed from thirdparty/libwebsockets/lib/core/alloc.c)0
-rw-r--r--thirdparty/libwebsockets/core/context.c (renamed from thirdparty/libwebsockets/lib/core/context.c)549
-rw-r--r--thirdparty/libwebsockets/core/libwebsockets.c (renamed from thirdparty/libwebsockets/lib/core/libwebsockets.c)941
-rw-r--r--thirdparty/libwebsockets/core/output.c (renamed from thirdparty/libwebsockets/lib/core/output.c)183
-rw-r--r--thirdparty/libwebsockets/core/pollfd.c (renamed from thirdparty/libwebsockets/lib/core/pollfd.c)120
-rw-r--r--thirdparty/libwebsockets/core/private.h (renamed from thirdparty/libwebsockets/lib/core/private.h)565
-rw-r--r--thirdparty/libwebsockets/core/service.c (renamed from thirdparty/libwebsockets/lib/core/service.c)247
-rw-r--r--thirdparty/libwebsockets/event-libs/poll/poll.c (renamed from thirdparty/libwebsockets/lib/event-libs/poll/poll.c)0
-rw-r--r--thirdparty/libwebsockets/event-libs/poll/private.h (renamed from thirdparty/libwebsockets/lib/event-libs/poll/private.h)0
-rw-r--r--thirdparty/libwebsockets/event-libs/private.h (renamed from thirdparty/libwebsockets/lib/event-libs/private.h)2
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets.h435
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-adopt.h185
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-callbacks.h807
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-cgi.h103
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-client.h231
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-context-vhost.h927
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-dbus.h90
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-diskcache.h185
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-esp32.h226
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-fts.h214
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-genhash.h171
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-genrsa.h190
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-http.h685
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-jwk.h110
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-jws.h101
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-lejp.h262
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-logs.h224
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-lwsac.h191
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-misc.h836
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-network-helper.h105
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-plugin-generic-sessions.h74
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-protocols-plugins.h229
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-purify.h81
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-ring.h305
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-service.h215
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-sha1-base64.h93
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-spa.h140
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-stats.h75
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-threadpool.h231
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-timeout-timer.h164
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-tokenize.h136
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-vfs.h269
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-write.h235
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-writeable.h225
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-ws-close.h124
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-ws-ext.h197
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-ws-state.h92
-rw-r--r--thirdparty/libwebsockets/include/libwebsockets/lws-x509.h177
-rw-r--r--thirdparty/libwebsockets/ipv6_fixes.diff20
-rw-r--r--thirdparty/libwebsockets/lib/core/adopt.c414
-rw-r--r--thirdparty/libwebsockets/lib/core/connect.c287
-rw-r--r--thirdparty/libwebsockets/lib/core/dummy-callback.c611
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/private.h169
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-caps.c85
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-fds.c54
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-file.c172
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-init.c97
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-misc.c83
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-pipe.c62
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-service.c204
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c263
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/private.h148
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-fds.c76
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-file.c185
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-init.c110
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-misc.c108
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-pipe.c46
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-service.c194
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c288
-rw-r--r--thirdparty/libwebsockets/lib/roles/raw-file/ops-raw-file.c108
-rw-r--r--thirdparty/libwebsockets/libwebsockets.h7346
-rw-r--r--thirdparty/libwebsockets/lws_config.h (renamed from thirdparty/libwebsockets/include/lws_config.h)0
-rw-r--r--thirdparty/libwebsockets/lws_config_private.h (renamed from thirdparty/libwebsockets/lib/lws_config_private.h)0
-rw-r--r--thirdparty/libwebsockets/misc/base64-decode.c (renamed from thirdparty/libwebsockets/lib/misc/base64-decode.c)3
-rw-r--r--thirdparty/libwebsockets/misc/getifaddrs.c (renamed from thirdparty/libwebsockets/lib/misc/getifaddrs.c)0
-rw-r--r--thirdparty/libwebsockets/misc/getifaddrs.h (renamed from thirdparty/libwebsockets/lib/misc/getifaddrs.h)0
-rw-r--r--thirdparty/libwebsockets/misc/lejp.c (renamed from thirdparty/libwebsockets/lib/misc/lejp.c)2
-rw-r--r--thirdparty/libwebsockets/misc/sha-1.c (renamed from thirdparty/libwebsockets/lib/misc/sha-1.c)8
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-unix.c982
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-win.c852
-rw-r--r--thirdparty/libwebsockets/roles/h1/ops-h1.c (renamed from thirdparty/libwebsockets/lib/roles/h1/ops-h1.c)391
-rw-r--r--thirdparty/libwebsockets/roles/h1/private.h (renamed from thirdparty/libwebsockets/lib/roles/h1/private.h)0
-rw-r--r--thirdparty/libwebsockets/roles/http/client/client-handshake.c (renamed from thirdparty/libwebsockets/lib/roles/http/client/client-handshake.c)432
-rw-r--r--thirdparty/libwebsockets/roles/http/client/client.c (renamed from thirdparty/libwebsockets/lib/roles/http/client/client.c)133
-rw-r--r--thirdparty/libwebsockets/roles/http/header.c (renamed from thirdparty/libwebsockets/lib/roles/http/header.c)172
-rw-r--r--thirdparty/libwebsockets/roles/http/lextable-strings.h (renamed from thirdparty/libwebsockets/lib/roles/http/lextable-strings.h)6
-rw-r--r--thirdparty/libwebsockets/roles/http/lextable.h (renamed from thirdparty/libwebsockets/lib/roles/http/lextable.h)0
-rw-r--r--thirdparty/libwebsockets/roles/http/private.h (renamed from thirdparty/libwebsockets/lib/roles/http/private.h)27
-rw-r--r--thirdparty/libwebsockets/roles/http/server/access-log.c182
-rw-r--r--thirdparty/libwebsockets/roles/http/server/fops-zip.c (renamed from thirdparty/libwebsockets/lib/roles/http/server/fops-zip.c)0
-rw-r--r--thirdparty/libwebsockets/roles/http/server/lejp-conf.c (renamed from thirdparty/libwebsockets/lib/roles/http/server/lejp-conf.c)91
-rw-r--r--thirdparty/libwebsockets/roles/http/server/parsers.c (renamed from thirdparty/libwebsockets/lib/roles/http/server/parsers.c)69
-rw-r--r--thirdparty/libwebsockets/roles/http/server/server.c (renamed from thirdparty/libwebsockets/lib/roles/http/server/server.c)1152
-rw-r--r--thirdparty/libwebsockets/roles/listen/ops-listen.c (renamed from thirdparty/libwebsockets/lib/roles/listen/ops-listen.c)25
-rw-r--r--thirdparty/libwebsockets/roles/pipe/ops-pipe.c (renamed from thirdparty/libwebsockets/lib/roles/pipe/ops-pipe.c)16
-rw-r--r--thirdparty/libwebsockets/roles/private.h (renamed from thirdparty/libwebsockets/lib/roles/private.h)37
-rw-r--r--thirdparty/libwebsockets/roles/raw/ops-raw.c (renamed from thirdparty/libwebsockets/lib/roles/raw-skt/ops-raw-skt.c)120
-rw-r--r--thirdparty/libwebsockets/roles/ws/client-parser-ws.c (renamed from thirdparty/libwebsockets/lib/roles/ws/client-parser-ws.c)10
-rw-r--r--thirdparty/libwebsockets/roles/ws/client-ws.c (renamed from thirdparty/libwebsockets/lib/roles/ws/client-ws.c)85
-rw-r--r--thirdparty/libwebsockets/roles/ws/ops-ws.c (renamed from thirdparty/libwebsockets/lib/roles/ws/ops-ws.c)99
-rw-r--r--thirdparty/libwebsockets/roles/ws/private.h (renamed from thirdparty/libwebsockets/lib/roles/ws/private.h)0
-rw-r--r--thirdparty/libwebsockets/roles/ws/server-ws.c (renamed from thirdparty/libwebsockets/lib/roles/ws/server-ws.c)230
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/lws-genhash.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/lws-genrsa.c)12
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/mbedtls-client.c)21
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/mbedtls-server.c)19
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/ssl.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/ssl.c)33
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl3.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl3.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_cert.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_cert.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_code.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_code.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_dbg.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_dbg.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_lib.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_lib.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_methods.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_methods.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_pkey.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_pkey.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_stack.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_stack.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_types.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_types.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_x509.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_x509.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/tls1.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/tls1.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/x509_vfy.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/x509_vfy.h)0
-rwxr-xr-xthirdparty/libwebsockets/tls/mbedtls/wrapper/include/openssl/ssl.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/openssl/ssl.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_pm.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/platform/ssl_pm.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_port.h (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/platform/ssl_port.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_cert.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_cert.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_lib.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_lib.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_methods.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_methods.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_pkey.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_pkey.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_stack.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_stack.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_x509.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_x509.c)0
-rwxr-xr-xthirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_pm.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/platform/ssl_pm.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_port.c (renamed from thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/platform/ssl_port.c)0
-rw-r--r--thirdparty/libwebsockets/tls/private.h (renamed from thirdparty/libwebsockets/lib/tls/private.h)19
-rw-r--r--thirdparty/libwebsockets/tls/tls-client.c (renamed from thirdparty/libwebsockets/lib/tls/tls-client.c)15
-rw-r--r--thirdparty/libwebsockets/tls/tls-server.c (renamed from thirdparty/libwebsockets/lib/tls/tls-server.c)28
-rw-r--r--thirdparty/libwebsockets/tls/tls.c (renamed from thirdparty/libwebsockets/lib/tls/tls.c)53
-rw-r--r--thirdparty/libwebsockets/uwp_fixes.diff14
-rw-r--r--thirdparty/libwebsockets/win32helpers/getopt.c306
-rw-r--r--thirdparty/libwebsockets/win32helpers/getopt_long.c480
-rw-r--r--thirdparty/libwebsockets/win32helpers/gettimeofday.c70
-rw-r--r--thirdparty/misc/clipper-exceptions.patch154
-rw-r--r--thirdparty/misc/clipper.cpp68
-rw-r--r--thirdparty/misc/yuv2rgb.h121
-rw-r--r--thirdparty/xatlas/xatlas.cpp44
771 files changed, 36123 insertions, 22820 deletions
diff --git a/.editorconfig b/.editorconfig
index ab03b8421c..56cc2e9c2d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -9,7 +9,7 @@ insert_final_newline = true
[*.{cpp,hpp,c,h,mm}]
trim_trailing_whitespace = true
-[{*.{py,cs},SCsub}]
+[{*.{py,cs},SConstruct,SCsub}]
indent_style = space
indent_size = 4
diff --git a/.gitattributes b/.gitattributes
index 47ba2b45bb..40a5e6183f 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,12 +1,15 @@
# Properly detect languages on Github
*.h linguist-language=cpp
*.inc linguist-language=cpp
-drivers/* linguist-vendored
+thirdparty/* linguist-vendored
-*.cpp eol=lf
-*.mm eol=lf
-*.h eol=lf
-*.py eol=lf
-*.hpp eol=lf
-*.xml eol=lf
-*.natvis eol=lf
+# Normalize EOL for all files that Git considers text files
+* text=auto eol=lf
+
+# The above only works properly for Git 2.10+, so for older versions
+# we need to manually list the binary files we don't want modified.
+*.icns binary
+*.ico binary
+*.jar binary
+*.png binary
+*.ttf binary
diff --git a/.travis.yml b/.travis.yml
index 727567b8e7..b8e02a5be8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,9 +23,9 @@ matrix:
addons:
apt:
sources:
- - llvm-toolchain-xenial-6.0
+ - llvm-toolchain-xenial-8
packages:
- - clang-format-6.0
+ - clang-format-8
- env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-8 MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes"
os: linux
diff --git a/AUTHORS.md b/AUTHORS.md
index 99482fb4df..ba563eb507 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -89,6 +89,7 @@ name is available.
Kostadin Damyanov (Max-Might)
K. S. Ernest (iFire) Lee (fire)
Leon Krause (eska014)
+ Lucien Menassol (Kanabenki)
m4nu3lf
Marcelo Fernandez (marcelofg55)
Marc Gilleron (Zylann)
@@ -133,6 +134,7 @@ name is available.
Thomas Herzog (karroffel)
Timo (toger5)
Timo Schwarzer (timoschwarzer)
+ Tomasz Chabora (KoBeWi)
Vinzenz Feenstra (vinzenz)
박한얼 (volzhs)
V. Vamsi Krishna (vkbsb)
diff --git a/CODEOWNERS b/CODEOWNERS
index e25eefb1dd..399fca03e8 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -2,8 +2,6 @@
# Each line is a file pattern followed by one or more owners.
# Owners can be @users, @org/teams or emails
-/core/ @reduz
-
/doc/ @godotengine/documentation
doc_classes/* @godotengine/documentation
@@ -22,22 +20,19 @@ doc_classes/* @godotengine/documentation
/drivers/winmidi/ @marcelofg55
/drivers/xaudio2/ @marcelofg55
-# Porting
-/drivers/unix/ @reduz @hpvb
-/drivers/windows/ @reduz @hpvb
+/drivers/unix/ @hpvb
+/drivers/windows/ @hpvb
/editor/icons/ @djrm
-/main/ @reduz
-
/misc/ @akien-mga
/modules/bullet/ @AndreaCatania
-/modules/csg/ @reduz @BastiaanOlij
+/modules/csg/ @BastiaanOlij
/modules/enet/ @godotengine/network
/modules/gdnative/ @karroffel
/modules/gdnative/*arvr/ @BastiaanOlij
-/modules/gdscript/ @reduz @vnen @bojidar-bg
+/modules/gdscript/ @vnen @bojidar-bg
/modules/mbedtls/ @godotengine/network
/modules/mobile_vr/ @BastiaanOlij
/modules/mono/ @neikeq
@@ -49,8 +44,6 @@ doc_classes/* @godotengine/documentation
/platform/javascript/ @eska014
/platform/uwp/ @vnen
-/scene/main/ @reduz
-
/server/physics*/ @reduz @AndreaCatania
/server/visual*/ @reduz @karroffel
diff --git a/DONORS.md b/DONORS.md
index fc332d4beb..95c46c139b 100644
--- a/DONORS.md
+++ b/DONORS.md
@@ -28,6 +28,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Christian Uldall Pedersen
Christoph Woinke
Connor Hill
+ Denis Malyavin
Edward Flick
GameDev.net
GameDev.tv
@@ -38,7 +39,6 @@ generous deed immortalized in the next stable release of Godot Engine.
Justin Arnold
Kyle Szklenski
Leonard Meagher
- Ludosity AB
Matthieu Huvé
Maxim Karsten
Mike King
@@ -48,20 +48,25 @@ generous deed immortalized in the next stable release of Godot Engine.
Slobodan Milnovic
StarFlare Software
Stephan Lanfermann
+ Stephen Telford
+ Steve
TigerJ
VilliHaukka
+ Xananax
Zashi
## Gold donors
+ Andrei
Brandon Waite
cheese65536
David Gehrig
+ Ed Morley
Florian Krick
+ Grady
Jakub Grzesik
K9Kraken
Manuele Finocchiaro
- Nathanael Beisiegel
Officine Pixel S.n.c.
Retro Village
Sofox
@@ -73,8 +78,8 @@ generous deed immortalized in the next stable release of Godot Engine.
Asher Glick
Austen McRae
Daniel James
- Daniel Lynn
David Giardi
+ David Graham
Edward E
Florian Breisch
Gero
@@ -87,22 +92,22 @@ generous deed immortalized in the next stable release of Godot Engine.
Karl Werf
Kommentgames
Krzysztof Dluzniewski
+ Luke
Moonwards
Mored1984
- Not Invader Zim
paul gruenbacher
Paul LaMotte
Rob Messick
Ross Esmond
+ Ryan Badour
Scott Wadden
Sergey
Svenne Krap
Tom Langwaldt
William Wold
Wyatt Goodin
- Xananax
- Abel Oroz Vicente
+ Chris Goddard
Chris Serino
Christian Padilla
Conrad Curry
@@ -120,6 +125,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Pascal Grüter
Petr Malac
Rami
+ Reneator
Robert Willes
Robin Arys
Ronnie Ashlock
@@ -134,8 +140,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Andrew Bowen
Asdf
Benjamin W Flint
- Chau Siu Hung
- Chris Goddard
+ Carlos de Sousa Marques
Chris Petrich
Christian Leth Jeppesen
Christoph Schröder
@@ -145,8 +150,6 @@ generous deed immortalized in the next stable release of Godot Engine.
Daniel
Daniel Eichler
Deadly Lampshade
- Eagle 3d
- E.G.
Eric
Eric Monson
Ethan Bennis
@@ -165,6 +168,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Juan T Chen
Juraj Móza
Kasper Jeppesen
+ Klaus The.
Klavdij Voncina
Leandro Voltolino
Maarten Elings
@@ -177,10 +181,9 @@ generous deed immortalized in the next stable release of Godot Engine.
Matt Eunson
Matthew Hillier
Max R.R. Collada
- MegaC
+ M H
Nick Nikitin
Oliver Dick
- oziatek
Paul Hocker
Paul Von Zimmerman
Pete Goodwin
@@ -214,7 +217,10 @@ generous deed immortalized in the next stable release of Godot Engine.
Alice Robinson
Andreas Evers
Andreas Krampitz
+ Andrew Peart
Anthony Bongiovanni
+ Anthony Staunton
+ Antony K. Jones
Arda Erol
Arthur S. Muszynski
Aubrey Falconer
@@ -226,9 +232,11 @@ generous deed immortalized in the next stable release of Godot Engine.
Ben Phelan
Ben Vercammen
Bernd Jänichen
+ Black Block
Blair Allen
- Brandon
- Brandon Schaffer
+ Bobby CC Wong
+ Boyquotes
+ Branwen Zak
Bryan Stevenson
Carl Winder
Carwyn Edwards
@@ -240,29 +248,37 @@ generous deed immortalized in the next stable release of Godot Engine.
Christopher Fisher
Chris Wilson
Clay Heaton
+ Cobaltum
Collin Shooltz
+ Dag Sundin Söderström
Daniel Johnson
- DanielMaximiano
Daniel Reed
+ Danny Welch
+ Dave Watts
David Bullock
David Cravens
David May
- Diliup Gabadamudalige
+ Dimitri Stanojevic
Dominik Wetzel
Duobix
Edward Herbert
+ E.G.
Egon Elbre
+ Ellen Marie Dash
Elmeri '- Duy Kevin Nguyen
Emanuel Kotzayan
+ Eric Ellingson
Eric Martini
Eric McCarthy
Eric Williams
Fabian Lökes
+ Felix Kollmann
fengjiongmax
Foomf
G3Dev sàrl
Gary Hulst
Gerrit Großkopf
+ gmmath
Grant Clarke
Greg Olson
Greg Pennefather
@@ -278,9 +294,12 @@ generous deed immortalized in the next stable release of Godot Engine.
Jaime Ruiz-Borau Vizárraga
Jako Danar
James A F Manley
+ Jax
Jeff Hungerford
+ Jeff Nyte
Jeremy Kahn
Jesse Dubay
+ Joe Alden
Joel Fivat
Joel Setterberg
Johannes Wuensch
@@ -297,8 +316,6 @@ generous deed immortalized in the next stable release of Godot Engine.
Juan Negrier
Judd
Julian Murgia
- Julius Hackel
- Kajornthep Piyanun
KC Chan
kickmaniac
Kiyohiro Kawamura (kyorohiro)
@@ -309,16 +326,16 @@ generous deed immortalized in the next stable release of Godot Engine.
kycho
Levi Lindsey
Linus Lind Lundgren
+ Lionel Gaillard
Luis Moraes
Macil
magodev
Major Haul
Malcolm
+ Malik Ahmed
Markus Michael Egger
Martin Holas
Matthew Little
- Matthias Grandis
- Matt Welke
Maxwell
medecau
Menno Finlay-Smits
@@ -342,26 +359,24 @@ generous deed immortalized in the next stable release of Godot Engine.
Nicolás Montaña
Nicolas SAN AGUSTIN
Nithin Jino
+ NZ
Oscar Norlander
Pan Ip
+ Patrick Forringer
Patrick Nafarrete
Paul Gieske
Paul Mason
Paweł Kowal
- Phillip Ryals
+ Philip O. Staiger
Pierre-Igor Berthet
Pietro Vertechi
Piotr Kaczmarski
Pitsanu Tongprasin
Poryg
- Prokhorenko Leonid
- Psyagnostic
- Rafael
Raphael Leroux
+ Red Hara
Rémi Verschelde
- Reneator
Ricardo Alcantara
- Richman Stewart
Rob Crowle
Robert Farr (Larington)
Robert Hernandez
@@ -370,31 +385,37 @@ generous deed immortalized in the next stable release of Godot Engine.
Roger Smith
Roland RzÄ…sa
Roman Tinkov
- Ryan Cheung
Ryan Groom
Ryan Hentz
+ Saad Khoudmi
+ Samdze
Sasori Olkof
Scott D. Yelich
Sebastian Michailidis
+ Shane Sicienski
Shane Spoor
Simon Wenner
+ SK
Sootstone
Theo Cranmore
Thibault Barbaroux
+ thomas
Thomas Bell
- Thomas Holmes
Thomas Kelly
Thomas Kurz
tiansheng li
Tim
Tim Drumheller
Tim Gudex
+ Timo Schmidt
Tom Larrow
Torsten Crass
+ Travis O'Brien
Tryggve Sollid
- Tyler Stafos
+ Tyler Strafos
UltyX
Vaiktorg
+ Veodok
Victor
Vigilant Watch
Viktor Ferenczi
@@ -403,7 +424,6 @@ generous deed immortalized in the next stable release of Godot Engine.
werner mendizabal
Wiley Thompson
Will
- William Gervasio
William Hogben
Wout Standaert
diff --git a/SConstruct b/SConstruct
index e943f8dc04..17cf779d4a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -149,7 +149,7 @@ opts.Add(BoolVariable('builtin_libwebsockets', "Use the built-in libwebsockets l
opts.Add(BoolVariable('builtin_mbedtls', "Use the built-in mbedTLS library", True))
opts.Add(BoolVariable('builtin_miniupnpc', "Use the built-in miniupnpc library", True))
opts.Add(BoolVariable('builtin_opus', "Use the built-in Opus library", True))
-opts.Add(BoolVariable('builtin_pcre2', "Use the built-in PCRE2 library)", True))
+opts.Add(BoolVariable('builtin_pcre2', "Use the built-in PCRE2 library", True))
opts.Add(BoolVariable('builtin_recast', "Use the built-in Recast library", True))
opts.Add(BoolVariable('builtin_squish', "Use the built-in squish library", True))
opts.Add(BoolVariable('builtin_xatlas', "Use the built-in xatlas library", True))
@@ -189,7 +189,7 @@ Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths
-env_base.Append(CPPPATH=['#editor', '#'])
+env_base.Prepend(CPPPATH=['#', '#editor'])
# configure ENV for platform
env_base.platform_exporters = platform_exporters
@@ -226,6 +226,23 @@ if env_base['platform'] != "":
elif env_base['p'] != "":
selected_platform = env_base['p']
env_base["platform"] = selected_platform
+else:
+ # Missing `platform` argument, try to detect platform automatically
+ if sys.platform.startswith('linux'):
+ selected_platform = 'x11'
+ elif sys.platform == 'darwin':
+ selected_platform = 'osx'
+ elif sys.platform == 'win32':
+ selected_platform = 'windows'
+ else:
+ print("Could not detect platform automatically. Supported platforms:")
+ for x in platform_list:
+ print("\t" + x)
+ print("\nPlease run SCons again and select a valid platform: platform=<string>")
+
+ if selected_platform != "":
+ print("Automatically detected platform: " + selected_platform)
+ env_base["platform"] = selected_platform
if selected_platform in platform_list:
tmppath = "./platform/" + selected_platform
@@ -320,7 +337,7 @@ if selected_platform in platform_list:
if (env["warnings"] == 'extra'):
# FIXME: enable -Wclobbered once #26351 is fixed
- # FIXME: enable -Wlogical-op and -Wduplicated-branches once #27594 is merged
+ # FIXME: enable -Wduplicated-branches once #27594 is merged
# 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']
@@ -328,7 +345,7 @@ if selected_platform in platform_list:
env.Append(CXXFLAGS=['-Wctor-dtor-privacy', '-Wnon-virtual-dtor'])
if methods.using_gcc(env):
env.Append(CCFLAGS=['-Wno-clobbered', '-Walloc-zero',
- '-Wduplicated-cond', '-Wstringop-overflow=4'])
+ '-Wduplicated-cond', '-Wstringop-overflow=4', '-Wlogical-op'])
env.Append(CXXFLAGS=['-Wnoexcept', '-Wplacement-new=1'])
version = methods.get_compiler_version(env)
if version != None and version[0] >= '9':
@@ -492,13 +509,13 @@ if selected_platform in platform_list:
if (conf.CheckCHeader(header[0])):
env.AppendUnique(CPPDEFINES=[header[1]])
-else:
+elif selected_platform != "":
- print("No valid target platform selected.")
+ print("Invalid target platform: " + selected_platform)
print("The following platforms were detected:")
for x in platform_list:
print("\t" + x)
- print("\nPlease run SCons again with the argument: platform=<string>")
+ print("\nPlease run SCons again and select a valid platform: platform=<string>")
# The following only makes sense when the env is defined, and assumes it is
if 'env' in locals():
@@ -562,7 +579,7 @@ if 'env' in locals():
# (filename, size, weight).
current_time = time.time()
file_stat = [(x[0], x[1][0], (current_time - x[1][1])) for x in file_stat]
- # Sort by the most resently accessed files (most sensible to keep) first
+ # Sort by the most recently accessed files (most sensible to keep) first
file_stat.sort(key=lambda x: x[2])
# Search for the first entry where the storage limit is
# reached
diff --git a/core/SCsub b/core/SCsub
index d5be74a64f..166b7083e4 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -58,6 +58,7 @@ thirdparty_misc_sources = [
"md5.cpp",
"pcg.cpp",
"triangulator.cpp",
+ "clipper.cpp",
]
thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_misc_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_misc_sources)
@@ -80,9 +81,9 @@ if env['builtin_zlib']:
]
thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
- env_thirdparty.Append(CPPPATH=[thirdparty_zlib_dir])
+ env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
# Needs to be available in main env too
- env.Append(CPPPATH=[thirdparty_zlib_dir])
+ env.Prepend(CPPPATH=[thirdparty_zlib_dir])
env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
@@ -128,9 +129,9 @@ if env['builtin_zstd']:
]
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
- env_thirdparty.Append(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
+ env_thirdparty.Prepend(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
env_thirdparty.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
- env.Append(CPPPATH=thirdparty_zstd_dir)
+ env.Prepend(CPPPATH=thirdparty_zstd_dir)
# Also needed in main env includes will trigger warnings
env.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index ba595b9627..27b33d942b 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -611,6 +611,11 @@ uint64_t _OS::get_dynamic_memory_usage() const {
return OS::get_singleton()->get_dynamic_memory_usage();
}
+void _OS::set_native_icon(const String &p_filename) {
+
+ OS::get_singleton()->set_native_icon(p_filename);
+}
+
void _OS::set_icon(const Ref<Image> &p_icon) {
OS::get_singleton()->set_icon(p_icon);
@@ -1199,6 +1204,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_system_time_secs"), &_OS::get_system_time_secs);
ClassDB::bind_method(D_METHOD("get_system_time_msecs"), &_OS::get_system_time_msecs);
+ ClassDB::bind_method(D_METHOD("set_native_icon", "filename"), &_OS::set_native_icon);
ClassDB::bind_method(D_METHOD("set_icon", "icon"), &_OS::set_icon);
ClassDB::bind_method(D_METHOD("get_exit_code"), &_OS::get_exit_code);
@@ -1491,11 +1497,21 @@ PoolVector<Vector3> _Geometry::segment_intersects_convex(const Vector3 &p_from,
return r;
}
+bool _Geometry::is_polygon_clockwise(const Vector<Vector2> &p_polygon) {
+
+ return Geometry::is_polygon_clockwise(p_polygon);
+}
+
Vector<int> _Geometry::triangulate_polygon(const Vector<Vector2> &p_polygon) {
return Geometry::triangulate_polygon(p_polygon);
}
+Vector<int> _Geometry::triangulate_delaunay_2d(const Vector<Vector2> &p_points) {
+
+ return Geometry::triangulate_delaunay_2d(p_points);
+}
+
Vector<Point2> _Geometry::convex_hull_2d(const Vector<Point2> &p_points) {
return Geometry::convex_hull_2d(p_points);
@@ -1506,6 +1522,107 @@ Vector<Vector3> _Geometry::clip_polygon(const Vector<Vector3> &p_points, const P
return Geometry::clip_polygon(p_points, p_plane);
}
+Array _Geometry::merge_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
+
+ Vector<Vector<Point2> > polys = Geometry::merge_polygons_2d(p_polygon_a, p_polygon_b);
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::clip_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
+
+ Vector<Vector<Point2> > polys = Geometry::clip_polygons_2d(p_polygon_a, p_polygon_b);
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::intersect_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
+
+ Vector<Vector<Point2> > polys = Geometry::intersect_polygons_2d(p_polygon_a, p_polygon_b);
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::exclude_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
+
+ Vector<Vector<Point2> > polys = Geometry::exclude_polygons_2d(p_polygon_a, p_polygon_b);
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::clip_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {
+
+ Vector<Vector<Point2> > polys = Geometry::clip_polyline_with_polygon_2d(p_polyline, p_polygon);
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::intersect_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {
+
+ Vector<Vector<Point2> > polys = Geometry::intersect_polyline_with_polygon_2d(p_polyline, p_polygon);
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::offset_polygon_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type) {
+
+ Vector<Vector<Point2> > polys = Geometry::offset_polygon_2d(p_polygon, p_delta, Geometry::PolyJoinType(p_join_type));
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Array _Geometry::offset_polyline_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) {
+
+ Vector<Vector<Point2> > polys = Geometry::offset_polyline_2d(p_polygon, p_delta, Geometry::PolyJoinType(p_join_type), Geometry::PolyEndType(p_end_type));
+
+ Array ret;
+
+ for (int i = 0; i < polys.size(); ++i) {
+ ret.push_back(polys[i]);
+ }
+ return ret;
+}
+
+Vector<Point2> _Geometry::transform_points_2d(const Vector<Point2> &p_points, const Transform2D &p_mat) {
+
+ return Geometry::transform_points_2d(p_points, p_mat);
+}
+
Dictionary _Geometry::make_atlas(const Vector<Size2> &p_rects) {
Dictionary ret;
@@ -1566,11 +1683,41 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("segment_intersects_convex", "from", "to", "planes"), &_Geometry::segment_intersects_convex);
ClassDB::bind_method(D_METHOD("point_is_inside_triangle", "point", "a", "b", "c"), &_Geometry::point_is_inside_triangle);
+ ClassDB::bind_method(D_METHOD("is_polygon_clockwise", "polygon"), &_Geometry::is_polygon_clockwise);
ClassDB::bind_method(D_METHOD("triangulate_polygon", "polygon"), &_Geometry::triangulate_polygon);
+ ClassDB::bind_method(D_METHOD("triangulate_delaunay_2d", "points"), &_Geometry::triangulate_delaunay_2d);
ClassDB::bind_method(D_METHOD("convex_hull_2d", "points"), &_Geometry::convex_hull_2d);
ClassDB::bind_method(D_METHOD("clip_polygon", "points", "plane"), &_Geometry::clip_polygon);
+ ClassDB::bind_method(D_METHOD("merge_polygons_2d", "polygon_a", "polygon_b"), &_Geometry::merge_polygons_2d);
+ ClassDB::bind_method(D_METHOD("clip_polygons_2d", "polygon_a", "polygon_b"), &_Geometry::clip_polygons_2d);
+ ClassDB::bind_method(D_METHOD("intersect_polygons_2d", "polygon_a", "polygon_b"), &_Geometry::intersect_polygons_2d);
+ ClassDB::bind_method(D_METHOD("exclude_polygons_2d", "polygon_a", "polygon_b"), &_Geometry::exclude_polygons_2d);
+
+ ClassDB::bind_method(D_METHOD("clip_polyline_with_polygon_2d", "polyline", "polygon"), &_Geometry::clip_polyline_with_polygon_2d);
+ ClassDB::bind_method(D_METHOD("intersect_polyline_with_polygon_2d", "polyline", "polygon"), &_Geometry::intersect_polyline_with_polygon_2d);
+
+ ClassDB::bind_method(D_METHOD("offset_polygon_2d", "polygon", "delta", "join_type"), &_Geometry::offset_polygon_2d, DEFVAL(JOIN_SQUARE));
+ ClassDB::bind_method(D_METHOD("offset_polyline_2d", "polyline", "delta", "join_type", "end_type"), &_Geometry::offset_polyline_2d, DEFVAL(JOIN_SQUARE), DEFVAL(END_SQUARE));
+
+ ClassDB::bind_method(D_METHOD("transform_points_2d", "points", "transform"), &_Geometry::transform_points_2d);
+
ClassDB::bind_method(D_METHOD("make_atlas", "sizes"), &_Geometry::make_atlas);
+
+ BIND_ENUM_CONSTANT(OPERATION_UNION);
+ BIND_ENUM_CONSTANT(OPERATION_DIFFERENCE);
+ BIND_ENUM_CONSTANT(OPERATION_INTERSECTION);
+ BIND_ENUM_CONSTANT(OPERATION_XOR);
+
+ BIND_ENUM_CONSTANT(JOIN_SQUARE);
+ BIND_ENUM_CONSTANT(JOIN_ROUND);
+ BIND_ENUM_CONSTANT(JOIN_MITER);
+
+ BIND_ENUM_CONSTANT(END_POLYGON);
+ BIND_ENUM_CONSTANT(END_JOINED);
+ BIND_ENUM_CONSTANT(END_BUTT);
+ BIND_ENUM_CONSTANT(END_SQUARE);
+ BIND_ENUM_CONSTANT(END_ROUND);
}
_Geometry::_Geometry() {
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 2906de4a4a..3e46d24627 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -275,6 +275,7 @@ public:
void set_use_file_access_save_and_swap(bool p_enable);
+ void set_native_icon(const String &p_filename);
void set_icon(const Ref<Image> &p_icon);
int get_exit_code() const;
@@ -402,15 +403,55 @@ public:
real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius);
int get_uv84_normal_bit(const Vector3 &p_vector);
+ bool is_polygon_clockwise(const Vector<Vector2> &p_polygon);
Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon);
+ Vector<int> triangulate_delaunay_2d(const Vector<Vector2> &p_points);
Vector<Point2> convex_hull_2d(const Vector<Point2> &p_points);
Vector<Vector3> clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane);
+ enum PolyBooleanOperation {
+ OPERATION_UNION,
+ OPERATION_DIFFERENCE,
+ OPERATION_INTERSECTION,
+ OPERATION_XOR
+ };
+ // 2D polygon boolean operations
+ Array merge_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // union (add)
+ Array clip_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // difference (subtract)
+ Array intersect_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // common area (multiply)
+ Array exclude_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // all but common area (xor)
+
+ // 2D polyline vs polygon operations
+ Array clip_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon); // cut
+ Array intersect_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon); // chop
+
+ // 2D offset polygons/polylines
+ enum PolyJoinType {
+ JOIN_SQUARE,
+ JOIN_ROUND,
+ JOIN_MITER
+ };
+ enum PolyEndType {
+ END_POLYGON,
+ END_JOINED,
+ END_BUTT,
+ END_SQUARE,
+ END_ROUND
+ };
+ Array offset_polygon_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE);
+ Array offset_polyline_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE);
+
+ Vector<Point2> transform_points_2d(const Vector<Point2> &p_points, const Transform2D &p_mat);
+
Dictionary make_atlas(const Vector<Size2> &p_rects);
_Geometry();
};
+VARIANT_ENUM_CAST(_Geometry::PolyBooleanOperation);
+VARIANT_ENUM_CAST(_Geometry::PolyJoinType);
+VARIANT_ENUM_CAST(_Geometry::PolyEndType);
+
class _File : public Reference {
GDCLASS(_File, Reference);
diff --git a/core/color_names.inc b/core/color_names.inc
index e126bfe0f8..b0ef507d92 100644
--- a/core/color_names.inc
+++ b/core/color_names.inc
@@ -143,6 +143,7 @@ static void _populate_named_colors() {
_named_colors.insert("thistle", Color(0.85, 0.75, 0.85));
_named_colors.insert("tomato", Color(1.00, 0.39, 0.28));
_named_colors.insert("turquoise", Color(0.25, 0.88, 0.82));
+ _named_colors.insert("transparent", Color(1.00, 1.00, 1.00, 0.00));
_named_colors.insert("violet", Color(0.93, 0.51, 0.93));
_named_colors.insert("wheat", Color(0.96, 0.87, 0.70));
_named_colors.insert("white", Color(1.00, 1.00, 1.00));
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index 1b59508abf..eeaae96754 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -44,6 +44,7 @@ CoreStringNames::CoreStringNames() :
_iter_next(StaticCString::create("_iter_next")),
_iter_get(StaticCString::create("_iter_get")),
get_rid(StaticCString::create("get_rid")),
+ _to_string(StaticCString::create("_to_string")),
#ifdef TOOLS_ENABLED
_sections_unfolded(StaticCString::create("_sections_unfolded")),
#endif
diff --git a/core/core_string_names.h b/core/core_string_names.h
index 6fea40e1b2..85f8bb7f62 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -62,6 +62,7 @@ public:
StringName _iter_next;
StringName _iter_get;
StringName get_rid;
+ StringName _to_string;
#ifdef TOOLS_ENABLED
StringName _sections_unfolded;
#endif
diff --git a/core/error_macros.h b/core/error_macros.h
index 78e29551d4..f72e987e23 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -41,7 +41,7 @@
*/
/**
- * Pointer to the error macro priting function. Reassign to any function to have errors printed
+ * Pointer to the error macro printing function. Reassign to any function to have errors printed
*/
/** Function used by the error macros */
diff --git a/core/func_ref.cpp b/core/func_ref.cpp
index 4a965473d9..3d03137d09 100644
--- a/core/func_ref.cpp
+++ b/core/func_ref.cpp
@@ -51,11 +51,23 @@ void FuncRef::set_instance(Object *p_obj) {
ERR_FAIL_NULL(p_obj);
id = p_obj->get_instance_id();
}
+
void FuncRef::set_function(const StringName &p_func) {
function = p_func;
}
+bool FuncRef::is_valid() const {
+ if (id == 0)
+ return false;
+
+ Object *obj = ObjectDB::get_instance(id);
+ if (!obj)
+ return false;
+
+ return obj->has_method(function);
+}
+
void FuncRef::_bind_methods() {
{
@@ -67,6 +79,7 @@ void FuncRef::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_instance", "instance"), &FuncRef::set_instance);
ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
+ ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid);
}
FuncRef::FuncRef() :
diff --git a/core/func_ref.h b/core/func_ref.h
index 339279fdba..a143b58bf0 100644
--- a/core/func_ref.h
+++ b/core/func_ref.h
@@ -46,6 +46,7 @@ public:
Variant call_func(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
void set_instance(Object *p_obj);
void set_function(const StringName &p_func);
+ bool is_valid() const;
FuncRef();
};
diff --git a/core/image.cpp b/core/image.cpp
index 99d5eab864..30af724de9 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -725,6 +725,131 @@ static void _scale_nearest(const uint8_t *__restrict p_src, uint8_t *__restrict
}
}
+#define LANCZOS_TYPE 3
+
+static float _lanczos(float p_x) {
+ return Math::abs(p_x) >= LANCZOS_TYPE ? 0 : Math::sincn(p_x) * Math::sincn(p_x / LANCZOS_TYPE);
+}
+
+template <int CC, class T>
+static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) {
+
+ int32_t src_width = p_src_width;
+ int32_t src_height = p_src_height;
+ int32_t dst_height = p_dst_height;
+ int32_t dst_width = p_dst_width;
+
+ uint32_t buffer_size = src_height * dst_width * CC;
+ float *buffer = memnew_arr(float, buffer_size); // Store the first pass in a buffer
+
+ { // FIRST PASS (horizontal)
+
+ float x_scale = float(src_width) / float(dst_width);
+
+ float scale_factor = MAX(x_scale, 1); // A larger kernel is required only when downscaling
+ int32_t half_kernel = LANCZOS_TYPE * scale_factor;
+
+ float *kernel = memnew_arr(float, half_kernel * 2 - 1);
+
+ for (int32_t buffer_x = 0; buffer_x < dst_width; buffer_x++) {
+
+ float src_real_x = buffer_x * x_scale;
+ int32_t src_x = src_real_x;
+
+ int32_t start_x = MAX(0, src_x - half_kernel + 1);
+ int32_t end_x = MIN(src_width - 1, src_x + half_kernel);
+
+ // Create the kernel used by all the pixels of the column
+ for (int32_t target_x = start_x; target_x <= end_x; target_x++)
+ kernel[target_x - start_x] = _lanczos((src_real_x - target_x) / scale_factor);
+
+ for (int32_t buffer_y = 0; buffer_y < src_height; buffer_y++) {
+
+ float pixel[CC] = { 0 };
+ float weight = 0;
+
+ for (int32_t target_x = start_x; target_x <= end_x; target_x++) {
+
+ float lanczos_val = kernel[target_x - start_x];
+ weight += lanczos_val;
+
+ const T *__restrict src_data = ((const T *)p_src) + (buffer_y * src_width + target_x) * CC;
+
+ for (uint32_t i = 0; i < CC; i++) {
+ if (sizeof(T) == 2) //half float
+ pixel[i] += Math::half_to_float(src_data[i]) * lanczos_val;
+ else
+ pixel[i] += src_data[i] * lanczos_val;
+ }
+ }
+
+ float *dst_data = ((float *)buffer) + (buffer_y * dst_width + buffer_x) * CC;
+
+ for (uint32_t i = 0; i < CC; i++)
+ dst_data[i] = pixel[i] / weight; // Normalize the sum of all the samples
+ }
+ }
+
+ memdelete_arr(kernel);
+ } // End of first pass
+
+ { // SECOND PASS (vertical + result)
+
+ float y_scale = float(src_height) / float(dst_height);
+
+ float scale_factor = MAX(y_scale, 1);
+ int32_t half_kernel = LANCZOS_TYPE * scale_factor;
+
+ float *kernel = memnew_arr(float, half_kernel * 2 - 1);
+
+ for (int32_t dst_y = 0; dst_y < dst_height; dst_y++) {
+
+ float buffer_real_y = dst_y * y_scale;
+ int32_t buffer_y = buffer_real_y;
+
+ int32_t start_y = MAX(0, buffer_y - half_kernel + 1);
+ int32_t end_y = MIN(src_height - 1, buffer_y + half_kernel);
+
+ for (int32_t target_y = start_y; target_y <= end_y; target_y++)
+ kernel[target_y - start_y] = _lanczos((buffer_real_y - target_y) / scale_factor);
+
+ for (int32_t dst_x = 0; dst_x < dst_width; dst_x++) {
+
+ float pixel[CC] = { 0 };
+ float weight = 0;
+
+ for (int32_t target_y = start_y; target_y <= end_y; target_y++) {
+
+ float lanczos_val = kernel[target_y - start_y];
+ weight += lanczos_val;
+
+ float *buffer_data = ((float *)buffer) + (target_y * dst_width + dst_x) * CC;
+
+ for (uint32_t i = 0; i < CC; i++)
+ pixel[i] += buffer_data[i] * lanczos_val;
+ }
+
+ T *dst_data = ((T *)p_dst) + (dst_y * dst_width + dst_x) * CC;
+
+ for (uint32_t i = 0; i < CC; i++) {
+ pixel[i] /= weight;
+
+ if (sizeof(T) == 1) //byte
+ dst_data[i] = CLAMP(Math::fast_ftoi(pixel[i]), 0, 255);
+ else if (sizeof(T) == 2) //half float
+ dst_data[i] = Math::make_half_float(pixel[i]);
+ else // float
+ dst_data[i] = pixel[i];
+ }
+ }
+ }
+
+ memdelete_arr(kernel);
+ } // End of second pass
+
+ memdelete_arr(buffer);
+}
+
static void _overlay(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, float p_alpha, uint32_t p_width, uint32_t p_height, uint32_t p_pixel_size) {
uint16_t alpha = CLAMP((uint16_t)(p_alpha * 256.0f), 0, 256);
@@ -939,6 +1064,31 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
}
}
} break;
+ case INTERPOLATE_LANCZOS: {
+
+ if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
+ switch (get_format_pixel_size(format)) {
+ case 1: _scale_lanczos<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 2: _scale_lanczos<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 3: _scale_lanczos<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 4: _scale_lanczos<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ }
+ } else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
+ switch (get_format_pixel_size(format)) {
+ case 4: _scale_lanczos<1, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 8: _scale_lanczos<2, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 12: _scale_lanczos<3, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 16: _scale_lanczos<4, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ }
+ } else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
+ switch (get_format_pixel_size(format)) {
+ case 2: _scale_lanczos<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 4: _scale_lanczos<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 6: _scale_lanczos<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ case 8: _scale_lanczos<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
+ }
+ }
+ } break;
}
r = PoolVector<uint8_t>::Read();
@@ -2685,6 +2835,7 @@ void Image::_bind_methods() {
BIND_ENUM_CONSTANT(INTERPOLATE_BILINEAR);
BIND_ENUM_CONSTANT(INTERPOLATE_CUBIC);
BIND_ENUM_CONSTANT(INTERPOLATE_TRILINEAR);
+ BIND_ENUM_CONSTANT(INTERPOLATE_LANCZOS);
BIND_ENUM_CONSTANT(ALPHA_NONE);
BIND_ENUM_CONSTANT(ALPHA_BIT);
diff --git a/core/image.h b/core/image.h
index 69a42f169a..752ef20208 100644
--- a/core/image.h
+++ b/core/image.h
@@ -109,6 +109,7 @@ public:
INTERPOLATE_BILINEAR,
INTERPOLATE_CUBIC,
INTERPOLATE_TRILINEAR,
+ INTERPOLATE_LANCZOS,
/* INTERPOLATE_TRICUBIC, */
/* INTERPOLATE GAUSS */
};
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index e5c6d2a4f2..ce2054db36 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -429,7 +429,7 @@ Error HTTPClient::poll() {
response_num = RESPONSE_OK;
// Per the HTTP 1.1 spec, keep-alive is the default.
- // Not following that specification breaks standard implemetations.
+ // Not following that specification breaks standard implementations.
// Broken web servers should be fixed.
bool keep_alive = true;
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 81b3829ffc..d1b6b82cf0 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -1231,11 +1231,15 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
buf += 4;
PoolVector<uint8_t>::Read r = data.read();
copymem(buf, &r[0], datalen * datasize);
+ buf += datalen * datasize;
}
r_len += 4 + datalen * datasize;
- while (r_len % 4)
+ while (r_len % 4) {
r_len++;
+ if (buf)
+ *(buf++) = 0;
+ }
} break;
case Variant::POOL_INT_ARRAY: {
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 2e76ce68ed..2779837190 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -283,8 +283,9 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_
rpc_mode = p_node->get_script_instance()->get_rpc_mode(p_name);
}
- ERR_EXPLAIN("RPC '" + String(p_name) + "' is not allowed from: " + itos(p_from) + ". Mode is " + itos((int)rpc_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
- ERR_FAIL_COND(!_can_call_mode(p_node, rpc_mode, p_from));
+ bool can_call = _can_call_mode(p_node, rpc_mode, p_from);
+ ERR_EXPLAIN("RPC '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rpc_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
+ ERR_FAIL_COND(!can_call);
int argc = p_packet[p_offset];
Vector<Variant> args;
@@ -332,8 +333,9 @@ void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p
rset_mode = p_node->get_script_instance()->get_rset_mode(p_name);
}
- ERR_EXPLAIN("RSET '" + String(p_name) + "' is not allowed from: " + itos(p_from) + ". Mode is " + itos((int)rset_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
- ERR_FAIL_COND(!_can_call_mode(p_node, rset_mode, p_from));
+ bool can_call = _can_call_mode(p_node, rset_mode, p_from);
+ ERR_EXPLAIN("RSET '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rset_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
+ ERR_FAIL_COND(!can_call);
Variant value;
Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL, allow_object_decoding || network_peer->is_object_decoding_allowed());
@@ -632,7 +634,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
ERR_FAIL_COND(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED);
int node_id = network_peer->get_unique_id();
- bool skip_rpc = false;
+ bool skip_rpc = node_id == p_peer_id;
bool call_local_native = false;
bool call_local_script = false;
bool is_master = p_node->is_network_master();
@@ -686,6 +688,9 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
return;
}
}
+
+ ERR_EXPLAIN("RPC '" + p_method + "' on yourself is not allowed by selected mode");
+ ERR_FAIL_COND(skip_rpc && !(call_local_native || call_local_script));
}
void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) {
@@ -699,13 +704,11 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const
int node_id = network_peer->get_unique_id();
bool is_master = p_node->is_network_master();
- bool skip_rset = false;
+ bool skip_rset = node_id == p_peer_id;
+ bool set_local = false;
if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) {
// Check that send mode can use local call.
-
- bool set_local = false;
-
const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_property);
if (E) {
@@ -747,8 +750,11 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const
}
}
- if (skip_rset)
+ if (skip_rset) {
+ ERR_EXPLAIN("RSET for '" + p_property + "' on yourself is not allowed by selected mode");
+ ERR_FAIL_COND(!set_local);
return;
+ }
const Variant *vptr = &p_value;
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index 038a34ed51..4a58d37ca5 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -301,8 +301,7 @@ String ResourceFormatImporter::get_import_group_file(const String &p_path) const
bool valid = true;
PathAndType pat;
_get_path_and_type(p_path, pat, &valid);
- return valid?pat.group_file:String();
-
+ return valid ? pat.group_file : String();
}
bool ResourceFormatImporter::is_import_valid(const String &p_path) const {
diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h
index bdbdde6df6..2e01989564 100644
--- a/core/io/resource_importer.h
+++ b/core/io/resource_importer.h
@@ -126,7 +126,7 @@ public:
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0;
- virtual Error import_group_file(const String& p_group_file,const Map<String,Map<StringName, Variant> >&p_source_file_options, const Map<String,String>& p_base_paths) { return ERR_UNAVAILABLE; }
+ virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual bool are_import_settings_valid(const String &p_path) const { return true; }
virtual String get_import_settings_string() const { return String(); }
};
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index fb63878a4c..4eb1c8b46c 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -33,7 +33,7 @@
#include "core/os/file_access.h"
-// Not direclty used in this header, but assumed available in downstream users
+// Not directly used in this header, but assumed available in downstream users
// like platform/*/export/export.cpp. Could be fixed, but probably better to have
// thirdparty includes in as little headers as possible.
#include "thirdparty/minizip/unzip.h"
diff --git a/core/list.h b/core/list.h
index c21c20ba34..103a82a31d 100644
--- a/core/list.h
+++ b/core/list.h
@@ -503,8 +503,7 @@ public:
if (p_I->prev_ptr)
p_I->prev_ptr->next_ptr = p_I->next_ptr;
- if (p_I->next_ptr)
- p_I->next_ptr->prev_ptr = p_I->prev_ptr;
+ p_I->next_ptr->prev_ptr = p_I->prev_ptr;
_data->last->next_ptr = p_I;
p_I->prev_ptr = _data->last;
@@ -538,8 +537,7 @@ public:
if (_data->last == p_I)
_data->last = p_I->prev_ptr;
- if (p_I->prev_ptr)
- p_I->prev_ptr->next_ptr = p_I->next_ptr;
+ p_I->prev_ptr->next_ptr = p_I->next_ptr;
if (p_I->next_ptr)
p_I->next_ptr->prev_ptr = p_I->prev_ptr;
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index e1388ad2ac..3d71e66f80 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -54,7 +54,8 @@ void AStar::add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale) {
pt->pos = p_pos;
pt->weight_scale = p_weight_scale;
pt->prev_point = NULL;
- pt->last_pass = 0;
+ pt->open_pass = 0;
+ pt->closed_pass = 0;
pt->enabled = true;
points[p_id] = pt;
} else {
@@ -246,86 +247,62 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
if (!end_point->enabled)
return false;
- SelfList<Point>::List open_list;
-
bool found_route = false;
- for (Set<Point *>::Element *E = begin_point->neighbours.front(); E; E = E->next()) {
-
- Point *n = E->get();
+ Vector<Point *> open_list;
+ SortArray<Point *, SortPoints> sorter;
- if (!n->enabled)
- continue;
+ begin_point->g_score = 0;
+ begin_point->f_score = _estimate_cost(begin_point->id, end_point->id);
- n->prev_point = begin_point;
- n->distance = _compute_cost(begin_point->id, n->id) * n->weight_scale;
- n->last_pass = pass;
- open_list.add(&n->list);
- }
+ open_list.push_back(begin_point);
while (true) {
- if (open_list.first() == NULL) {
- // No path found
+ if (open_list.size() == 0) // No path found
break;
- }
- // Check open list
-
- SelfList<Point> *least_cost_point = open_list.first();
- real_t least_cost = Math_INF;
- // TODO: Cache previous results
- for (SelfList<Point> *E = open_list.first(); E; E = E->next()) {
-
- Point *p = E->self();
-
- real_t cost = p->distance;
- cost += _estimate_cost(p->id, end_point->id);
-
- if (cost < least_cost) {
- least_cost_point = E;
- least_cost = cost;
- }
- }
+ Point *p = open_list[0]; // The currently processed point
- Point *p = least_cost_point->self();
if (p == end_point) {
found_route = true;
break;
}
+ sorter.pop_heap(0, open_list.size(), open_list.ptrw()); // Remove the current point from the open list
+ open_list.remove(open_list.size() - 1);
+ p->closed_pass = pass; // Mark the point as closed
+
for (Set<Point *>::Element *E = p->neighbours.front(); E; E = E->next()) {
- Point *e = E->get();
+ Point *e = E->get(); // The neighbour point
- if (!e->enabled)
+ if (!e->enabled || e->closed_pass == pass)
continue;
- real_t distance = _compute_cost(p->id, e->id) * e->weight_scale + p->distance;
+ real_t tentative_g_score = p->g_score + _compute_cost(p->id, e->id) * e->weight_scale;
+
+ bool new_point = false;
- if (e->last_pass == pass) {
- // Already visited, is this cheaper?
+ if (e->open_pass != pass) { // The point wasn't inside the open list
- if (e->distance > distance) {
- e->prev_point = p;
- e->distance = distance;
- }
- } else {
- // Add to open neighbours
+ e->open_pass = pass;
+ open_list.push_back(e);
+ new_point = true;
+ } else if (tentative_g_score >= e->g_score) { // The new path is worse than the previous
- e->prev_point = p;
- e->distance = distance;
- e->last_pass = pass; // Mark as used
- open_list.add(&e->list);
+ continue;
}
- }
- open_list.remove(least_cost_point);
- }
+ e->prev_point = p;
+ e->g_score = tentative_g_score;
+ e->f_score = e->g_score + _estimate_cost(e->id, end_point->id);
- // Clear the openf list
- while (open_list.first()) {
- open_list.remove(open_list.first());
+ if (new_point) // The position of the new points is already known
+ sorter.push_heap(0, open_list.size() - 1, 0, e, open_list.ptrw());
+ else
+ sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptrw());
+ }
}
return found_route;
@@ -352,8 +329,6 @@ PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {
ERR_FAIL_COND_V(!points.has(p_from_id), PoolVector<Vector3>());
ERR_FAIL_COND_V(!points.has(p_to_id), PoolVector<Vector3>());
- pass++;
-
Point *a = points[p_from_id];
Point *b = points[p_to_id];
@@ -403,8 +378,6 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
ERR_FAIL_COND_V(!points.has(p_from_id), PoolVector<int>());
ERR_FAIL_COND_V(!points.has(p_to_id), PoolVector<int>());
- pass++;
-
Point *a = points[p_from_id];
Point *b = points[p_to_id];
diff --git a/core/math/a_star.h b/core/math/a_star.h
index c63e1aa4dc..fac8a9d312 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -48,26 +48,34 @@ class AStar : public Reference {
struct Point {
- SelfList<Point> list;
-
int id;
Vector3 pos;
real_t weight_scale;
- uint64_t last_pass;
bool enabled;
Set<Point *> neighbours;
// Used for pathfinding
Point *prev_point;
- real_t distance;
-
- Point() :
- list(this) {}
+ real_t g_score;
+ real_t f_score;
+ uint64_t open_pass;
+ uint64_t closed_pass;
};
Map<int, Point *> points;
+ struct SortPoints {
+ _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { // Returns true when the Point A is worse than Point B
+ if (A->f_score > B->f_score)
+ return true;
+ else if (A->f_score < B->f_score)
+ return false;
+ else
+ return A->g_score < B->g_score; // If the f_costs are the same then prioritize the points that are further away from the start
+ }
+ };
+
struct Segment {
union {
struct {
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 9fcecd1ba6..1540bc8fe1 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -813,21 +813,28 @@ void Basis::set_axis_angle(const Vector3 &p_axis, real_t p_phi) {
ERR_FAIL_COND(!p_axis.is_normalized());
#endif
Vector3 axis_sq(p_axis.x * p_axis.x, p_axis.y * p_axis.y, p_axis.z * p_axis.z);
-
real_t cosine = Math::cos(p_phi);
- real_t sine = Math::sin(p_phi);
-
elements[0][0] = axis_sq.x + cosine * (1.0 - axis_sq.x);
- elements[0][1] = p_axis.x * p_axis.y * (1.0 - cosine) - p_axis.z * sine;
- elements[0][2] = p_axis.z * p_axis.x * (1.0 - cosine) + p_axis.y * sine;
-
- elements[1][0] = p_axis.x * p_axis.y * (1.0 - cosine) + p_axis.z * sine;
elements[1][1] = axis_sq.y + cosine * (1.0 - axis_sq.y);
- elements[1][2] = p_axis.y * p_axis.z * (1.0 - cosine) - p_axis.x * sine;
-
- elements[2][0] = p_axis.z * p_axis.x * (1.0 - cosine) - p_axis.y * sine;
- elements[2][1] = p_axis.y * p_axis.z * (1.0 - cosine) + p_axis.x * sine;
elements[2][2] = axis_sq.z + cosine * (1.0 - axis_sq.z);
+
+ real_t sine = Math::sin(p_phi);
+ real_t t = 1 - cosine;
+
+ real_t xyzt = p_axis.x * p_axis.y * t;
+ real_t zyxs = p_axis.z * sine;
+ elements[0][1] = xyzt - zyxs;
+ elements[1][0] = xyzt + zyxs;
+
+ xyzt = p_axis.x * p_axis.z * t;
+ zyxs = p_axis.y * sine;
+ elements[0][2] = xyzt + zyxs;
+ elements[2][0] = xyzt - zyxs;
+
+ xyzt = p_axis.y * p_axis.z * t;
+ zyxs = p_axis.x * sine;
+ elements[1][2] = xyzt - zyxs;
+ elements[2][1] = xyzt + zyxs;
}
void Basis::set_axis_angle_scale(const Vector3 &p_axis, real_t p_phi, const Vector3 &p_scale) {
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 133dcc7ab9..079c9b524f 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -64,6 +64,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"is_inf",
"ease",
"decimals",
+ "step_decimals",
"stepify",
"lerp",
"inverse_lerp",
@@ -149,6 +150,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) {
case MATH_ISNAN:
case MATH_ISINF:
case MATH_DECIMALS:
+ case MATH_STEP_DECIMALS:
case MATH_SEED:
case MATH_RANDSEED:
case MATH_DEG2RAD:
@@ -365,6 +367,11 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
VALIDATE_ARG_NUM(0);
*r_return = Math::step_decimals((double)*p_inputs[0]);
} break;
+ case MATH_STEP_DECIMALS: {
+
+ VALIDATE_ARG_NUM(0);
+ *r_return = Math::step_decimals((double)*p_inputs[0]);
+ } break;
case MATH_STEPIFY: {
VALIDATE_ARG_NUM(0);
diff --git a/core/math/expression.h b/core/math/expression.h
index f9075cb689..f20619f0b6 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -62,6 +62,7 @@ public:
MATH_ISINF,
MATH_EASE,
MATH_DECIMALS,
+ MATH_STEP_DECIMALS,
MATH_STEPIFY,
MATH_LERP,
MATH_INVERSE_LERP,
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 0ab8707d3a..8314cb827c 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -31,8 +31,11 @@
#include "geometry.h"
#include "core/print_string.h"
+#include "thirdparty/misc/clipper.hpp"
#include "thirdparty/misc/triangulator.h"
+#define SCALE_FACTOR 100000.0 // based on CMP_EPSILON
+
/* this implementation is very inefficient, commenting unless bugs happen. See the other one.
bool Geometry::is_point_in_polygon(const Vector2 &p_point, const Vector<Vector2> &p_polygon) {
@@ -1134,3 +1137,106 @@ void Geometry::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_resu
r_size = Size2(results[best].max_w, results[best].max_h);
}
+
+Vector<Vector<Point2> > Geometry::_polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool is_a_open) {
+
+ using namespace ClipperLib;
+
+ ClipType op = ctUnion;
+
+ switch (p_op) {
+ case OPERATION_UNION: op = ctUnion; break;
+ case OPERATION_DIFFERENCE: op = ctDifference; break;
+ case OPERATION_INTERSECTION: op = ctIntersection; break;
+ case OPERATION_XOR: op = ctXor; break;
+ }
+ Path path_a, path_b;
+
+ // Need to scale points (Clipper's requirement for robust computation)
+ for (int i = 0; i != p_polypath_a.size(); ++i) {
+ path_a << IntPoint(p_polypath_a[i].x * SCALE_FACTOR, p_polypath_a[i].y * SCALE_FACTOR);
+ }
+ for (int i = 0; i != p_polypath_b.size(); ++i) {
+ path_b << IntPoint(p_polypath_b[i].x * SCALE_FACTOR, p_polypath_b[i].y * SCALE_FACTOR);
+ }
+ Clipper clp;
+ clp.AddPath(path_a, ptSubject, !is_a_open); // forward compatible with Clipper 10.0.0
+ clp.AddPath(path_b, ptClip, true); // polylines cannot be set as clip
+
+ Paths paths;
+
+ if (is_a_open) {
+ PolyTree tree; // needed to populate polylines
+ clp.Execute(op, tree);
+ OpenPathsFromPolyTree(tree, paths);
+ } else {
+ clp.Execute(op, paths); // works on closed polygons only
+ }
+ // Have to scale points down now
+ Vector<Vector<Point2> > polypaths;
+
+ for (Paths::size_type i = 0; i < paths.size(); ++i) {
+ Vector<Vector2> polypath;
+
+ const Path &scaled_path = paths[i];
+
+ for (Paths::size_type j = 0; j < scaled_path.size(); ++j) {
+ polypath.push_back(Point2(
+ static_cast<real_t>(scaled_path[j].X) / SCALE_FACTOR,
+ static_cast<real_t>(scaled_path[j].Y) / SCALE_FACTOR));
+ }
+ polypaths.push_back(polypath);
+ }
+ return polypaths;
+}
+
+Vector<Vector<Point2> > Geometry::_polypath_offset(const Vector<Point2> &p_polypath, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) {
+
+ using namespace ClipperLib;
+
+ JoinType jt = jtSquare;
+
+ switch (p_join_type) {
+ case JOIN_SQUARE: jt = jtSquare; break;
+ case JOIN_ROUND: jt = jtRound; break;
+ case JOIN_MITER: jt = jtMiter; break;
+ }
+
+ EndType et = etClosedPolygon;
+
+ switch (p_end_type) {
+ case END_POLYGON: et = etClosedPolygon; break;
+ case END_JOINED: et = etClosedLine; break;
+ case END_BUTT: et = etOpenButt; break;
+ case END_SQUARE: et = etOpenSquare; break;
+ case END_ROUND: et = etOpenRound; break;
+ }
+ ClipperOffset co;
+ Path path;
+
+ // Need to scale points (Clipper's requirement for robust computation)
+ for (int i = 0; i != p_polypath.size(); ++i) {
+ path << IntPoint(p_polypath[i].x * SCALE_FACTOR, p_polypath[i].y * SCALE_FACTOR);
+ }
+ co.AddPath(path, jt, et);
+
+ Paths paths;
+ co.Execute(paths, p_delta * SCALE_FACTOR); // inflate/deflate
+
+ // Have to scale points down now
+ Vector<Vector<Point2> > polypaths;
+
+ for (Paths::size_type i = 0; i < paths.size(); ++i) {
+ Vector<Vector2> polypath;
+
+ const Path &scaled_path = paths[i];
+
+ for (Paths::size_type j = 0; j < scaled_path.size(); ++j) {
+ polypath.push_back(Point2(
+ static_cast<real_t>(scaled_path[j].X) / SCALE_FACTOR,
+ static_cast<real_t>(scaled_path[j].Y) / SCALE_FACTOR));
+ }
+ polypaths.push_back(polypath);
+ }
+ return polypaths;
+}
diff --git a/core/math/geometry.h b/core/math/geometry.h
index f3a671aa9a..0e144e491f 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -31,6 +31,7 @@
#ifndef GEOMETRY_H
#define GEOMETRY_H
+#include "core/math/delaunay.h"
#include "core/math/face3.h"
#include "core/math/rect2.h"
#include "core/math/triangulate.h"
@@ -785,6 +786,91 @@ public:
return clipped;
}
+ enum PolyBooleanOperation {
+ OPERATION_UNION,
+ OPERATION_DIFFERENCE,
+ OPERATION_INTERSECTION,
+ OPERATION_XOR
+ };
+ enum PolyJoinType {
+ JOIN_SQUARE,
+ JOIN_ROUND,
+ JOIN_MITER
+ };
+ enum PolyEndType {
+ END_POLYGON,
+ END_JOINED,
+ END_BUTT,
+ END_SQUARE,
+ END_ROUND
+ };
+
+ static Vector<Vector<Point2> > merge_polygons_2d(const Vector<Point2> &p_polygon_a, const Vector<Point2> &p_polygon_b) {
+
+ return _polypaths_do_operation(OPERATION_UNION, p_polygon_a, p_polygon_b);
+ }
+
+ static Vector<Vector<Point2> > clip_polygons_2d(const Vector<Point2> &p_polygon_a, const Vector<Point2> &p_polygon_b) {
+
+ return _polypaths_do_operation(OPERATION_DIFFERENCE, p_polygon_a, p_polygon_b);
+ }
+
+ static Vector<Vector<Point2> > intersect_polygons_2d(const Vector<Point2> &p_polygon_a, const Vector<Point2> &p_polygon_b) {
+
+ return _polypaths_do_operation(OPERATION_INTERSECTION, p_polygon_a, p_polygon_b);
+ }
+
+ static Vector<Vector<Point2> > exclude_polygons_2d(const Vector<Point2> &p_polygon_a, const Vector<Point2> &p_polygon_b) {
+
+ return _polypaths_do_operation(OPERATION_XOR, p_polygon_a, p_polygon_b);
+ }
+
+ static Vector<Vector<Point2> > clip_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {
+
+ return _polypaths_do_operation(OPERATION_DIFFERENCE, p_polyline, p_polygon, true);
+ }
+
+ static Vector<Vector<Point2> > intersect_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {
+
+ return _polypaths_do_operation(OPERATION_INTERSECTION, p_polyline, p_polygon, true);
+ }
+
+ static Vector<Vector<Point2> > offset_polygon_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type) {
+
+ return _polypath_offset(p_polygon, p_delta, p_join_type, END_POLYGON);
+ }
+
+ static Vector<Vector<Point2> > offset_polyline_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) {
+
+ ERR_EXPLAIN("Attempt to offset a polyline like a polygon (use offset_polygon_2d instead).");
+ ERR_FAIL_COND_V(p_end_type == END_POLYGON, Vector<Vector<Point2> >());
+
+ return _polypath_offset(p_polygon, p_delta, p_join_type, p_end_type);
+ }
+
+ static Vector<Point2> transform_points_2d(const Vector<Point2> &p_points, const Transform2D &p_mat) {
+
+ Vector<Point2> points;
+
+ for (int i = 0; i < p_points.size(); ++i) {
+ points.push_back(p_mat.xform(p_points[i]));
+ }
+ return points;
+ }
+
+ static Vector<int> triangulate_delaunay_2d(const Vector<Vector2> &p_points) {
+
+ Vector<Delaunay2D::Triangle> tr = Delaunay2D::triangulate(p_points);
+ Vector<int> triangles;
+
+ for (int i = 0; i < tr.size(); i++) {
+ triangles.push_back(tr[i].points[0]);
+ triangles.push_back(tr[i].points[1]);
+ triangles.push_back(tr[i].points[2]);
+ }
+ return triangles;
+ }
+
static Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon) {
Vector<int> triangles;
@@ -833,7 +919,7 @@ public:
further_away_opposite.y = MIN(p[i].y, further_away_opposite.y);
}
- further_away += (further_away - further_away_opposite) * Vector2(1.221313, 1.512312); // make point outside that wont intersect with points in segment from p_point
+ further_away += (further_away - further_away_opposite) * Vector2(1.221313, 1.512312); // make point outside that won't intersect with points in segment from p_point
int intersections = 0;
for (int i = 0; i < c; i++) {
@@ -951,7 +1037,6 @@ public:
H.resize(k);
return H;
}
-
static Vector<Vector<Vector2> > decompose_polygon_in_convex(Vector<Point2> polygon);
static MeshData build_convex_mesh(const PoolVector<Plane> &p_planes);
@@ -961,6 +1046,10 @@ public:
static PoolVector<Plane> build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
static void make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size);
+
+private:
+ static Vector<Vector<Point2> > _polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool is_a_open = false);
+ static Vector<Vector<Point2> > _polypath_offset(const Vector<Point2> &p_polypath, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type);
};
#endif
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index a75f2fb4ab..82b5b56c01 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -61,6 +61,12 @@ public:
static _ALWAYS_INLINE_ double sinh(double p_x) { return ::sinh(p_x); }
static _ALWAYS_INLINE_ float sinh(float p_x) { return ::sinhf(p_x); }
+ static _ALWAYS_INLINE_ float sinc(float p_x) { return p_x == 0 ? 1 : ::sin(p_x) / p_x; }
+ static _ALWAYS_INLINE_ double sinc(double p_x) { return p_x == 0 ? 1 : ::sin(p_x) / p_x; }
+
+ static _ALWAYS_INLINE_ float sincn(float p_x) { return sinc(Math_PI * p_x); }
+ static _ALWAYS_INLINE_ double sincn(double p_x) { return sinc(Math_PI * p_x); }
+
static _ALWAYS_INLINE_ double cosh(double p_x) { return ::cosh(p_x); }
static _ALWAYS_INLINE_ float cosh(float p_x) { return ::coshf(p_x); }
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 901d372132..d636aa223f 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -67,7 +67,7 @@ struct Rect2 {
if (p_point.x < position.x) {
real_t d = position.x - p_point.x;
- dist = inside ? d : MIN(dist, d);
+ dist = d;
inside = false;
}
if (p_point.y < position.y) {
@@ -103,7 +103,7 @@ struct Rect2 {
((p_rect.position.y + p_rect.size.y) < (position.y + size.y));
}
- inline bool has_no_area() const {
+ _FORCE_INLINE_ bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
}
@@ -154,8 +154,6 @@ struct Rect2 {
return true;
}
- inline bool no_area() const { return (size.width <= 0 || size.height <= 0); }
-
bool operator==(const Rect2 &p_rect) const { return position == p_rect.position && size == p_rect.size; }
bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; }
@@ -189,7 +187,7 @@ struct Rect2 {
return g;
}
- inline Rect2 expand(const Vector2 &p_vector) const {
+ _FORCE_INLINE_ Rect2 expand(const Vector2 &p_vector) const {
Rect2 r = *this;
r.expand_to(p_vector);
@@ -215,7 +213,7 @@ struct Rect2 {
size = end - begin;
}
- inline Rect2 abs() const {
+ _FORCE_INLINE_ Rect2 abs() const {
return Rect2(Point2(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0)), size.abs());
}
@@ -265,7 +263,7 @@ struct Rect2i {
((p_rect.position.y + p_rect.size.y) < (position.y + size.y));
}
- inline bool has_no_area() const {
+ _FORCE_INLINE_ bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
}
@@ -316,8 +314,6 @@ struct Rect2i {
return true;
}
- bool no_area() { return (size.width <= 0 || size.height <= 0); }
-
bool operator==(const Rect2i &p_rect) const { return position == p_rect.position && size == p_rect.size; }
bool operator!=(const Rect2i &p_rect) const { return position != p_rect.position || size != p_rect.size; }
@@ -331,6 +327,33 @@ struct Rect2i {
return g;
}
+ inline Rect2i grow_margin(Margin p_margin, int p_amount) const {
+ Rect2i g = *this;
+ g = g.grow_individual((MARGIN_LEFT == p_margin) ? p_amount : 0,
+ (MARGIN_TOP == p_margin) ? p_amount : 0,
+ (MARGIN_RIGHT == p_margin) ? p_amount : 0,
+ (MARGIN_BOTTOM == p_margin) ? p_amount : 0);
+ return g;
+ }
+
+ inline Rect2i grow_individual(int p_left, int p_top, int p_right, int p_bottom) const {
+
+ Rect2i g = *this;
+ g.position.x -= p_left;
+ g.position.y -= p_top;
+ g.size.width += p_left + p_right;
+ g.size.height += p_top + p_bottom;
+
+ return g;
+ }
+
+ _FORCE_INLINE_ Rect2i expand(const Vector2i &p_vector) const {
+
+ Rect2i r = *this;
+ r.expand_to(p_vector);
+ return r;
+ }
+
inline void expand_to(const Point2i &p_vector) {
Point2i begin = position;
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index c57bd4081c..32d2b805f6 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -58,7 +58,7 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const V
Message *msg = memnew_placement(&buffer[buffer_end], Message);
msg->args = p_argcount;
- msg->instance_ID = p_id;
+ msg->instance_id = p_id;
msg->target = p_method;
msg->type = TYPE_CALL;
if (p_show_error)
@@ -109,7 +109,7 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari
Message *msg = memnew_placement(&buffer[buffer_end], Message);
msg->args = 1;
- msg->instance_ID = p_id;
+ msg->instance_id = p_id;
msg->target = p_prop;
msg->type = TYPE_SET;
@@ -143,7 +143,7 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
Message *msg = memnew_placement(&buffer[buffer_end], Message);
msg->type = TYPE_NOTIFICATION;
- msg->instance_ID = p_id;
+ msg->instance_id = p_id;
//msg->target;
msg->notification = p_notification;
@@ -177,7 +177,7 @@ void MessageQueue::statistics() {
while (read_pos < buffer_end) {
Message *message = (Message *)&buffer[read_pos];
- Object *target = ObjectDB::get_instance(message->instance_ID);
+ Object *target = ObjectDB::get_instance(message->instance_id);
if (target != NULL) {
@@ -289,7 +289,7 @@ void MessageQueue::flush() {
_THREAD_SAFE_UNLOCK_
- Object *target = ObjectDB::get_instance(message->instance_ID);
+ Object *target = ObjectDB::get_instance(message->instance_id);
if (target != NULL) {
@@ -302,10 +302,6 @@ void MessageQueue::flush() {
_call_function(target, message->target, args, message->args, message->type & FLAG_SHOW_ERROR);
- for (int i = 0; i < message->args; i++) {
- args[i].~Variant();
- }
-
} break;
case TYPE_NOTIFICATION: {
@@ -319,11 +315,17 @@ void MessageQueue::flush() {
// messages don't expect a return value
target->set(message->target, *arg);
- arg->~Variant();
} break;
}
}
+ if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
+ Variant *args = (Variant *)(message + 1);
+ for (int i = 0; i < message->args; i++) {
+ args[i].~Variant();
+ }
+ }
+
message->~Message();
_THREAD_SAFE_LOCK_
diff --git a/core/message_queue.h b/core/message_queue.h
index 2515eb4a98..026d17ad3f 100644
--- a/core/message_queue.h
+++ b/core/message_queue.h
@@ -54,7 +54,7 @@ class MessageQueue {
struct Message {
- ObjectID instance_ID;
+ ObjectID instance_id;
StringName target;
int16_t type;
union {
diff --git a/core/object.cpp b/core/object.cpp
index f860423a27..64f55f08a9 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -608,18 +608,16 @@ Variant Object::get_indexed(const Vector<StringName> &p_names, bool *r_valid) co
}
bool valid = false;
- Variant current_value = get(p_names[0]);
+ Variant current_value = get(p_names[0], &valid);
for (int i = 1; i < p_names.size(); i++) {
current_value = current_value.get_named(p_names[i], &valid);
- if (!valid) {
- if (r_valid)
- *r_valid = false;
- return Variant();
- }
+ if (!valid)
+ break;
}
if (r_valid)
- *r_valid = true;
+ *r_valid = valid;
+
return current_value;
}
@@ -956,6 +954,16 @@ void Object::notification(int p_notification, bool p_reversed) {
}
}
+String Object::to_string() {
+ if (script_instance) {
+ bool valid;
+ String ret = script_instance->to_string(&valid);
+ if (valid)
+ return ret;
+ }
+ return "[" + get_class() + ":" + itos(get_instance_id()) + "]";
+}
+
void Object::_changed_callback(Object *p_changed, const char *p_prop) {
}
@@ -1689,6 +1697,7 @@ void Object::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_property_list"), &Object::_get_property_list_bind);
ClassDB::bind_method(D_METHOD("get_method_list"), &Object::_get_method_list_bind);
ClassDB::bind_method(D_METHOD("notification", "what", "reversed"), &Object::notification, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("to_string"), &Object::to_string);
ClassDB::bind_method(D_METHOD("get_instance_id"), &Object::get_instance_id);
ClassDB::bind_method(D_METHOD("set_script", "script"), &Object::set_script);
@@ -1776,6 +1785,7 @@ void Object::_bind_methods() {
#endif
BIND_VMETHOD(MethodInfo("_init"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_to_string"));
BIND_CONSTANT(NOTIFICATION_POSTINITIALIZE);
BIND_CONSTANT(NOTIFICATION_PREDELETE);
@@ -1947,8 +1957,8 @@ Object::Object() {
_class_ptr = NULL;
_block_signals = false;
_predelete_ok = 0;
- _instance_ID = 0;
- _instance_ID = ObjectDB::add_instance(this);
+ _instance_id = 0;
+ _instance_id = ObjectDB::add_instance(this);
_can_translate = true;
_is_queued_for_deletion = false;
instance_binding_count = 0;
@@ -2002,7 +2012,7 @@ Object::~Object() {
}
ObjectDB::remove_instance(this);
- _instance_ID = 0;
+ _instance_id = 0;
_predelete_ok = 2;
if (!ScriptServer::are_languages_finished()) {
@@ -2050,10 +2060,10 @@ void ObjectDB::remove_instance(Object *p_object) {
rw_lock->write_unlock();
}
-Object *ObjectDB::get_instance(ObjectID p_instance_ID) {
+Object *ObjectDB::get_instance(ObjectID p_instance_id) {
rw_lock->read_lock();
- Object **obj = instances.getptr(p_instance_ID);
+ Object **obj = instances.getptr(p_instance_id);
rw_lock->read_unlock();
if (!obj)
diff --git a/core/object.h b/core/object.h
index 94abaacdcc..4394c1c3da 100644
--- a/core/object.h
+++ b/core/object.h
@@ -465,7 +465,7 @@ private:
bool _block_signals;
int _predelete_ok;
Set<Object *> change_receptors;
- ObjectID _instance_ID;
+ ObjectID _instance_id;
bool _predelete();
void _postinitialize();
bool _can_translate;
@@ -577,7 +577,7 @@ public:
bool _is_gpl_reversed() const { return false; }
- _FORCE_INLINE_ ObjectID get_instance_id() const { return _instance_ID; }
+ _FORCE_INLINE_ ObjectID get_instance_id() const { return _instance_id; }
// this is used for editors
void add_change_receptor(Object *p_receptor);
@@ -659,6 +659,7 @@ public:
void call_multilevel(const StringName &p_name, VARIANT_ARG_LIST); // C++ helper
void notification(int p_notification, bool p_reversed = false);
+ String to_string();
//used mainly by script, get and set all INCLUDING string
virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
@@ -776,7 +777,7 @@ class ObjectDB {
public:
typedef void (*DebugFunc)(Object *p_obj);
- static Object *get_instance(ObjectID p_instance_ID);
+ static Object *get_instance(ObjectID p_instance_id);
static void debug_objects(DebugFunc p_func);
static int get_object_count();
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 63bf1db499..f04d4a1b3e 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -34,6 +34,10 @@
#include "core/os/os.h"
#include "core/project_settings.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_settings.h"
+#endif
+
Input *Input::singleton = NULL;
Input *Input::get_singleton() {
@@ -123,6 +127,8 @@ void Input::_bind_methods() {
void Input::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
#ifdef TOOLS_ENABLED
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
+
String pf = p_function;
if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released" || pf == "get_action_strength")) {
@@ -136,7 +142,7 @@ void Input::get_argument_options(const StringName &p_function, int p_idx, List<S
continue;
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
- r_options->push_back("\"" + name + "\"");
+ r_options->push_back(quote_style + name + quote_style);
}
}
#endif
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 25a5c2afeb..a072017353 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -717,8 +717,17 @@ bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event, bool *
bool pressed = same_direction ? Math::abs(jm->get_axis_value()) >= p_deadzone : false;
if (p_pressed != NULL)
*p_pressed = pressed;
- if (p_strength != NULL)
- *p_strength = pressed ? CLAMP(Math::inverse_lerp(p_deadzone, 1.0f, Math::abs(jm->get_axis_value())), 0.0f, 1.0f) : 0.0f;
+ if (p_strength != NULL) {
+ if (pressed) {
+ if (p_deadzone == 1.0f) {
+ *p_strength = 1.0f;
+ } else {
+ *p_strength = CLAMP(Math::inverse_lerp(p_deadzone, 1.0f, Math::abs(jm->get_axis_value())), 0.0f, 1.0f);
+ }
+ } else {
+ *p_strength = 0.0f;
+ }
+ }
}
return match;
}
diff --git a/core/os/os.cpp b/core/os/os.cpp
index ea378c9e83..1a3c9ac5f8 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -465,6 +465,9 @@ void OS::_ensure_user_data_dir() {
memdelete(da);
}
+void OS::set_native_icon(const String &p_filename) {
+}
+
void OS::set_icon(const Ref<Image> &p_icon) {
}
diff --git a/core/os/os.h b/core/os/os.h
index 4ae8a354e5..4f6a539e78 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -273,7 +273,7 @@ public:
virtual String get_environment(const String &p_var) const = 0;
virtual bool set_environment(const String &p_var, const String &p_value) const = 0;
- virtual String get_name() = 0;
+ virtual String get_name() const = 0;
virtual List<String> get_cmdline_args() const { return _cmdline; }
virtual String get_model_name() const;
@@ -451,6 +451,7 @@ public:
virtual void make_rendering_thread();
virtual void swap_buffers();
+ virtual void set_native_icon(const String &p_filename);
virtual void set_icon(const Ref<Image> &p_icon);
virtual int get_exit_code() const;
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 4a6f904f9d..97758ced66 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -30,6 +30,7 @@
#include "script_language.h"
+#include "core/core_string_names.h"
#include "core/project_settings.h"
ScriptLanguage *ScriptServer::_languages[MAX_LANGUAGES];
diff --git a/core/script_language.h b/core/script_language.h
index 005e21e2cc..b2dab666c4 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -173,6 +173,11 @@ public:
virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
virtual void notification(int p_notification) = 0;
+ virtual String to_string(bool *r_valid) {
+ if (r_valid)
+ *r_valid = false;
+ return String();
+ }
//this is used by script languages that keep a reference counter of their own
//you can make make Ref<> not die when it reaches zero, so deleting the reference
diff --git a/core/translation.cpp b/core/translation.cpp
index afbc639eaa..0b55badc61 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -179,6 +179,7 @@ static const char *locale_list[] = {
"ff_SN", // Fulah (Senegal)
"fi", // Finnish
"fi_FI", // Finnish (Finland)
+ "fil", // Filipino
"fil_PH", // Filipino (Philippines)
"fo_FO", // Faroese (Faroe Islands)
"fr", // French
@@ -227,6 +228,7 @@ static const char *locale_list[] = {
"ja", // Japanese
"ja_JP", // Japanese (Japan)
"kab_DZ", // Kabyle (Algeria)
+ "ka", // Georgian
"ka_GE", // Georgian (Georgia)
"kk_KZ", // Kazakh (Kazakhstan)
"kl_GL", // Kalaallisut (Greenland)
@@ -257,10 +259,12 @@ static const char *locale_list[] = {
"mg_MG", // Malagasy (Madagascar)
"mh_MH", // Marshallese (Marshall Islands)
"mhr_RU", // Eastern Mari (Russia)
- "mi_NZ", // Maori (New Zealand)
+ "mi", // MÄori
+ "mi_NZ", // MÄori (New Zealand)
"miq_NI", // Mískito (Nicaragua)
"mk", // Macedonian
"mk_MK", // Macedonian (Macedonia)
+ "ml", // Malayalam
"ml_IN", // Malayalam (India)
"mni_IN", // Manipuri (India)
"mn_MN", // Mongolian (Mongolia)
@@ -326,6 +330,7 @@ static const char *locale_list[] = {
"sgs_LT", // Samogitian (Lithuania)
"shs_CA", // Shuswap (Canada)
"sid_ET", // Sidamo (Ethiopia)
+ "si", // Sinhala
"si_LK", // Sinhala (Sri Lanka)
"sk", // Slovak
"sk_SK", // Slovak (Slovakia)
@@ -343,6 +348,7 @@ static const char *locale_list[] = {
"sq_MK", // Albanian (Macedonia)
"sr", // Serbian
"sr_Cyrl", // Serbian (Cyrillic)
+ "sr_Latn", // Serbian (Latin)
"sr_ME", // Serbian (Montenegro)
"sr_RS", // Serbian (Serbia)
"ss_ZA", // Swati (South Africa)
@@ -357,6 +363,7 @@ static const char *locale_list[] = {
"ta_IN", // Tamil (India)
"ta_LK", // Tamil (Sri Lanka)
"tcy_IN", // Tulu (India)
+ "te", // Telugu
"te_IN", // Telugu (India)
"tg_TJ", // Tajik (Tajikistan)
"the_NP", // Chitwania Tharu (Nepal)
@@ -540,6 +547,7 @@ static const char *locale_names[] = {
"Fulah (Senegal)",
"Finnish",
"Finnish (Finland)",
+ "Filipino",
"Filipino (Philippines)",
"Faroese (Faroe Islands)",
"French",
@@ -588,6 +596,7 @@ static const char *locale_names[] = {
"Japanese",
"Japanese (Japan)",
"Kabyle (Algeria)",
+ "Georgian",
"Georgian (Georgia)",
"Kazakh (Kazakhstan)",
"Kalaallisut (Greenland)",
@@ -618,10 +627,12 @@ static const char *locale_names[] = {
"Malagasy (Madagascar)",
"Marshallese (Marshall Islands)",
"Eastern Mari (Russia)",
- "Maori (New Zealand)",
+ "MÄori",
+ "MÄori (New Zealand)",
"Mískito (Nicaragua)",
"Macedonian",
"Macedonian (Macedonia)",
+ "Malayalam",
"Malayalam (India)",
"Manipuri (India)",
"Mongolian (Mongolia)",
@@ -687,6 +698,7 @@ static const char *locale_names[] = {
"Samogitian (Lithuania)",
"Shuswap (Canada)",
"Sidamo (Ethiopia)",
+ "Sinhala",
"Sinhala (Sri Lanka)",
"Slovak",
"Slovak (Slovakia)",
@@ -704,6 +716,7 @@ static const char *locale_names[] = {
"Albanian (Macedonia)",
"Serbian",
"Serbian (Cyrillic)",
+ "Serbian (Latin)",
"Serbian (Montenegro)",
"Serbian (Serbia)",
"Swati (South Africa)",
@@ -718,6 +731,7 @@ static const char *locale_names[] = {
"Tamil (India)",
"Tamil (Sri Lanka)",
"Tulu (India)",
+ "Telugu",
"Telugu (India)",
"Tajik (Tajikistan)",
"Chitwania Tharu (Nepal)",
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 69581e4115..f7ca6d3bde 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -239,8 +239,8 @@ void UndoRedo::_pop_history_tail() {
}
}
-bool UndoRedo::is_commiting_action() const {
- return commiting > 0;
+bool UndoRedo::is_committing_action() const {
+ return committing > 0;
}
void UndoRedo::commit_action() {
@@ -255,9 +255,9 @@ void UndoRedo::commit_action() {
merging = false;
}
- commiting++;
+ committing++;
redo(); // perform action
- commiting--;
+ committing--;
if (callback && actions.size() > 0) {
callback(callback_ud, actions[actions.size() - 1].name);
}
@@ -396,7 +396,7 @@ void UndoRedo::set_property_notify_callback(PropertyNotifyCallback p_property_ca
UndoRedo::UndoRedo() {
- commiting = 0;
+ committing = 0;
version = 1;
action_level = 0;
current_action = -1;
@@ -496,10 +496,8 @@ void UndoRedo::_bind_methods() {
ClassDB::bind_method(D_METHOD("create_action", "name", "merge_mode"), &UndoRedo::create_action, DEFVAL(MERGE_DISABLE));
ClassDB::bind_method(D_METHOD("commit_action"), &UndoRedo::commit_action);
- ClassDB::bind_method(D_METHOD("is_commiting_action"), &UndoRedo::is_commiting_action);
-
- //ClassDB::bind_method(D_METHOD("add_do_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_do_method);
- //ClassDB::bind_method(D_METHOD("add_undo_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_undo_method);
+ // FIXME: Typo in "commiting", fix in 4.0 when breaking compat.
+ ClassDB::bind_method(D_METHOD("is_commiting_action"), &UndoRedo::is_committing_action);
{
MethodInfo mi;
diff --git a/core/undo_redo.h b/core/undo_redo.h
index 6293e77acc..e2cc6c659b 100644
--- a/core/undo_redo.h
+++ b/core/undo_redo.h
@@ -95,7 +95,7 @@ private:
MethodNotifyCallback method_callback;
PropertyNotifyCallback property_callback;
- int commiting;
+ int committing;
protected:
static void _bind_methods();
@@ -110,7 +110,7 @@ public:
void add_do_reference(Object *p_object);
void add_undo_reference(Object *p_object);
- bool is_commiting_action() const;
+ bool is_committing_action() const;
void commit_action();
bool redo();
diff --git a/core/variant.cpp b/core/variant.cpp
index 1bc3cff505..6eadf59fce 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -1601,7 +1601,7 @@ String Variant::stringify(List<const void *> &stack) const {
};
};
#endif
- return "[" + _get_obj().obj->get_class() + ":" + itos(_get_obj().obj->get_instance_id()) + "]";
+ return _get_obj().obj->to_string();
} else
return "[Object:null]";
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 22834a4c81..63b9ef13fd 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -259,16 +259,12 @@
</description>
</method>
<method name="decimals">
- <return type="float">
+ <return type="int">
</return>
<argument index="0" name="step" type="float">
</argument>
<description>
- Returns the position of the first non-zero digit, after the decimal point.
- [codeblock]
- # n is 2
- n = decimals(0.035)
- [/codeblock]
+ Deprecated alias for "[method step_decimals]".
</description>
</method>
<method name="dectime">
@@ -1023,6 +1019,23 @@
[/codeblock]
</description>
</method>
+ <method name="step_decimals">
+ <return type="int">
+ </return>
+ <argument index="0" name="step" type="float">
+ </argument>
+ <description>
+ Returns the position of the first non-zero digit, after the decimal point.
+ [codeblock]
+ # n is 0
+ n = step_decimals(5)
+ # n is 4
+ n = step_decimals(1.0005)
+ # n is 9
+ n = step_decimals(0.000000005)
+ [/codeblock]
+ </description>
+ </method>
<method name="stepify">
<return type="float">
</return>
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 4adf515abc..db35b2f352 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -36,14 +36,14 @@
<return type="Label">
</return>
<description>
- Return the label used for built-in text.
+ Returns the label used for built-in text.
</description>
</method>
<method name="get_ok">
<return type="Button">
</return>
<description>
- Return the OK Button.
+ Returns the OK Button.
</description>
</method>
<method name="register_text_enter">
diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml
index 2d4dd0e4b2..da85f91367 100644
--- a/doc/classes/AnimatedSprite.xml
+++ b/doc/classes/AnimatedSprite.xml
@@ -13,7 +13,7 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if an animation if currently being played.
+ Returns [code]true[/code] if an animation if currently being played.
</description>
</method>
<method name="play">
@@ -61,6 +61,7 @@
If [code]true[/code], the [member animation] is currently playing.
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
+ The animation speed is multiplied by this value.
</member>
</members>
<signals>
diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml
index 4c6868d807..96196f7601 100644
--- a/doc/classes/AnimatedSprite3D.xml
+++ b/doc/classes/AnimatedSprite3D.xml
@@ -13,7 +13,7 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if an animation if currently being played.
+ Returns [code]true[/code] if an animation if currently being played.
</description>
</method>
<method name="play">
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index af3abed256..9885f30883 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -263,14 +263,14 @@
<argument index="0" name="path" type="NodePath">
</argument>
<description>
- Return the index of the specified track. If the track is not found, return -1.
+ Returns the index of the specified track. If the track is not found, return -1.
</description>
</method>
<method name="get_track_count" qualifiers="const">
<return type="int">
</return>
<description>
- Return the amount of tracks in the animation.
+ Returns the amount of tracks in the animation.
</description>
</method>
<method name="method_track_get_key_indices" qualifiers="const">
@@ -283,7 +283,7 @@
<argument index="2" name="delta" type="float">
</argument>
<description>
- Return all the key indices of a method track, given a position and delta time.
+ Returns all the key indices of a method track, given a position and delta time.
</description>
</method>
<method name="method_track_get_name" qualifiers="const">
@@ -294,7 +294,7 @@
<argument index="1" name="key_idx" type="int">
</argument>
<description>
- Return the method name of a method track.
+ Returns the method name of a method track.
</description>
</method>
<method name="method_track_get_params" qualifiers="const">
@@ -305,7 +305,7 @@
<argument index="1" name="key_idx" type="int">
</argument>
<description>
- Return the arguments values to be called on a method track for a given key in a given track.
+ Returns the arguments values to be called on a method track for a given key in a given track.
</description>
</method>
<method name="remove_track">
@@ -345,7 +345,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the interpolation type of a given track, from the INTERPOLATION_* enum.
+ Returns the interpolation type of a given track, from the INTERPOLATION_* enum.
</description>
</method>
<method name="track_get_key_count" qualifiers="const">
@@ -354,7 +354,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the amount of keys in a given track.
+ Returns the amount of keys in a given track.
</description>
</method>
<method name="track_get_key_time" qualifiers="const">
@@ -365,7 +365,7 @@
<argument index="1" name="key_idx" type="int">
</argument>
<description>
- Return the time at which the key is located.
+ Returns the time at which the key is located.
</description>
</method>
<method name="track_get_key_transition" qualifiers="const">
@@ -376,7 +376,7 @@
<argument index="1" name="key_idx" type="int">
</argument>
<description>
- Return the transition curve (easing) for a specific key (see built-in math function "ease").
+ Returns the transition curve (easing) for a specific key (see built-in math function "ease").
</description>
</method>
<method name="track_get_key_value" qualifiers="const">
@@ -387,7 +387,7 @@
<argument index="1" name="key_idx" type="int">
</argument>
<description>
- Return the value of a given key in a given track.
+ Returns the value of a given key in a given track.
</description>
</method>
<method name="track_get_path" qualifiers="const">
@@ -438,7 +438,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return [code]true[/code] if the given track is imported. Else, return [code]false[/code].
+ Returns [code]true[/code] if the given track is imported. Else, return [code]false[/code].
</description>
</method>
<method name="track_move_down">
@@ -450,6 +450,17 @@
Move a track down.
</description>
</method>
+ <method name="track_move_to">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="to_idx" type="int">
+ </argument>
+ <description>
+ Changes the index position of track [code]idx[/code] to the one defined in [code]to_idx[/code].
+ </description>
+ </method>
<method name="track_move_up">
<return type="void">
</return>
@@ -571,6 +582,7 @@
<argument index="1" name="with_idx" type="int">
</argument>
<description>
+ Swaps the track [code]idx[/code]'s index position with the track [code]with_idx[/code].
</description>
</method>
<method name="transform_track_insert_key">
@@ -598,7 +610,7 @@
<argument index="1" name="time_sec" type="float">
</argument>
<description>
- Return the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ([Vector3]), rotation ([Quat]) and scale ([Vector3]).
+ Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ([Vector3]), rotation ([Quat]) and scale ([Vector3]).
</description>
</method>
<method name="value_track_get_key_indices" qualifiers="const">
@@ -611,7 +623,7 @@
<argument index="2" name="delta" type="float">
</argument>
<description>
- Return all the key indices of a value track, given a position and delta time.
+ Returns all the key indices of a value track, given a position and delta time.
</description>
</method>
<method name="value_track_get_update_mode" qualifiers="const">
@@ -620,7 +632,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the update mode of a value track.
+ Returns the update mode of a value track.
</description>
</method>
<method name="value_track_set_update_mode">
diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml
index e61fe374fa..9854d4c27e 100644
--- a/doc/classes/AnimationNode.xml
+++ b/doc/classes/AnimationNode.xml
@@ -144,7 +144,7 @@
<return type="String">
</return>
<description>
- Return [code]true[/code] whether you want the blend tree editor to display filter editing on this node.
+ Returns [code]true[/code] whether you want the blend tree editor to display filter editing on this node.
</description>
</method>
<method name="is_path_filtered" qualifiers="const">
@@ -153,7 +153,7 @@
<argument index="0" name="path" type="NodePath">
</argument>
<description>
- Return [code]true[/code] wether a given path is filtered.
+ Returns [code]true[/code] whether a given path is filtered.
</description>
</method>
<method name="process" qualifiers="virtual">
@@ -204,7 +204,7 @@
</methods>
<members>
<member name="filter_enabled" type="bool" setter="set_filter_enabled" getter="is_filter_enabled">
- Return whether filtering is enabled.
+ Returns whether filtering is enabled.
</member>
</members>
<signals>
diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml
index b80069095b..2834f83d2f 100644
--- a/doc/classes/AnimationNodeStateMachine.xml
+++ b/doc/classes/AnimationNodeStateMachine.xml
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AnimationNodeStateMachine" inherits="AnimationRootNode" category="Core" version="3.2">
<brief_description>
+ State machine for control of animations.
</brief_description>
<description>
- Contains multiple root nodes as children in a graph. Each node is used as a state, and provides multiple functions to alternate between states. Retrieve the AnimationNodeStateMachinePlayback object from the [AnimationTree] node to control it programatically.
- [codeblock]
- var state_machine = anim_tree["parameters/StateMachine/playback"]
- state_machine.travel("SomeState")
+ Contains multiple nodes representing animation states, connected in a graph. Nodes transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the AnimationNodeStateMachinePlayback object from the [AnimationTree] node to control it programatically. Example:
[codeblock]
+ var state_machine = $AnimationTree.get("parameters/playback")
+ state_machine.travel("some_state")
+ [/codeblock]
</description>
<tutorials>
</tutorials>
@@ -22,6 +23,7 @@
<argument index="2" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
+ Adds a new node to the graph. The [code]position[/code] is used for display in the editor.
</description>
</method>
<method name="add_transition">
@@ -34,18 +36,21 @@
<argument index="2" name="transition" type="AnimationNodeStateMachineTransition">
</argument>
<description>
+ Adds a transition between the given nodes.
</description>
</method>
<method name="get_end_node" qualifiers="const">
<return type="String">
</return>
<description>
+ Returns the graph's end node.
</description>
</method>
<method name="get_graph_offset" qualifiers="const">
<return type="Vector2">
</return>
<description>
+ Returns the draw offset of the graph. Used for display in the editor.
</description>
</method>
<method name="get_node" qualifiers="const">
@@ -54,6 +59,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the animation node with the given name.
</description>
</method>
<method name="get_node_name" qualifiers="const">
@@ -62,6 +68,7 @@
<argument index="0" name="node" type="AnimationNode">
</argument>
<description>
+ Returns the given animation node's name.
</description>
</method>
<method name="get_node_position" qualifiers="const">
@@ -70,12 +77,14 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the given node's coordinates. Used for display in the editor.
</description>
</method>
<method name="get_start_node" qualifiers="const">
<return type="String">
</return>
<description>
+ Returns the graph's end node.
</description>
</method>
<method name="get_transition" qualifiers="const">
@@ -84,12 +93,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the given transition.
</description>
</method>
<method name="get_transition_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the number of connections in the graph.
</description>
</method>
<method name="get_transition_from" qualifiers="const">
@@ -98,6 +109,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the given transition's start node.
</description>
</method>
<method name="get_transition_to" qualifiers="const">
@@ -106,6 +118,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the given transition's end node.
</description>
</method>
<method name="has_node" qualifiers="const">
@@ -114,6 +127,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns [code]true[/code] if the graph contains the given node.
</description>
</method>
<method name="has_transition" qualifiers="const">
@@ -124,6 +138,7 @@
<argument index="1" name="to" type="String">
</argument>
<description>
+ Returns [code]true[/code] if there is a transition between the given nodes.
</description>
</method>
<method name="remove_node">
@@ -132,6 +147,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Deletes the given node from the graph.
</description>
</method>
<method name="remove_transition">
@@ -142,6 +158,7 @@
<argument index="1" name="to" type="String">
</argument>
<description>
+ Deletes the given transition.
</description>
</method>
<method name="remove_transition_by_index">
@@ -150,6 +167,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Deletes the given transition.
</description>
</method>
<method name="rename_node">
@@ -160,6 +178,7 @@
<argument index="1" name="new_name" type="String">
</argument>
<description>
+ Renames the given node.
</description>
</method>
<method name="set_end_node">
@@ -168,6 +187,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Sets the given node as the graph end point.
</description>
</method>
<method name="set_graph_offset">
@@ -176,6 +196,7 @@
<argument index="0" name="offset" type="Vector2">
</argument>
<description>
+ Sets the draw offset of the graph. Used for display in the editor.
</description>
</method>
<method name="set_node_position">
@@ -186,6 +207,7 @@
<argument index="1" name="position" type="Vector2">
</argument>
<description>
+ Sets the node's coordinates. Used for display in the editor.
</description>
</method>
<method name="set_start_node">
@@ -194,6 +216,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Sets the given node as the graph start point.
</description>
</method>
</methods>
diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml
index fd38c28b16..796d92d7d6 100644
--- a/doc/classes/AnimationNodeStateMachinePlayback.xml
+++ b/doc/classes/AnimationNodeStateMachinePlayback.xml
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AnimationNodeStateMachinePlayback" inherits="Resource" category="Core" version="3.2">
<brief_description>
+ Playback control for AnimationNodeStateMachine.
</brief_description>
<description>
+ Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. Retrieve with [code]$AnimationTree.get("parameters/playback")[/code]. Example:
+ [codeblock]
+ var state_machine = $AnimationTree.get("parameters/playback")
+ state_machine.travel("some_state")
+ [/codeblock]
</description>
<tutorials>
</tutorials>
@@ -11,6 +17,7 @@
<return type="String">
</return>
<description>
+ Returns the currently playing animation state.
</description>
</method>
<method name="get_travel_path" qualifiers="const">
@@ -23,6 +30,7 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if an animation is playing.
</description>
</method>
<method name="start">
@@ -31,12 +39,14 @@
<argument index="0" name="node" type="String">
</argument>
<description>
+ Starts playing the given animation.
</description>
</method>
<method name="stop">
<return type="void">
</return>
<description>
+ Stops the currently playing animation.
</description>
</method>
<method name="travel">
@@ -45,7 +55,7 @@
<argument index="0" name="to_node" type="String">
</argument>
<description>
- Transition from the current state to another one, while visiting all the intermediate ones. This is done via the A* algorithm.
+ Transitions from the current state to another one, following the shortest path.
</description>
</method>
</methods>
diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml
index a21ee50949..aeb44a789b 100644
--- a/doc/classes/AnimationNodeStateMachineTransition.xml
+++ b/doc/classes/AnimationNodeStateMachineTransition.xml
@@ -10,7 +10,10 @@
</methods>
<members>
<member name="advance_condition" type="String" setter="set_advance_condition" getter="get_advance_condition">
- Turn on auto advance when this condition is set. This is a custom text field that can be filled with a variable name. The variable can be modified from code.
+ Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the [AnimationTree] that can be controlled from code (see [url=https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code][/url]). For example, if [member AnimationTree.tree_root] is an [AnimationNodeStateMachine] and [member advance_condition] is set to "idle":
+ [codeblock]
+ $animation_tree["parameters/conditions/idle"] = is_on_floor and linear_velocity.x == 0
+ [/codeblock]
</member>
<member name="auto_advance" type="bool" setter="set_auto_advance" getter="has_auto_advance">
Turn on the transition automatically when this state is reached. This works best with [code]SWITCH_MODE_AT_END[/code].
diff --git a/doc/classes/AnimationTreePlayer.xml b/doc/classes/AnimationTreePlayer.xml
index 6160b44076..818565e0dc 100644
--- a/doc/classes/AnimationTreePlayer.xml
+++ b/doc/classes/AnimationTreePlayer.xml
@@ -256,7 +256,7 @@
<argument index="0" name="id" type="String">
</argument>
<description>
- Return the input count for a given node. Different types of nodes have different amount of inputs.
+ Returns the input count for a given node. Different types of nodes have different amount of inputs.
</description>
</method>
<method name="node_get_input_source" qualifiers="const">
@@ -267,7 +267,7 @@
<argument index="1" name="idx" type="int">
</argument>
<description>
- Return the input source for a given node input.
+ Returns the input source for a given node input.
</description>
</method>
<method name="node_get_position" qualifiers="const">
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index 2400efe0d3..8d28ddc889 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -15,7 +15,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Return an individual bit on the layer mask. Describes whether other areas will collide with this one on the given layer.
+ Returns an individual bit on the layer mask. Describes whether other areas will collide with this one on the given layer.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -24,7 +24,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Return an individual bit on the collision mask. Describes whether this area will collide with others on the given layer.
+ Returns an individual bit on the collision mask. Describes whether this area will collide with others on the given layer.
</description>
</method>
<method name="get_overlapping_areas" qualifiers="const">
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index ecafc3514c..75194fbf76 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -291,7 +291,7 @@
</method>
<method name="shuffle">
<description>
- Shuffles the array such that the items will have a random order.
+ Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as [method @GDScript.randi]. Call [method @GDScript.randomize] to ensure that a new seed will be used each time if you want non-reproducible shuffling.
</description>
</method>
<method name="size">
diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml
index db0fc77b25..1707ea07e0 100644
--- a/doc/classes/ArrayMesh.xml
+++ b/doc/classes/ArrayMesh.xml
@@ -98,7 +98,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
- Return the index of the first surface with this name held within this [ArrayMesh]. If none are found -1 is returned.
+ Returns the index of the first surface with this name held within this [ArrayMesh]. If none are found -1 is returned.
</description>
</method>
<method name="surface_get_array_index_len" qualifiers="const">
@@ -107,7 +107,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the length in indices of the index array in the requested surface (see [method add_surface_from_arrays]).
+ Returns the length in indices of the index array in the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_get_array_len" qualifiers="const">
@@ -116,7 +116,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the length in vertices of the vertex array in the requested surface (see [method add_surface_from_arrays]).
+ Returns the length in vertices of the vertex array in the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_get_format" qualifiers="const">
@@ -125,7 +125,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the format mask of the requested surface (see [method add_surface_from_arrays]).
+ Returns the format mask of the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_get_name" qualifiers="const">
@@ -143,7 +143,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the primitive type of the requested surface (see [method add_surface_from_arrays]).
+ Returns the primitive type of the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_remove">
diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml
index 07d7c875db..c6ec45f15e 100644
--- a/doc/classes/AudioStreamPlayer.xml
+++ b/doc/classes/AudioStreamPlayer.xml
@@ -10,15 +10,6 @@
<link>https://docs.godotengine.org/en/latest/tutorials/audio/audio_streams.html</link>
</tutorials>
<methods>
- <method name="get_mix_time" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the actual amount of time this stream player was mixing since play() was pressed.
- To know the exact position this song is mixing right now, add the value to [method AudioServer.get_time_since_last_mix].
- Also consider substracting [method AudioServer.get_output_latency] to that result.
- </description>
- </method>
<method name="get_playback_position">
<return type="float">
</return>
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml
index 08be3ed0f4..6d1a7a8f87 100644
--- a/doc/classes/BaseButton.xml
+++ b/doc/classes/BaseButton.xml
@@ -29,14 +29,14 @@
<return type="int" enum="BaseButton.DrawMode">
</return>
<description>
- Return the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the button is defined by the DRAW_* enum.
+ Returns the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the button is defined by the DRAW_* enum.
</description>
</method>
<method name="is_hovered" qualifiers="const">
<return type="bool">
</return>
<description>
- Return [code]true[/code] if the mouse has entered the button and has not left it yet.
+ Returns [code]true[/code] if the mouse has entered the button and has not left it yet.
</description>
</method>
</methods>
@@ -57,6 +57,9 @@
<member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
[ButtonGroup] associated to the button.
</member>
+ <member name="keep_pressed_outside" type="bool" setter="set_keep_pressed_outside" getter="is_keep_pressed_outside">
+ If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it. Default value: [code]false[/code].
+ </member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
If [code]true[/code], the button's state is pressed. Means the button is pressed down or toggled (if toggle_mode is active).
</member>
diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml
index cee3035eab..ae7a3ff323 100644
--- a/doc/classes/Basis.xml
+++ b/doc/classes/Basis.xml
@@ -57,7 +57,7 @@
<return type="float">
</return>
<description>
- Return the determinant of the matrix.
+ Returns the determinant of the matrix.
</description>
</method>
<method name="get_euler">
@@ -91,7 +91,7 @@
<return type="Basis">
</return>
<description>
- Return the inverse of the matrix.
+ Returns the inverse of the matrix.
</description>
</method>
<method name="is_equal_approx">
@@ -108,7 +108,7 @@
<return type="Basis">
</return>
<description>
- Return the orthonormalized version of the matrix (useful to call from time to time to avoid rounding error for orthogonal matrices). This performs a Gram-Schmidt orthonormalization on the basis of the matrix.
+ Returns the orthonormalized version of the matrix (useful to call from time to time to avoid rounding error for orthogonal matrices). This performs a Gram-Schmidt orthonormalization on the basis of the matrix.
</description>
</method>
<method name="rotated">
@@ -173,7 +173,7 @@
<return type="Basis">
</return>
<description>
- Return the transposed version of the matrix.
+ Returns the transposed version of the matrix.
</description>
</method>
<method name="xform">
@@ -182,7 +182,7 @@
<argument index="0" name="v" type="Vector3">
</argument>
<description>
- Return a vector transformed (multiplied) by the matrix.
+ Returns a vector transformed (multiplied) by the matrix.
</description>
</method>
<method name="xform_inv">
@@ -191,7 +191,7 @@
<argument index="0" name="v" type="Vector3">
</argument>
<description>
- Return a vector transformed (multiplied) by the transposed matrix. Note that this results in a multiplication by the inverse of the matrix only if it represents a rotation-reflection.
+ Returns a vector transformed (multiplied) by the transposed matrix. Note that this results in a multiplication by the inverse of the matrix only if it represents a rotation-reflection.
</description>
</method>
</methods>
diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml
index 014df2b72a..0b7021b4a1 100644
--- a/doc/classes/Camera.xml
+++ b/doc/classes/Camera.xml
@@ -39,6 +39,13 @@
<description>
</description>
</method>
+ <method name="get_camera_rid" qualifiers="const">
+ <return type="RID">
+ </return>
+ <description>
+ Returns the camera's RID from the [VisualServer].
+ </description>
+ </method>
<method name="is_position_behind" qualifiers="const">
<return type="bool">
</return>
@@ -196,7 +203,7 @@
Perspective Projection (object's size on the screen becomes smaller when far away).
</constant>
<constant name="PROJECTION_ORTHOGONAL" value="1" enum="Projection">
- Orthogonal Projection (objects remain the same size on the screen no matter how far away they are).
+ Orthogonal Projection (objects remain the same size on the screen no matter how far away they are; also known as orthographic projection).
</constant>
<constant name="PROJECTION_FRUSTUM" value="2" enum="Projection">
</constant>
diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml
index e5d1649c29..fcc99123d2 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -35,7 +35,7 @@
<return type="Vector2">
</return>
<description>
- Return the camera position.
+ Returns the camera position.
</description>
</method>
<method name="get_camera_screen_center" qualifiers="const">
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 82a5679172..2426471a49 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -4,10 +4,10 @@
Base class of anything 2D.
</brief_description>
<description>
- Base class of anything 2D. Canvas items are laid out in a tree and children inherit and extend the transform of their parent. CanvasItem is extended by [Control], for anything GUI related, and by [Node2D] for anything 2D engine related.
- Any CanvasItem can draw. For this, the "update" function must be called, then NOTIFICATION_DRAW will be received on idle time to request redraw. Because of this, canvas items don't need to be redraw on every frame, improving the performance significantly. Several functions for drawing on the CanvasItem are provided (see draw_* functions). They can only be used inside the notification, signal or _draw() overrides function, though.
- Canvas items are draw in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything (this can be changed per item though).
- Canvas items can also be hidden (hiding also their subtree). They provide many means for changing standard parameters such as opacity (for it and the subtree) and self opacity, blend mode.
+ Base class of anything 2D. Canvas items are laid out in a tree; children inherit and extend their parent's transform. CanvasItem is extended by [Control] for anything GUI-related, and by [Node2D] for anything related to the 2D engine.
+ Any CanvasItem can draw. For this, [method update] must be called, then [constant NOTIFICATION_DRAW] will be received on idle time to request redraw. Because of this, canvas items don't need to be redrawn on every frame, improving the performance significantly. Several functions for drawing on the CanvasItem are provided (see [code]draw_*[/code] functions). However, they can only be used inside the [method Object._notification], signal or [method _draw] virtual functions.
+ Canvas items are drawn in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything. This behavior can be changed on a per-item basis.
+ A CanvasItem can also be hidden, which will also hide its children. It provides many ways to change parameters such as modulation (for itself and its children) and self modulation (only for itself), as well as its blend mode.
Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed.
</description>
<tutorials>
@@ -36,7 +36,7 @@
<argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
- Draws a string character using a custom font. Returns the advance, depending on the char width and kerning with an optional next char.
+ Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character.
</description>
</method>
<method name="draw_circle">
@@ -116,7 +116,7 @@
<argument index="3" name="antialiased" type="bool" default="false">
</argument>
<description>
- Draws multiple, parallel lines with a uniform [code]color[/code] and [code]width[/code] and optional antialiasing.
+ Draws multiple, parallel lines with a uniform [code]color[/code]. [code]width[/code] and [code]antialiased[/code] are currently not implemented and have no effect.
</description>
</method>
<method name="draw_multiline_colors">
@@ -211,7 +211,7 @@
<argument index="5" name="normal_map" type="Texture" default="null">
</argument>
<description>
- Draws a custom primitive, 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad.
+ Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad.
</description>
</method>
<method name="draw_rect">
@@ -308,7 +308,7 @@
<argument index="5" name="normal_map" type="Texture" default="null">
</argument>
<description>
- Draws a textured rectangle at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture.
+ Draws a textured rectangle at a given position, optionally modulated by a color. If [code]transpose[/code] is [code]true[/code], the texture will have its X and Y coordinates swapped.
</description>
</method>
<method name="draw_texture_rect_region">
@@ -329,7 +329,7 @@
<argument index="6" name="clip_uv" type="bool" default="true">
</argument>
<description>
- Draws a textured rectangle region at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture.
+ Draws a textured rectangle region at a given position, optionally modulated by a color. If [code]transpose[/code] is [code]true[/code], the texture will have its X and Y coordinates swapped.
</description>
</method>
<method name="force_update_transform">
@@ -342,14 +342,14 @@
<return type="RID">
</return>
<description>
- Return the [RID] of the [World2D] canvas where this item is in.
+ Returns the [RID] of the [World2D] canvas where this item is in.
</description>
</method>
<method name="get_canvas_item" qualifiers="const">
<return type="RID">
</return>
<description>
- Return the canvas item RID used by [VisualServer] for this item.
+ Returns the canvas item RID used by [VisualServer] for this item.
</description>
</method>
<method name="get_canvas_transform" qualifiers="const">
@@ -419,7 +419,7 @@
<return type="void">
</return>
<description>
- Hide the CanvasItem currently visible.
+ Hide the CanvasItem if it's currently visible.
</description>
</method>
<method name="is_local_transform_notification_enabled" qualifiers="const">
@@ -433,7 +433,7 @@
<return type="bool">
</return>
<description>
- Return if set as toplevel. See [method set_as_toplevel].
+ Returns [code]true[/code] if the node is set as top-level. See [method set_as_toplevel].
</description>
</method>
<method name="is_transform_notification_enabled" qualifiers="const">
@@ -474,7 +474,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Sets as top level. This means that it will not inherit transform from parent canvas items.
+ If [code]enable[/code] is [code]true[/code], the node won't inherit its transform from parent canvas items.
</description>
</method>
<method name="set_notify_local_transform">
@@ -499,14 +499,14 @@
<return type="void">
</return>
<description>
- Show the CanvasItem currently hidden. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple popup*() functions instead.
+ Show the CanvasItem if it's currently hidden. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead.
</description>
</method>
<method name="update">
<return type="void">
</return>
<description>
- Queue the CanvasItem for update. [code]NOTIFICATION_DRAW[/code] will be called on idle time to request redraw.
+ Queue the CanvasItem for update. [constant NOTIFICATION_DRAW] will be called on idle time to request redraw.
</description>
</method>
</methods>
@@ -533,7 +533,7 @@
If [code]true[/code], the parent [CanvasItem]'s [member material] property is used as this one's material. Default value: [code]false[/code].
</member>
<member name="visible" type="bool" setter="set_visible" getter="is_visible">
- If [code]true[/code], this [CanvasItem] is drawn. Default value: [code]true[/code]. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple popup*() functions instead.
+ If [code]true[/code], this [CanvasItem] is drawn. Default value: [code]true[/code]. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead.
</member>
</members>
<signals>
@@ -575,22 +575,22 @@
Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
</constant>
<constant name="BLEND_MODE_DISABLED" value="5" enum="BlendMode">
- Disable blending mode. Colors including alpha are written as is. Only applicable for render targets with a transparent background. No lighting will be applied.
+ Disable blending mode. Colors including alpha are written as-is. Only applicable for render targets with a transparent background. No lighting will be applied.
</constant>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000">
- Canvas item transform has changed. Notification is only received if enabled by [method set_notify_transform] or [method set_notify_local_transform].
+ The CanvasItem's transform has changed. This notification is only received if enabled by [method set_notify_transform] or [method set_notify_local_transform].
</constant>
<constant name="NOTIFICATION_DRAW" value="30">
- CanvasItem is requested to draw.
+ The CanvasItem is requested to draw.
</constant>
<constant name="NOTIFICATION_VISIBILITY_CHANGED" value="31">
- Canvas item visibility has changed.
+ The CanvasItem's visibility has changed.
</constant>
<constant name="NOTIFICATION_ENTER_CANVAS" value="32">
- Canvas item has entered the canvas.
+ The CanvasItem has entered the canvas.
</constant>
<constant name="NOTIFICATION_EXIT_CANVAS" value="33">
- Canvas item has exited the canvas.
+ The CanvasItem has exited the canvas.
</constant>
</constants>
</class>
diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml
index 94e4eececd..04344c1834 100644
--- a/doc/classes/CheckButton.xml
+++ b/doc/classes/CheckButton.xml
@@ -41,8 +41,12 @@
</theme_item>
<theme_item name="off" type="Texture">
</theme_item>
+ <theme_item name="off_disabled" type="Texture">
+ </theme_item>
<theme_item name="on" type="Texture">
</theme_item>
+ <theme_item name="on_disabled" type="Texture">
+ </theme_item>
<theme_item name="pressed" type="StyleBox">
</theme_item>
</theme_items>
diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml
index b029c85409..ddbe66380a 100644
--- a/doc/classes/ClassDB.xml
+++ b/doc/classes/ClassDB.xml
@@ -121,7 +121,7 @@
<argument index="1" name="name" type="String">
</argument>
<description>
- Return whether 'class' or its ancestry has an integer constant called 'name' or not.
+ Returns whether 'class' or its ancestry has an integer constant called 'name' or not.
</description>
</method>
<method name="class_has_method" qualifiers="const">
@@ -134,7 +134,7 @@
<argument index="2" name="no_inheritance" type="bool" default="false">
</argument>
<description>
- Return whether 'class' (or its ancestry if 'no_inheritance' is false) has a method called 'method' or not.
+ Returns whether 'class' (or its ancestry if 'no_inheritance' is false) has a method called 'method' or not.
</description>
</method>
<method name="class_has_signal" qualifiers="const">
@@ -145,7 +145,7 @@
<argument index="1" name="signal" type="String">
</argument>
<description>
- Return whether 'class' or its ancestry has a signal called 'signal' or not.
+ Returns whether 'class' or its ancestry has a signal called 'signal' or not.
</description>
</method>
<method name="class_set_property" qualifiers="const">
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index 1467812e4d..f847893a39 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -215,7 +215,7 @@
</methods>
<members>
<member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable">
- If [code]true[/code], this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events.
+ If [code]true[/code], this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. Requires at least one [code]collision_layer[/code] bit to be set.
</member>
</members>
<signals>
@@ -227,17 +227,17 @@
<argument index="2" name="shape_idx" type="int">
</argument>
<description>
- Emitted when an input event occurs and [code]input_pickable[/code] is [code]true[/code]. See [method _input_event] for details.
+ Emitted when an input event occurs. Requires [code]input_pickable[/code] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set. See [method _input_event] for details.
</description>
</signal>
<signal name="mouse_entered">
<description>
- Emitted when the mouse pointer enters any of this object's shapes.
+ Emitted when the mouse pointer enters any of this object's shapes. Requires [code]input_pickable[/code] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set.
</description>
</signal>
<signal name="mouse_exited">
<description>
- Emitted when the mouse pointer exits all this object's shapes.
+ Emitted when the mouse pointer exits all this object's shapes. Requires [code]input_pickable[/code] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set.
</description>
</signal>
</signals>
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index d0a81ad8ae..32e6014c75 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -31,7 +31,7 @@
<return type="PoolColorArray">
</return>
<description>
- Return the list of colors in the presets of the color picker.
+ Returns the list of colors in the presets of the color picker.
</description>
</method>
</methods>
@@ -45,6 +45,10 @@
<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="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).
</member>
diff --git a/doc/classes/ConcavePolygonShape.xml b/doc/classes/ConcavePolygonShape.xml
index afc6ce74a5..62d42f4eb4 100644
--- a/doc/classes/ConcavePolygonShape.xml
+++ b/doc/classes/ConcavePolygonShape.xml
@@ -13,7 +13,7 @@
<return type="PoolVector3Array">
</return>
<description>
- Return the faces (an array of triangles).
+ Returns the faces (an array of triangles).
</description>
</method>
<method name="set_faces">
diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml
index f39915f4b7..6124bc29b0 100644
--- a/doc/classes/ConfirmationDialog.xml
+++ b/doc/classes/ConfirmationDialog.xml
@@ -13,7 +13,7 @@
<return type="Button">
</return>
<description>
- Return the cancel button.
+ Returns the cancel button.
</description>
</method>
</methods>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index f7fbdf08ed..22061322c8 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -221,7 +221,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Return null if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag].
+ Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns null if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag].
A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method.
[codeblock]
extends Control
@@ -512,7 +512,7 @@
</return>
<argument index="0" name="preset" type="int" enum="Control.LayoutPreset">
</argument>
- <argument index="1" name="keep_margin" type="bool" default="false">
+ <argument index="1" name="keep_margins" type="bool" default="false">
</argument>
<description>
</description>
@@ -574,6 +574,16 @@
Sets [member margin_right] and [member margin_bottom] at the same time.
</description>
</method>
+ <method name="set_global_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <argument index="1" name="keep_margins" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_margins_preset">
<return type="void">
</return>
@@ -586,6 +596,16 @@
<description>
</description>
</method>
+ <method name="set_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <argument index="1" name="keep_margins" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_rotation">
<return type="void">
</return>
@@ -595,6 +615,16 @@
Sets the rotation (in radians).
</description>
</method>
+ <method name="set_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="size" type="Vector2">
+ </argument>
+ <argument index="1" name="keep_margins" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="show_modal">
<return type="void">
</return>
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index f47649363e..ec70fd311b 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -38,7 +38,7 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if the dictionary is empty.
+ Returns [code]true[/code] if the dictionary is empty.
</description>
</method>
<method name="erase">
@@ -47,7 +47,7 @@
<argument index="0" name="key" type="Variant">
</argument>
<description>
- Erase a dictionary key/value pair by key. Do not erase elements while iterating over the dictionary.
+ Erase a dictionary key/value pair by key. Returns [code]true[/code] if the given key was present in the dictionary, [code]false[/code] otherwise. Do not erase elements while iterating over the dictionary.
</description>
</method>
<method name="get">
@@ -67,7 +67,7 @@
<argument index="0" name="key" type="Variant">
</argument>
<description>
- Return [code]true[/code] if the dictionary has a given key.
+ Returns [code]true[/code] if the dictionary has a given key.
</description>
</method>
<method name="has_all">
@@ -76,35 +76,35 @@
<argument index="0" name="keys" type="Array">
</argument>
<description>
- Return [code]true[/code] if the dictionary has all of the keys in the given array.
+ Returns [code]true[/code] if the dictionary has all of the keys in the given array.
</description>
</method>
<method name="hash">
<return type="int">
</return>
<description>
- Return a hashed integer value representing the dictionary contents.
+ Returns a hashed integer value representing the dictionary contents.
</description>
</method>
<method name="keys">
<return type="Array">
</return>
<description>
- Return the list of keys in the [Dictionary].
+ Returns the list of keys in the [Dictionary].
</description>
</method>
<method name="size">
<return type="int">
</return>
<description>
- Return the size of the dictionary (in pairs).
+ Returns the size of the dictionary (in pairs).
</description>
</method>
<method name="values">
<return type="Array">
</return>
<description>
- Return the list of values in the [Dictionary].
+ Returns the list of values in the [Dictionary].
</description>
</method>
</methods>
diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml
index 8a81695198..54aac33652 100644
--- a/doc/classes/Directory.xml
+++ b/doc/classes/Directory.xml
@@ -52,7 +52,7 @@
<return type="bool">
</return>
<description>
- Return whether the current item processed with the last [method get_next] call is a directory ([code].[/code] and [code]..[/code] are considered directories).
+ Returns whether the current item processed with the last [method get_next] call is a directory ([code].[/code] and [code]..[/code] are considered directories).
</description>
</method>
<method name="dir_exists">
@@ -61,7 +61,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Return whether the target directory exists. The argument can be relative to the current directory, or an absolute path.
+ Returns whether the target directory exists. The argument can be relative to the current directory, or an absolute path.
</description>
</method>
<method name="file_exists">
@@ -70,14 +70,14 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Return whether the target file exists. The argument can be relative to the current directory, or an absolute path.
+ Returns whether the target file exists. The argument can be relative to the current directory, or an absolute path.
</description>
</method>
<method name="get_current_dir">
<return type="String">
</return>
<description>
- Return the absolute path to the currently opened directory (e.g. [code]res://folder[/code] or [code]C:\tmp\folder[/code]).
+ Returns the absolute path to the currently opened directory (e.g. [code]res://folder[/code] or [code]C:\tmp\folder[/code]).
</description>
</method>
<method name="get_current_drive">
@@ -107,7 +107,7 @@
<return type="String">
</return>
<description>
- Return the next element (file or directory) in the current directory (including [code].[/code] and [code]..[/code], unless [code]skip_navigational[/code] was given to [method list_dir_begin]).
+ Returns the next element (file or directory) in the current directory (including [code].[/code] and [code]..[/code], unless [code]skip_navigational[/code] was given to [method list_dir_begin]).
The name of the file or directory is returned (and not its full path). Once the stream has been fully processed, the method returns an empty String and closes the stream automatically (i.e. [method list_dir_end] would not be mandatory in such a case).
</description>
</method>
@@ -155,7 +155,7 @@
</argument>
<description>
Create a target directory and all necessary intermediate directories in its path, by calling [method make_dir] recursively. The argument can be relative to the current directory, or an absolute path.
- Return one of the error code constants defined in [@GlobalScope] (OK, FAILED or ERR_*).
+ Returns one of the error code constants defined in [@GlobalScope] (OK, FAILED or ERR_*).
</description>
</method>
<method name="open">
@@ -175,7 +175,7 @@
</argument>
<description>
Delete the target file or an empty directory. The argument can be relative to the current directory, or an absolute path. If the target directory is not empty, the operation will fail.
- Return one of the error code constants defined in [@GlobalScope] (OK or FAILED).
+ Returns one of the error code constants defined in [@GlobalScope] (OK or FAILED).
</description>
</method>
<method name="rename">
@@ -187,7 +187,7 @@
</argument>
<description>
Rename (move) the [i]from[/i] file to the [i]to[/i] destination. Both arguments should be paths to files, either relative or absolute. If the destination file exists and is not access-protected, it will be overwritten.
- Return one of the error code constants defined in [@GlobalScope] (OK or FAILED).
+ Returns one of the error code constants defined in [@GlobalScope] (OK or FAILED).
</description>
</method>
</methods>
diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml
index 998b05d495..4e4e29dc4e 100644
--- a/doc/classes/EditorExportPlugin.xml
+++ b/doc/classes/EditorExportPlugin.xml
@@ -21,6 +21,12 @@
<description>
</description>
</method>
+ <method name="_export_end" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="_export_file" qualifiers="virtual">
<return type="void">
</return>
diff --git a/doc/classes/EditorFileSystem.xml b/doc/classes/EditorFileSystem.xml
index 531af4c4e0..1c7a68fc0b 100644
--- a/doc/classes/EditorFileSystem.xml
+++ b/doc/classes/EditorFileSystem.xml
@@ -38,14 +38,14 @@
<return type="float">
</return>
<description>
- Return the scan progress for 0 to 1 if the FS is being scanned.
+ Returns the scan progress for 0 to 1 if the FS is being scanned.
</description>
</method>
<method name="is_scanning" qualifiers="const">
<return type="bool">
</return>
<description>
- Return [code]true[/code] of the filesystem is being scanned.
+ Returns [code]true[/code] of the filesystem is being scanned.
</description>
</method>
<method name="scan">
diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml
index f2dcd2177c..c2b13ff89e 100644
--- a/doc/classes/EditorInspectorPlugin.xml
+++ b/doc/classes/EditorInspectorPlugin.xml
@@ -21,7 +21,7 @@
<argument index="0" name="control" type="Control">
</argument>
<description>
- Add a custom control, not necesarily a property editor.
+ Add a custom control, not necessarily a property editor.
</description>
</method>
<method name="add_property_editor">
@@ -54,7 +54,7 @@
<argument index="0" name="object" type="Object">
</argument>
<description>
- Return true if this object can be handled by this plugin.
+ Returns true if this object can be handled by this plugin.
</description>
</method>
<method name="parse_begin" qualifiers="virtual">
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 7981c90f86..97ad4f6829 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -241,7 +241,7 @@
<return type="EditorInterface">
</return>
<description>
- Return the [EditorInterface] object that gives you control over Godot editor's window and its functionalities.
+ Returns the [EditorInterface] object that gives you control over Godot editor's window and its functionalities.
</description>
</method>
<method name="get_plugin_icon" qualifiers="virtual">
@@ -299,7 +299,7 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if this is a main screen editor plugin (it goes in the workspaces selector together with '2D', '3D', and 'Script').
+ Returns [code]true[/code] if this is a main screen editor plugin (it goes in the workspaces selector together with '2D', '3D', and 'Script').
</description>
</method>
<method name="hide_bottom_panel">
@@ -471,6 +471,7 @@
<return type="int">
</return>
<description>
+ Updates the overlays of the editor (2D/3D) viewport.
</description>
</method>
</methods>
diff --git a/doc/classes/EditorResourcePreviewGenerator.xml b/doc/classes/EditorResourcePreviewGenerator.xml
index 6592ffd1a8..156cc62941 100644
--- a/doc/classes/EditorResourcePreviewGenerator.xml
+++ b/doc/classes/EditorResourcePreviewGenerator.xml
@@ -9,6 +9,14 @@
<tutorials>
</tutorials>
<methods>
+ <method name="can_generate_small_preview" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ If this function returns true the generator will call [method generate] or [method generate_from_path] for small previews too.
+ By default it returns false.
+ </description>
+ </method>
<method name="generate" qualifiers="virtual">
<return type="Texture">
</return>
@@ -35,13 +43,21 @@
Care must be taken because this function is always called from a thread (not the main thread).
</description>
</method>
+ <method name="generate_small_preview_automatically" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ If this function returns true the generator will automatically generate the small previews from the normal preview texture generated by the methods [method generate] or [method generate_from_path].
+ By default it returns false.
+ </description>
+ </method>
<method name="handles" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="type" type="String">
</argument>
<description>
- Return if your generator supports this resource type.
+ Returns if your generator supports this resource type.
</description>
</method>
</methods>
diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml
index da7fee1cf7..5d5c37b212 100644
--- a/doc/classes/EditorSpatialGizmo.xml
+++ b/doc/classes/EditorSpatialGizmo.xml
@@ -123,7 +123,7 @@
<return type="EditorSpatialGizmoPlugin">
</return>
<description>
- Return the [EditorSpatialGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorSpatialGizmoPlugin.get_material].
+ Returns the [EditorSpatialGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorSpatialGizmoPlugin.get_material].
</description>
</method>
<method name="get_spatial_node" qualifiers="const">
diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml
index 66e6fa5314..953f364bdb 100644
--- a/doc/classes/FileDialog.xml
+++ b/doc/classes/FileDialog.xml
@@ -43,7 +43,7 @@
<return type="VBoxContainer">
</return>
<description>
- Return the vertical box container of the dialog, custom controls can be added to it.
+ Returns the vertical box container of the dialog, custom controls can be added to it.
</description>
</method>
<method name="invalidate">
diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml
index bd189928b0..d65dad9fe1 100644
--- a/doc/classes/Font.xml
+++ b/doc/classes/Font.xml
@@ -51,21 +51,21 @@
<return type="float">
</return>
<description>
- Return the font ascent (number of pixels above the baseline).
+ Returns the font ascent (number of pixels above the baseline).
</description>
</method>
<method name="get_descent" qualifiers="const">
<return type="float">
</return>
<description>
- Return the font descent (number of pixels below the baseline).
+ Returns the font descent (number of pixels below the baseline).
</description>
</method>
<method name="get_height" qualifiers="const">
<return type="float">
</return>
<description>
- Return the total font height (ascent plus descent) in pixels.
+ Returns the total font height (ascent plus descent) in pixels.
</description>
</method>
<method name="get_string_size" qualifiers="const">
@@ -74,7 +74,17 @@
<argument index="0" name="string" type="String">
</argument>
<description>
- Return the size of a string, taking kerning and advance into account.
+ Returns the size of a string, taking kerning and advance into account.
+ </description>
+ </method>
+ <method name="get_wordwrap_string_size" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="string" type="String">
+ </argument>
+ <argument index="1" name="p_width" type="float">
+ </argument>
+ <description>
</description>
</method>
<method name="has_outline" qualifiers="const">
diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml
index 3f84316503..e35d7a68c5 100644
--- a/doc/classes/FuncRef.xml
+++ b/doc/classes/FuncRef.xml
@@ -17,6 +17,12 @@
Calls the referenced function previously set by [method set_function] or [method @GDScript.funcref].
</description>
</method>
+ <method name="is_valid" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="set_function">
<return type="void">
</return>
diff --git a/doc/classes/Geometry.xml b/doc/classes/Geometry.xml
index 68539d7ecb..e2ba3fb7b0 100644
--- a/doc/classes/Geometry.xml
+++ b/doc/classes/Geometry.xml
@@ -59,6 +59,29 @@
Clips the polygon defined by the points in [code]points[/code] against the [code]plane[/code] and returns the points of the clipped polygon.
</description>
</method>
+ <method name="clip_polygons_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polygon_a" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="polygon_b" type="PoolVector2Array">
+ </argument>
+ <description>
+ Clips [code]polygon_a[/code] against [code]polygon_b[/code] and returns an array of clipped polygons. This performs [code]OPERATION_DIFFERENCE[/code] between polygons. Returns an empty array if [code]polygon_b[/code] completely overlaps [code]polygon_a[/code].
+ If [code]polygon_b[/code] is enclosed by [code]polygon_a[/code], returns an outer polygon (boundary) and inner polygon (hole) which could be distiguished by calling [method is_polygon_clockwise].
+ </description>
+ </method>
+ <method name="clip_polyline_with_polygon_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polyline" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="polygon" type="PoolVector2Array">
+ </argument>
+ <description>
+ Clips [code]polyline[/code] against [code]polygon[/code] and returns an array of clipped polylines. This performs [code]OPERATION_DIFFERENCE[/code] between the polyline and the polygon. This operation can be thought of as cutting a line with a closed shape.
+ </description>
+ </method>
<method name="convex_hull_2d">
<return type="PoolVector2Array">
</return>
@@ -68,6 +91,18 @@
Given an array of [Vector2]s, returns the convex hull as a list of points in counter-clockwise order. The last point is the same as the first one.
</description>
</method>
+ <method name="exclude_polygons_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polygon_a" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="polygon_b" type="PoolVector2Array">
+ </argument>
+ <description>
+ Mutually excludes common area defined by intersection of [code]polygon_a[/code] and [code]polygon_b[/code] (see [method intersect_polygons_2d]) and returns an array of excluded polygons. This performs [code]OPERATION_XOR[/code] between polygons. In other words, returns all but common area between polygons.
+ The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distiguished by calling [method is_polygon_clockwise].
+ </description>
+ </method>
<method name="get_closest_point_to_segment">
<return type="Vector3">
</return>
@@ -158,6 +193,38 @@
<description>
</description>
</method>
+ <method name="intersect_polygons_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polygon_a" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="polygon_b" type="PoolVector2Array">
+ </argument>
+ <description>
+ Intersects [code]polygon_a[/code] with [code]polygon_b[/code] and returns an array of intersected polygons. This performs [code]OPERATION_INTERSECTION[/code] between polygons. In other words, returns common area shared by polygons. Returns an empty array if no intersection occurs.
+ The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distiguished by calling [method is_polygon_clockwise].
+ </description>
+ </method>
+ <method name="intersect_polyline_with_polygon_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polyline" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="polygon" type="PoolVector2Array">
+ </argument>
+ <description>
+ Intersects [code]polyline[/code] with [code]polygon[/code] and returns an array of intersected polylines. This performs [code]OPERATION_INTERSECTION[/code] between the polyline and the polygon. This operation can be thought of as chopping a line with a closed shape.
+ </description>
+ </method>
+ <method name="is_polygon_clockwise">
+ <return type="bool">
+ </return>
+ <argument index="0" name="polygon" type="PoolVector2Array">
+ </argument>
+ <description>
+ Returns [code]true[/code] if [code]polygon[/code]'s vertices are ordered in clockwise order, otherwise returns [code]false[/code].
+ </description>
+ </method>
<method name="line_intersects_line_2d">
<return type="Variant">
</return>
@@ -182,6 +249,51 @@
Given an array of [Vector2]s representing tiles, builds an atlas. The returned dictionary has two keys: [code]points[/code] is a vector of [Vector2] that specifies the positions of each tile, [code]size[/code] contains the overall size of the whole atlas as [Vector2].
</description>
</method>
+ <method name="merge_polygons_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polygon_a" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="polygon_b" type="PoolVector2Array">
+ </argument>
+ <description>
+ Merges (combines) [code]polygon_a[/code] and [code]polygon_b[/code] and returns an array of merged polygons. This performs [code]OPERATION_UNION[/code] between polygons.
+ The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distiguished by calling [method is_polygon_clockwise].
+ </description>
+ </method>
+ <method name="offset_polygon_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polygon" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="delta" type="float">
+ </argument>
+ <argument index="2" name="join_type" type="int" enum="Geometry.PolyJoinType" default="0">
+ </argument>
+ <description>
+ Inflates or deflates [code]polygon[/code] by [code]delta[/code] units (pixels). If [code]delta[/code] is positive, makes the polygon grow outward. If [code]delta[/code] is negative, shrinks the polygon inward. Returns an array of polygons because inflating/deflating may result in multiple discrete polygons. Returns an empty array if [code]delta[/code] is negative and the absolute value of it approximately exceeds the minimum bounding rectangle dimensions of the polygon.
+ Each polygon's vertices will be rounded as determined by [code]join_type[/code], see [enum Geometry.PolyJoinType].
+ The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distiguished by calling [method is_polygon_clockwise].
+ </description>
+ </method>
+ <method name="offset_polyline_2d">
+ <return type="Array">
+ </return>
+ <argument index="0" name="polyline" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="delta" type="float">
+ </argument>
+ <argument index="2" name="join_type" type="int" enum="Geometry.PolyJoinType" default="0">
+ </argument>
+ <argument index="3" name="end_type" type="int" enum="Geometry.PolyEndType" default="3">
+ </argument>
+ <description>
+ Inflates or deflates [code]polyline[/code] by [code]delta[/code] units (pixels), producing polygons. If [code]delta[/code] is positive, makes the polyline grow outward. Returns an array of polygons because inflating/deflating may result in multiple discrete polygons. If [code]delta[/code] is negative, returns an empty array.
+ Each polygon's vertices will be rounded as determined by [code]join_type[/code], see [enum Geometry.PolyJoinType].
+ Each polygon's endpoints will be rounded as determined by [code]end_type[/code], see [enum Geometry.PolyEndType].
+ The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distiguished by calling [method is_polygon_clockwise].
+ </description>
+ </method>
<method name="point_is_inside_triangle" qualifiers="const">
<return type="bool">
</return>
@@ -304,6 +416,27 @@
Tests if the segment ([code]from[/code], [code]to[/code]) intersects the triangle [code]a[/code], [code]b[/code], [code]c[/code]. If yes, returns the point of intersection as [Vector3]. If no intersection takes place, an empty [Variant] is returned.
</description>
</method>
+ <method name="transform_points_2d">
+ <return type="PoolVector2Array">
+ </return>
+ <argument index="0" name="points" type="PoolVector2Array">
+ </argument>
+ <argument index="1" name="transform" type="Transform2D">
+ </argument>
+ <description>
+ Transforms an array of points by [code]transform[/code] and returns the result.
+ Can be useful in conjuction with performing polygon boolean operations in CSG manner, see [method merge_polygons_2d], [method clip_polygons_2d], [method intersect_polygons_2d], [method exclude_polygons_2d].
+ </description>
+ </method>
+ <method name="triangulate_delaunay_2d">
+ <return type="PoolIntArray">
+ </return>
+ <argument index="0" name="points" type="PoolVector2Array">
+ </argument>
+ <description>
+ Triangulates the area specified by discrete set of [code]points[/code] such that no point is inside the circumcircle of any resulting triangle. Returns a [PoolIntArray] where each triangle consists of three consecutive point indices into [code]points[/code] (i.e. the returned array will have [code]n * 3[/code] elements, with [code]n[/code] being the number of found triangles). If the triangulation did not succeed, an empty [PoolIntArray] is returned.
+ </description>
+ </method>
<method name="triangulate_polygon">
<return type="PoolIntArray">
</return>
@@ -315,5 +448,41 @@
</method>
</methods>
<constants>
+ <constant name="OPERATION_UNION" value="0" enum="PolyBooleanOperation">
+ Create regions where either subject or clip polygons (or both) are filled.
+ </constant>
+ <constant name="OPERATION_DIFFERENCE" value="1" enum="PolyBooleanOperation">
+ Create regions where subject polygons are filled except where clip polygons are filled.
+ </constant>
+ <constant name="OPERATION_INTERSECTION" value="2" enum="PolyBooleanOperation">
+ Create regions where both subject and clip polygons are filled.
+ </constant>
+ <constant name="OPERATION_XOR" value="3" enum="PolyBooleanOperation">
+ Create regions where either subject or clip polygons are filled but not where both are filled.
+ </constant>
+ <constant name="JOIN_SQUARE" value="0" enum="PolyJoinType">
+ Squaring is applied uniformally at all convex edge joins at [code]1 * delta[/code].
+ </constant>
+ <constant name="JOIN_ROUND" value="1" enum="PolyJoinType">
+ While flattened paths can never perfectly trace an arc, they are approximated by a series of arc chords.
+ </constant>
+ <constant name="JOIN_MITER" value="2" enum="PolyJoinType">
+ There's a necessary limit to mitered joins since offsetting edges that join at very acute angles will produce excessively long and narrow 'spikes'. For any given edge join, when miter offsetting would exceed that maximum distance, 'square' joining is applied.
+ </constant>
+ <constant name="END_POLYGON" value="0" enum="PolyEndType">
+ Endpoints are joined using the [enum PolyJoinType] value and the path filled as a polygon.
+ </constant>
+ <constant name="END_JOINED" value="1" enum="PolyEndType">
+ Endpoints are joined using the [enum PolyJoinType] value and the path filled as a polyline.
+ </constant>
+ <constant name="END_BUTT" value="2" enum="PolyEndType">
+ Endpoints are squared off with no extension.
+ </constant>
+ <constant name="END_SQUARE" value="3" enum="PolyEndType">
+ Endpoints are squared off and extended by [code]delta[/code] units.
+ </constant>
+ <constant name="END_ROUND" value="4" enum="PolyEndType">
+ Endpoints are rounded off and extended by [code]delta[/code] units.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index 145cd243bc..db186eab35 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -80,7 +80,7 @@
<return type="Array">
</return>
<description>
- Return an Array containing the list of connections. A connection consists in a structure of the form {from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }
+ Returns an Array containing the list of connections. A connection consists in a structure of the form {from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }
</description>
</method>
<method name="get_zoom_hbox">
@@ -101,7 +101,7 @@
<argument index="3" name="to_port" type="int">
</argument>
<description>
- Return [code]true[/code] if the 'from_port' slot of 'from' GraphNode is connected to the 'to_port' slot of 'to' GraphNode.
+ Returns [code]true[/code] if the 'from_port' slot of 'from' GraphNode is connected to the 'to_port' slot of 'to' GraphNode.
</description>
</method>
<method name="is_valid_connection_type" qualifiers="const">
diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml
index 4d6f3180d0..a19676798b 100644
--- a/doc/classes/GraphNode.xml
+++ b/doc/classes/GraphNode.xml
@@ -31,14 +31,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the color of the input connection 'idx'.
+ Returns the color of the input connection 'idx'.
</description>
</method>
<method name="get_connection_input_count">
<return type="int">
</return>
<description>
- Return the number of enabled input slots (connections) to the GraphNode.
+ Returns the number of enabled input slots (connections) to the GraphNode.
</description>
</method>
<method name="get_connection_input_position">
@@ -47,7 +47,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the position of the input connection 'idx'.
+ Returns the position of the input connection 'idx'.
</description>
</method>
<method name="get_connection_input_type">
@@ -56,7 +56,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the type of the input connection 'idx'.
+ Returns the type of the input connection 'idx'.
</description>
</method>
<method name="get_connection_output_color">
@@ -65,14 +65,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the color of the output connection 'idx'.
+ Returns the color of the output connection 'idx'.
</description>
</method>
<method name="get_connection_output_count">
<return type="int">
</return>
<description>
- Return the number of enabled output slots (connections) of the GraphNode.
+ Returns the number of enabled output slots (connections) of the GraphNode.
</description>
</method>
<method name="get_connection_output_position">
@@ -81,7 +81,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the position of the output connection 'idx'.
+ Returns the position of the output connection 'idx'.
</description>
</method>
<method name="get_connection_output_type">
@@ -90,7 +90,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the type of the output connection 'idx'.
+ Returns the type of the output connection 'idx'.
</description>
</method>
<method name="get_slot_color_left" qualifiers="const">
@@ -99,7 +99,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the color set to 'idx' left (input) slot.
+ Returns the color set to 'idx' left (input) slot.
</description>
</method>
<method name="get_slot_color_right" qualifiers="const">
@@ -108,7 +108,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the color set to 'idx' right (output) slot.
+ Returns the color set to 'idx' right (output) slot.
</description>
</method>
<method name="get_slot_type_left" qualifiers="const">
@@ -117,7 +117,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the (integer) type of left (input) 'idx' slot.
+ Returns the (integer) type of left (input) 'idx' slot.
</description>
</method>
<method name="get_slot_type_right" qualifiers="const">
@@ -126,7 +126,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the (integer) type of right (output) 'idx' slot.
+ Returns the (integer) type of right (output) 'idx' slot.
</description>
</method>
<method name="is_slot_enabled_left" qualifiers="const">
@@ -135,7 +135,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return [code]true[/code] if left (input) slot 'idx' is enabled, [code]false[/code] otherwise.
+ Returns [code]true[/code] if left (input) slot 'idx' is enabled, [code]false[/code] otherwise.
</description>
</method>
<method name="is_slot_enabled_right" qualifiers="const">
@@ -144,7 +144,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return [code]true[/code] if right (output) slot 'idx' is enabled, [code]false[/code] otherwise.
+ Returns [code]true[/code] if right (output) slot 'idx' is enabled, [code]false[/code] otherwise.
</description>
</method>
<method name="set_slot">
diff --git a/doc/classes/HeightMapShape.xml b/doc/classes/HeightMapShape.xml
index 5ffeda1c10..22896535b9 100644
--- a/doc/classes/HeightMapShape.xml
+++ b/doc/classes/HeightMapShape.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="HeightMapShape" inherits="Shape" category="Core" version="3.2">
<brief_description>
- Height map shape for 3D physics (bullet only)
+ Height map shape for 3D physics (Bullet only).
</brief_description>
<description>
Height map shape resource, which can be added to a [PhysicsBody] or [Area].
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index 641bd64599..8dfabdd884 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -603,6 +603,8 @@
If the image does not have mipmaps, they will be generated and used internally, but no mipmaps will be generated on the resulting image. (Note that if you intend to scale multiple copies of the original image, it's better to call [code]generate_mipmaps[/code] on it in advance, to avoid wasting processing power in generating them again and again.)
On the other hand, if the image already has mipmaps, they will be used, and a new set will be generated for the resulting image.
</constant>
+ <constant name="INTERPOLATE_LANCZOS" value="4" enum="Interpolation">
+ </constant>
<constant name="ALPHA_NONE" value="0" enum="AlphaMode">
</constant>
<constant name="ALPHA_BIT" value="1" enum="AlphaMode">
diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml
index 15ecd4ee6d..e5a8fee767 100644
--- a/doc/classes/ImageTexture.xml
+++ b/doc/classes/ImageTexture.xml
@@ -40,7 +40,7 @@
<return type="int" enum="Image.Format">
</return>
<description>
- Return the format of the [ImageTexture], one of [enum Image.Format].
+ Returns the format of the [ImageTexture], one of [enum Image.Format].
</description>
</method>
<method name="load">
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index 319f84b8d2..9c41e4bf1d 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -194,7 +194,7 @@
<return type="int" enum="Input.MouseMode">
</return>
<description>
- Return the mouse mode. See the constants for more information.
+ Returns the mouse mode. See the constants for more information.
</description>
</method>
<method name="is_action_just_pressed" qualifiers="const">
diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml
index 663eeda77a..ba3a7fe6d8 100644
--- a/doc/classes/ItemList.xml
+++ b/doc/classes/ItemList.xml
@@ -64,7 +64,7 @@
<return type="int">
</return>
<description>
- Return count of items currently in the item list.
+ Returns count of items currently in the item list.
</description>
</method>
<method name="get_item_custom_bg_color" qualifiers="const">
@@ -122,7 +122,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the text for specified item index.
+ Returns the text for specified item index.
</description>
</method>
<method name="get_item_tooltip" qualifiers="const">
@@ -131,7 +131,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return tooltip hint for specified item index.
+ Returns tooltip hint for specified item index.
</description>
</method>
<method name="get_selected_items">
diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml
index 05a8129cc5..b7ff4bac84 100644
--- a/doc/classes/KinematicBody2D.xml
+++ b/doc/classes/KinematicBody2D.xml
@@ -9,6 +9,8 @@
Kinematic Characters: KinematicBody2D also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
</description>
<tutorials>
+ <link>https://docs.godotengine.org/en/latest/tutorials/physics/kinematic_character_2d.html</link>
+ <link>https://docs.godotengine.org/en/latest/tutorials/physics/using_kinematic_body_2d.html</link>
</tutorials>
<methods>
<method name="get_floor_velocity" qualifiers="const">
diff --git a/doc/classes/Line2D.xml b/doc/classes/Line2D.xml
index 623b23807f..c55760767a 100644
--- a/doc/classes/Line2D.xml
+++ b/doc/classes/Line2D.xml
@@ -14,8 +14,11 @@
</return>
<argument index="0" name="position" type="Vector2">
</argument>
+ <argument index="1" name="at_position" type="int" default="-1">
+ </argument>
<description>
Add a point at the [code]position[/code]. Appends the point at the end of the line.
+ If [code]at_position[/code] is given, the point is inserted before the point number [code]at_position[/code], moving that point (and every point after) after the inserted point. If [code]at_position[/code] is not given, or is an illegal value ([code]at_position &lt; 0[/code] or [code]at_position &gt;= [method get_point_count][/code]), the point will be appended at the end of the point list.
</description>
</method>
<method name="clear_points">
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index 6ea097ec2f..bb180b591d 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -1,10 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="LineEdit" inherits="Control" category="Core" version="3.2">
<brief_description>
- Control that provides single line string editing.
+ Control that provides single-line string editing.
</brief_description>
<description>
- LineEdit provides a single line string editor, used for text fields.
+ LineEdit provides a single-line string editor, used for text fields. It features many built-in shortcuts which will always be available:
+ - Ctrl + C: Copy
+ - Ctrl + X: Cut
+ - Ctrl + V or Ctrl + Y: Paste/"yank"
+ - Ctrl + Z: Undo
+ - Ctrl + Shift + Z: Redo
+ - Ctrl + U: Delete text from the cursor position to the beginning of the line
+ - Ctrl + K: Delete text from the cursor position to the end of the line
+ - Ctrl + A: Select all text
+ - Up/Down arrow: Move the cursor to the beginning/end of the line
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Marshalls.xml b/doc/classes/Marshalls.xml
index 0d07d8b649..c7118a4d9f 100644
--- a/doc/classes/Marshalls.xml
+++ b/doc/classes/Marshalls.xml
@@ -15,7 +15,7 @@
<argument index="0" name="base64_str" type="String">
</argument>
<description>
- Return [PoolByteArray] of a given base64 encoded String.
+ Returns [PoolByteArray] of a given base64 encoded String.
</description>
</method>
<method name="base64_to_utf8">
@@ -24,7 +24,7 @@
<argument index="0" name="base64_str" type="String">
</argument>
<description>
- Return utf8 String of a given base64 encoded String.
+ Returns utf8 String of a given base64 encoded String.
</description>
</method>
<method name="base64_to_variant">
@@ -35,7 +35,7 @@
<argument index="1" name="allow_objects" type="bool" default="false">
</argument>
<description>
- Return [Variant] of a given base64 encoded String. When [code]allow_objects[/code] is [code]true[/code] decoding objects is allowed.
+ Returns [Variant] of a given base64 encoded String. When [code]allow_objects[/code] is [code]true[/code] decoding objects is allowed.
[b]WARNING:[/b] Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution).
</description>
</method>
@@ -45,7 +45,7 @@
<argument index="0" name="array" type="PoolByteArray">
</argument>
<description>
- Return base64 encoded String of a given [PoolByteArray].
+ Returns base64 encoded String of a given [PoolByteArray].
</description>
</method>
<method name="utf8_to_base64">
@@ -54,7 +54,7 @@
<argument index="0" name="utf8_str" type="String">
</argument>
<description>
- Return base64 encoded String of a given utf8 String.
+ Returns base64 encoded String of a given utf8 String.
</description>
</method>
<method name="variant_to_base64">
@@ -65,7 +65,7 @@
<argument index="1" name="full_objects" type="bool" default="false">
</argument>
<description>
- Return base64 encoded String of a given [Variant]. When [code]full_objects[/code] is [code]true[/code] encoding objects is allowed (and can potentially include code).
+ Returns base64 encoded String of a given [Variant]. When [code]full_objects[/code] is [code]true[/code] encoding objects is allowed (and can potentially include code).
</description>
</method>
</methods>
diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml
index dadc31b794..1043aa1087 100644
--- a/doc/classes/MenuButton.xml
+++ b/doc/classes/MenuButton.xml
@@ -13,7 +13,7 @@
<return type="PopupMenu">
</return>
<description>
- Return the [PopupMenu] contained in this button.
+ Returns the [PopupMenu] contained in this button.
</description>
</method>
<method name="set_disable_shortcuts">
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index ae035341f6..b8bc5cbd11 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -50,7 +50,7 @@
<return type="int">
</return>
<description>
- Return the amount of surfaces that the [Mesh] holds.
+ Returns the amount of surfaces that the [Mesh] holds.
</description>
</method>
<method name="surface_get_arrays" qualifiers="const">
@@ -77,7 +77,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return a [Material] in a given surface. Surface is rendered using this material.
+ Returns a [Material] in a given surface. Surface is rendered using this material.
</description>
</method>
</methods>
diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml
index de4f6cdf72..ad5824640d 100644
--- a/doc/classes/MeshLibrary.xml
+++ b/doc/classes/MeshLibrary.xml
@@ -37,7 +37,7 @@
<return type="PoolIntArray">
</return>
<description>
- Return the list of items.
+ Returns the list of items.
</description>
</method>
<method name="get_item_mesh" qualifiers="const">
@@ -46,7 +46,7 @@
<argument index="0" name="id" type="int">
</argument>
<description>
- Return the mesh of the item.
+ Returns the mesh of the item.
</description>
</method>
<method name="get_item_name" qualifiers="const">
@@ -55,7 +55,7 @@
<argument index="0" name="id" type="int">
</argument>
<description>
- Return the name of the item.
+ Returns the name of the item.
</description>
</method>
<method name="get_item_navmesh" qualifiers="const">
diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml
index 7148871e8c..0784fc3a42 100644
--- a/doc/classes/MultiMesh.xml
+++ b/doc/classes/MultiMesh.xml
@@ -17,7 +17,7 @@
<return type="AABB">
</return>
<description>
- Return the visibility AABB.
+ Returns the visibility AABB.
</description>
</method>
<method name="get_instance_color" qualifiers="const">
@@ -35,7 +35,7 @@
<argument index="0" name="instance" type="int">
</argument>
<description>
- Return the custom data that has been set for a specific instance.
+ Returns the custom data that has been set for a specific instance.
</description>
</method>
<method name="get_instance_transform" qualifiers="const">
@@ -44,7 +44,7 @@
<argument index="0" name="instance" type="int">
</argument>
<description>
- Return the transform of a specific instance.
+ Returns the [Transform] of a specific instance.
</description>
</method>
<method name="get_instance_transform_2d" qualifiers="const">
@@ -53,6 +53,18 @@
<argument index="0" name="instance" type="int">
</argument>
<description>
+ Returns the [Transform2D] of a specific instance.
+ </description>
+ </method>
+ <method name="set_as_bulk_array">
+ <return type="void">
+ </return>
+ <argument index="0" name="array" type="PoolRealArray">
+ </argument>
+ <description>
+ Set all data related to the instances in one go. This is especially useful when loading the data from disk or preparing the data from GDNative.
+ All data is packed in one large float array. An array may look like this: Transform for instance 1, color data for instance 1, custom data for instance 1, transform for instance 2, color data for instance 2, etc...
+ [Transform] is stored as 12 floats, [Transform2D] is stored as 8 floats, COLOR_8BIT / CUSTOM_DATA_8BIT is stored as 1 float (4 bytes as is) and COLOR_FLOAT / CUSTOM_DATA_FLOAT is stored as 4 floats.
</description>
</method>
<method name="set_instance_color">
@@ -86,7 +98,7 @@
<argument index="1" name="transform" type="Transform">
</argument>
<description>
- Set the transform for a specific instance.
+ Set the [Transform] for a specific instance.
</description>
</method>
<method name="set_instance_transform_2d">
@@ -97,6 +109,7 @@
<argument index="1" name="transform" type="Transform2D">
</argument>
<description>
+ Set the [Transform2D] for a specific instance.
</description>
</method>
</methods>
@@ -108,7 +121,7 @@
Format of custom data in custom data array that gets passed to shader.
</member>
<member name="instance_count" type="int" setter="set_instance_count" getter="get_instance_count">
- Number of instances that will get drawn.
+ Number of instances that will get drawn. This clears and (re)sizes the buffers. By default all instances are drawn but you can limit this with [member visible_instance_count].
</member>
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
Mesh to be drawn.
@@ -117,6 +130,7 @@
Format of transform used to transform mesh, either 2D or 3D.
</member>
<member name="visible_instance_count" type="int" setter="set_visible_instance_count" getter="get_visible_instance_count">
+ Limits the number of instances drawn, -1 draws all instances. Changing this does not change the sizes of the buffers.
</member>
</members>
<constants>
diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml
index 73739ba79a..554858d895 100644
--- a/doc/classes/NodePath.xml
+++ b/doc/classes/NodePath.xml
@@ -68,14 +68,14 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if the node path is absolute (not relative).
+ Returns [code]true[/code] if the node path is absolute (not relative).
</description>
</method>
<method name="is_empty">
<return type="bool">
</return>
<description>
- Return [code]true[/code] if the node path is empty.
+ Returns [code]true[/code] if the node path is empty.
</description>
</method>
</methods>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index c9c83bc0e0..ec2ee78701 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -697,7 +697,19 @@
<argument index="0" name="icon" type="Image">
</argument>
<description>
- Sets the game's icon.
+ Sets the game's icon using an [Image] resource.
+ The same image is used for window caption, taskbar/dock and window selection dialog. Image is scaled as needed.
+ </description>
+ </method>
+ <method name="set_native_icon">
+ <return type="void">
+ </return>
+ <argument index="0" name="filename" type="String">
+ </argument>
+ <description>
+ Sets the game's icon using a multi-size platform-specific icon file ([code]*.ico[/code] on Windows and [code]*.icns[/code] on macOS).
+ Appropriate size sub-icons are used for window caption, taskbar/dock and window selection dialog.
+ Note: This method is only implemented on macOS and Windows.
</description>
</method>
<method name="set_ime_active">
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 4fe43814d1..dbbd974b04 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -57,6 +57,14 @@
Sets a property. Returns [code]true[/code] if the [code]property[/code] exists.
</description>
</method>
+ <method name="_to_string" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
+ Override this method to customize the [String] representation of the object when it's being converted to a string, for example: [code]print(obj)[/code].
+ </description>
+ </method>
<method name="add_user_signal">
<return type="void">
</return>
@@ -327,6 +335,14 @@
<description>
</description>
</method>
+ <method name="remove_meta">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set">
<return type="void">
</return>
@@ -396,6 +412,14 @@
Set a script into the object, scripts extend the object functionality.
</description>
</method>
+ <method name="to_string">
+ <return type="String">
+ </return>
+ <description>
+ Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
+ Override the method [method _to_string] to customize the [String] representation.
+ </description>
+ </method>
<method name="tr" qualifiers="const">
<return type="String">
</return>
diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml
index 51d2cbc867..1f714656de 100644
--- a/doc/classes/OptionButton.xml
+++ b/doc/classes/OptionButton.xml
@@ -51,7 +51,7 @@
<return type="int">
</return>
<description>
- Return the amount of items in the OptionButton.
+ Returns the amount of items in the OptionButton.
</description>
</method>
<method name="get_item_icon" qualifiers="const">
@@ -60,7 +60,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the icon of the item at index "idx".
+ Returns the icon of the item at index "idx".
</description>
</method>
<method name="get_item_id" qualifiers="const">
@@ -69,7 +69,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the ID of the item at index [code]idx[/code].
+ Returns the ID of the item at index [code]idx[/code].
</description>
</method>
<method name="get_item_index" qualifiers="const">
@@ -78,7 +78,7 @@
<argument index="0" name="id" type="int">
</argument>
<description>
- Return the index of the item with the given [code]id[/code].
+ Returns the index of the item with the given [code]id[/code].
</description>
</method>
<method name="get_item_metadata" qualifiers="const">
@@ -95,14 +95,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the text of the item at index "idx".
+ Returns the text of the item at index "idx".
</description>
</method>
<method name="get_popup" qualifiers="const">
<return type="PopupMenu">
</return>
<description>
- Return the [PopupMenu] contained in this button.
+ Returns the [PopupMenu] contained in this button.
</description>
</method>
<method name="get_selected_id" qualifiers="const">
@@ -202,14 +202,14 @@
</members>
<signals>
<signal name="item_focused">
- <argument index="0" name="ID" type="int">
+ <argument index="0" name="id" type="int">
</argument>
<description>
This signal is emitted when user navigated to an item using [code]ui_up[/code] or [code]ui_down[/code] action. ID of the item selected is passed as argument.
</description>
</signal>
<signal name="item_selected">
- <argument index="0" name="ID" type="int">
+ <argument index="0" name="id" type="int">
</argument>
<description>
This signal is emitted when the current item was changed by the user. Index of the item selected is passed as argument.
diff --git a/doc/classes/PacketPeer.xml b/doc/classes/PacketPeer.xml
index 5a54c7ba1c..4109d9d462 100644
--- a/doc/classes/PacketPeer.xml
+++ b/doc/classes/PacketPeer.xml
@@ -13,7 +13,7 @@
<return type="int">
</return>
<description>
- Return the number of packets currently available in the ring-buffer.
+ Returns the number of packets currently available in the ring-buffer.
</description>
</method>
<method name="get_packet">
@@ -27,7 +27,7 @@
<return type="int" enum="Error">
</return>
<description>
- Return the error state of the last packet received (via [method get_packet] and [method get_var]).
+ Returns the error state of the last packet received (via [method get_packet] and [method get_var]).
</description>
</method>
<method name="get_var">
diff --git a/doc/classes/PacketPeerUDP.xml b/doc/classes/PacketPeerUDP.xml
index 5892eb17b7..9843c16108 100644
--- a/doc/classes/PacketPeerUDP.xml
+++ b/doc/classes/PacketPeerUDP.xml
@@ -20,21 +20,21 @@
<return type="String">
</return>
<description>
- Return the IP of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
+ Returns the IP of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
</description>
</method>
<method name="get_packet_port" qualifiers="const">
<return type="int">
</return>
<description>
- Return the port of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
+ Returns the port of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
</description>
</method>
<method name="is_listening" qualifiers="const">
<return type="bool">
</return>
<description>
- Return whether this [PacketPeerUDP] is listening.
+ Returns whether this [PacketPeerUDP] is listening.
</description>
</method>
<method name="listen">
diff --git a/doc/classes/Panel.xml b/doc/classes/Panel.xml
index 1cee2b5386..c9c3f80e7b 100644
--- a/doc/classes/Panel.xml
+++ b/doc/classes/Panel.xml
@@ -15,9 +15,5 @@
<theme_items>
<theme_item name="panel" type="StyleBox">
</theme_item>
- <theme_item name="panelf" type="StyleBox">
- </theme_item>
- <theme_item name="panelnc" type="StyleBox">
- </theme_item>
</theme_items>
</class>
diff --git a/doc/classes/Path2D.xml b/doc/classes/Path2D.xml
index c77e00a28e..ce15b3eab2 100644
--- a/doc/classes/Path2D.xml
+++ b/doc/classes/Path2D.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
Can have [PathFollow2D] child-nodes moving along the [Curve2D]. See [PathFollow2D] for more information on this usage.
+ Note that the path is considered as relative to the moved nodes (children of [PathFollow2D]) - usually the curve should start with a zero vector (0, 0).
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/Physics2DServer.xml
index 641e1898ff..172420e4ca 100644
--- a/doc/classes/Physics2DServer.xml
+++ b/doc/classes/Physics2DServer.xml
@@ -18,6 +18,8 @@
</argument>
<argument index="2" name="transform" type="Transform2D" default="Transform2D( 1, 0, 0, 1, 0, 0 )">
</argument>
+ <argument index="3" name="disabled" type="bool" default="false">
+ </argument>
<description>
Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
</description>
@@ -251,7 +253,7 @@
</argument>
<argument index="1" name="shape_idx" type="int">
</argument>
- <argument index="2" name="disable" type="bool">
+ <argument index="2" name="disabled" type="bool">
</argument>
<description>
Disables a given shape in an area.
@@ -346,6 +348,8 @@
</argument>
<argument index="2" name="transform" type="Transform2D" default="Transform2D( 1, 0, 0, 1, 0, 0 )">
</argument>
+ <argument index="3" name="disabled" type="bool" default="false">
+ </argument>
<description>
Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
</description>
@@ -746,7 +750,7 @@
</argument>
<argument index="1" name="shape_idx" type="int">
</argument>
- <argument index="2" name="disable" type="bool">
+ <argument index="2" name="disabled" type="bool">
</argument>
<description>
Disables shape in body if [code]disable[/code] is [code]true[/code].
diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody.xml
index 4d94c57ad1..fc4f2e18fd 100644
--- a/doc/classes/PhysicsBody.xml
+++ b/doc/classes/PhysicsBody.xml
@@ -32,7 +32,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Returns an individual bit on the collision mask.
+ Returns an individual bit on the [member collision_layer].
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -41,7 +41,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Returns an individual bit on the collision mask.
+ Returns an individual bit on the [member collision_mask].
</description>
</method>
<method name="remove_collision_exception_with">
@@ -61,7 +61,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
+ Sets individual bits on the [member collision_layer] bitmask. Use this if you only need to change one layer's value.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -72,18 +72,20 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
+ Sets individual bits on the [member collision_mask] bitmask. Use this if you only need to change one layer's value.
</description>
</method>
</methods>
<members>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
The physics layers this area is in.
- Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
+ Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the [member collision_mask] property.
A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
+ Default value: 1 (the first layer/bit is enabled).
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
The physics layers this area scans for collisions.
+ Default value: 1 (the first layer/bit is enabled).
</member>
</members>
<constants>
diff --git a/doc/classes/PhysicsBody2D.xml b/doc/classes/PhysicsBody2D.xml
index faa992ef7a..a5024c2432 100644
--- a/doc/classes/PhysicsBody2D.xml
+++ b/doc/classes/PhysicsBody2D.xml
@@ -32,7 +32,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Returns an individual bit on the collision mask.
+ Returns an individual bit on the [member collision_layer].
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -41,7 +41,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Returns an individual bit on the collision mask.
+ Returns an individual bit on the [member collision_mask].
</description>
</method>
<method name="remove_collision_exception_with">
@@ -61,7 +61,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
+ Sets individual bits on the [member collision_layer] bitmask. Use this if you only need to change one layer's value.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -72,18 +72,20 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
+ Sets individual bits on the [member collision_mask] bitmask. Use this if you only need to change one layer's value.
</description>
</method>
</methods>
<members>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
The physics layers this area is in.
- Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
+ Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the [member collision_mask] property.
A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
+ Default value: 1 (the first layer/bit is enabled).
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
The physics layers this area scans for collisions.
+ Default value: 1 (the first layer/bit is enabled).
</member>
<member name="layers" type="int" setter="_set_layers" getter="_get_layers">
Both [member collision_layer] and [member collision_mask]. Returns [member collision_layer] when accessed. Updates [member collision_layer] and [member collision_mask] when modified.
diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml
index 25869a853c..78a6ed8ac0 100644
--- a/doc/classes/PhysicsServer.xml
+++ b/doc/classes/PhysicsServer.xml
@@ -18,6 +18,8 @@
</argument>
<argument index="2" name="transform" type="Transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
</argument>
+ <argument index="3" name="disabled" type="bool" default="false">
+ </argument>
<description>
Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
</description>
@@ -246,6 +248,18 @@
Substitutes a given area shape by another. The old shape is selected by its index, the new one by its [RID].
</description>
</method>
+ <method name="area_set_shape_disabled">
+ <return type="void">
+ </return>
+ <argument index="0" name="area" type="RID">
+ </argument>
+ <argument index="1" name="shape_idx" type="int">
+ </argument>
+ <argument index="2" name="disabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="area_set_shape_transform">
<return type="void">
</return>
@@ -334,6 +348,8 @@
</argument>
<argument index="2" name="transform" type="Transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
</argument>
+ <argument index="3" name="disabled" type="bool" default="false">
+ </argument>
<description>
Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
</description>
@@ -750,6 +766,18 @@
Substitutes a given body shape by another. The old shape is selected by its index, the new one by its [RID].
</description>
</method>
+ <method name="body_set_shape_disabled">
+ <return type="void">
+ </return>
+ <argument index="0" name="body" type="RID">
+ </argument>
+ <argument index="1" name="shape_idx" type="int">
+ </argument>
+ <argument index="2" name="disabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="body_set_shape_transform">
<return type="void">
</return>
diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml
index f46cb243d7..cb99b660ae 100644
--- a/doc/classes/PoolByteArray.xml
+++ b/doc/classes/PoolByteArray.xml
@@ -116,14 +116,14 @@
<return type="String">
</return>
<description>
- Return SHA256 string of the PoolByteArray.
+ Returns SHA256 string of the PoolByteArray.
</description>
</method>
<method name="size">
<return type="int">
</return>
<description>
- Return the size of the array.
+ Returns the size of the array.
</description>
</method>
<method name="subarray">
diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml
index d16029a8d7..efc3582ba4 100644
--- a/doc/classes/PoolColorArray.xml
+++ b/doc/classes/PoolColorArray.xml
@@ -82,7 +82,7 @@
<return type="int">
</return>
<description>
- Return the size of the array.
+ Returns the size of the array.
</description>
</method>
</methods>
diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml
index 83d73c8a24..fca1083c25 100644
--- a/doc/classes/PoolIntArray.xml
+++ b/doc/classes/PoolIntArray.xml
@@ -82,7 +82,7 @@
<return type="int">
</return>
<description>
- Return the array size.
+ Returns the array size.
</description>
</method>
</methods>
diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml
index e1da99519c..c5f6062175 100644
--- a/doc/classes/PoolRealArray.xml
+++ b/doc/classes/PoolRealArray.xml
@@ -82,7 +82,7 @@
<return type="int">
</return>
<description>
- Return the size of the array.
+ Returns the size of the array.
</description>
</method>
</methods>
diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml
index 6ef4222996..01dca93be3 100644
--- a/doc/classes/PoolStringArray.xml
+++ b/doc/classes/PoolStringArray.xml
@@ -91,7 +91,7 @@
<return type="int">
</return>
<description>
- Return the size of the array.
+ Returns the size of the array.
</description>
</method>
</methods>
diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml
index 50ded06b90..45f619dc5d 100644
--- a/doc/classes/PoolVector2Array.xml
+++ b/doc/classes/PoolVector2Array.xml
@@ -82,7 +82,7 @@
<return type="int">
</return>
<description>
- Return the size of the array.
+ Returns the size of the array.
</description>
</method>
</methods>
diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml
index 69b4e54692..0a682e2baf 100644
--- a/doc/classes/PoolVector3Array.xml
+++ b/doc/classes/PoolVector3Array.xml
@@ -82,7 +82,7 @@
<return type="int">
</return>
<description>
- Return the size of the array.
+ Returns the size of the array.
</description>
</method>
</methods>
diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml
index 4924175b6e..d4f4834a66 100644
--- a/doc/classes/PopupMenu.xml
+++ b/doc/classes/PopupMenu.xml
@@ -178,14 +178,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the accelerator of the item at index "idx". Accelerators are special combinations of keys that activate the item, no matter which control is focused.
+ Returns the accelerator of the item at index "idx". Accelerators are special combinations of keys that activate the item, no matter which control is focused.
</description>
</method>
<method name="get_item_count" qualifiers="const">
<return type="int">
</return>
<description>
- Return the amount of items.
+ Returns the amount of items.
</description>
</method>
<method name="get_item_icon" qualifiers="const">
@@ -194,7 +194,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the icon of the item at index "idx".
+ Returns the icon of the item at index "idx".
</description>
</method>
<method name="get_item_id" qualifiers="const">
@@ -203,7 +203,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the id of the item at index "idx".
+ Returns the id of the item at index "idx".
</description>
</method>
<method name="get_item_index" qualifiers="const">
@@ -221,7 +221,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the metadata of an item, which might be of any type. You can set it with [method set_item_metadata], which provides a simple way of assigning context data to items.
+ Returns the metadata of an item, which might be of any type. You can set it with [method set_item_metadata], which provides a simple way of assigning context data to items.
</description>
</method>
<method name="get_item_shortcut" qualifiers="const">
@@ -238,7 +238,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the submenu name of the item at index "idx".
+ Returns the submenu name of the item at index "idx".
</description>
</method>
<method name="get_item_text" qualifiers="const">
@@ -247,7 +247,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the text of the item at index "idx".
+ Returns the text of the item at index "idx".
</description>
</method>
<method name="get_item_tooltip" qualifiers="const">
@@ -270,7 +270,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return whether the item at index "idx" is checkable in some way, i.e., whether has a checkbox or radio button. Note that checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
+ Returns whether the item at index "idx" is checkable in some way, i.e., whether has a checkbox or radio button. Note that checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
</description>
</method>
<method name="is_item_checked" qualifiers="const">
@@ -279,7 +279,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return whether the item at index "idx" is checked.
+ Returns whether the item at index "idx" is checked.
</description>
</method>
<method name="is_item_disabled" qualifiers="const">
@@ -288,7 +288,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return whether the item at index "idx" is disabled. When it is disabled it can't be selected, or its action invoked.
+ Returns whether the item at index "idx" is disabled. When it is disabled it can't be selected, or its action invoked.
</description>
</method>
<method name="is_item_radio_checkable" qualifiers="const">
@@ -297,7 +297,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return whether the item at index "idx" has radio-button-style checkability. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
+ Returns whether the item at index "idx" has radio-button-style checkability. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
</description>
</method>
<method name="is_item_separator" qualifiers="const">
@@ -306,7 +306,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return whether the item is a separator. If it is, it would be displayed as a line.
+ Returns whether the item is a separator. If it is, it would be displayed as a line.
</description>
</method>
<method name="is_item_shortcut_disabled" qualifiers="const">
@@ -527,14 +527,14 @@
</members>
<signals>
<signal name="id_focused">
- <argument index="0" name="ID" type="int">
+ <argument index="0" name="id" type="int">
</argument>
<description>
This event is emitted when user navigated to an item of some id using [code]ui_up[/code] or [code]ui_down[/code] action.
</description>
</signal>
<signal name="id_pressed">
- <argument index="0" name="ID" type="int">
+ <argument index="0" name="id" type="int">
</argument>
<description>
This event is emitted when an item of some id is pressed or its accelerator is activated.
diff --git a/doc/classes/PrismMesh.xml b/doc/classes/PrismMesh.xml
index 0d0f330647..4c282c5e8d 100644
--- a/doc/classes/PrismMesh.xml
+++ b/doc/classes/PrismMesh.xml
@@ -12,7 +12,7 @@
</methods>
<members>
<member name="left_to_right" type="float" setter="set_left_to_right" getter="get_left_to_right">
- Displacement of the upper edge along the x-axis. 0.0 positions edge straight above the bottome left edge. Defaults to 0.5 (positioned on the midpoint).
+ Displacement of the upper edge along the x-axis. 0.0 positions edge straight above the bottom left edge. Defaults to 0.5 (positioned on the midpoint).
</member>
<member name="size" type="Vector3" setter="set_size" getter="get_size">
Size of the prism. Defaults to (2.0, 2.0, 2.0).
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 46a4a70a9b..4b5500d077 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -281,7 +281,7 @@
If [code]true[/code], enables warnings when using a property as if it was a function.
</member>
<member name="debug/gdscript/warnings/return_value_discarded" type="bool" setter="" getter="">
- If [code]true[/code], enables warnings when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [Error] type.
+ If [code]true[/code], enables warnings when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [enum Error] enum.
</member>
<member name="debug/gdscript/warnings/shadowed_variable" type="bool" setter="" getter="">
If [code]true[/code], enables warnings when defining a local or subclass member variable that would shadow a variable at an upper level (such as a member variable).
@@ -717,7 +717,7 @@
Shaders have a time variable that constantly increases. At some point, it needs to be rolled back to zero to avoid precision errors on shader animations. This setting specifies when (in seconds).
</member>
<member name="rendering/quality/2d/gles2_use_nvidia_rect_flicker_workaround" type="bool" setter="" getter="">
- Some NVIDIA GPU drivers have a bug which produces flickering issues for the [code]draw_rect[/code] method, especially as used in [TileMap]. Refer to [url]https://github.com/godotengine/godot/issues/9913[/url] for details.
+ Some NVIDIA GPU drivers have a bug which produces flickering issues for the [code]draw_rect[/code] method, especially as used in [TileMap]. Refer to [url=https://github.com/godotengine/godot/issues/9913][/url] for details.
If [code]true[/code], this option enables a "safe" code path for such NVIDIA GPUs at the cost of performance. This option only impacts the GLES2 rendering backend (so the bug stays if you use GLES3), and only desktop platforms.
</member>
<member name="rendering/quality/2d/use_pixel_snap" type="bool" setter="" getter="">
diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml
index f7134e580d..3ef65e1edb 100644
--- a/doc/classes/Quat.xml
+++ b/doc/classes/Quat.xml
@@ -84,7 +84,7 @@
<return type="Vector3">
</return>
<description>
- Return Euler angles (in the YXZ convention: first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X-angle, Y-angle, Z-angle).
+ Returns Euler angles (in the YXZ convention: first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X-angle, Y-angle, Z-angle).
</description>
</method>
<method name="inverse">
diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml
index 1d2999a1ed..1368143b67 100644
--- a/doc/classes/RayCast.xml
+++ b/doc/classes/RayCast.xml
@@ -50,7 +50,7 @@
<return type="Object">
</return>
<description>
- Return the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
+ Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
</description>
</method>
<method name="get_collider_shape" qualifiers="const">
@@ -87,7 +87,7 @@
<return type="bool">
</return>
<description>
- Return whether any object is intersecting with the ray's vector (considering the vector length).
+ Returns whether any object is intersecting with the ray's vector (considering the vector length).
</description>
</method>
<method name="remove_exception">
diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml
index 7a16e9e5e0..90e0178ddb 100644
--- a/doc/classes/RayCast2D.xml
+++ b/doc/classes/RayCast2D.xml
@@ -49,7 +49,7 @@
<return type="Object">
</return>
<description>
- Return the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
+ Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
</description>
</method>
<method name="get_collider_shape" qualifiers="const">
@@ -65,7 +65,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Return an individual bit on the collision mask.
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="get_collision_normal" qualifiers="const">
@@ -86,7 +86,7 @@
<return type="bool">
</return>
<description>
- Return whether any object is intersecting with the ray's vector (considering the vector length).
+ Returns whether any object is intersecting with the ray's vector (considering the vector length).
</description>
</method>
<method name="remove_exception">
diff --git a/doc/classes/ResourceInteractiveLoader.xml b/doc/classes/ResourceInteractiveLoader.xml
index 6b37cb25fb..bb9826999c 100644
--- a/doc/classes/ResourceInteractiveLoader.xml
+++ b/doc/classes/ResourceInteractiveLoader.xml
@@ -13,21 +13,21 @@
<return type="Resource">
</return>
<description>
- Return the loaded resource (only if loaded). Otherwise, returns null.
+ Returns the loaded resource (only if loaded). Otherwise, returns null.
</description>
</method>
<method name="get_stage" qualifiers="const">
<return type="int">
</return>
<description>
- Return 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">
<return type="int">
</return>
<description>
- Return the total amount of stages (calls to [method poll]) needed to completely load this resource.
+ Returns the total amount of stages (calls to [method poll]) needed to completely load this resource.
</description>
</method>
<method name="poll">
diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml
index 70deb4509f..76b7c39191 100644
--- a/doc/classes/ResourceLoader.xml
+++ b/doc/classes/ResourceLoader.xml
@@ -33,7 +33,7 @@
<argument index="0" name="type" type="String">
</argument>
<description>
- Return the list of recognized extensions for a resource type.
+ Returns the list of recognized extensions for a resource type.
</description>
</method>
<method name="has">
diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml
index 25b896ec3a..9ea6bb0fe1 100644
--- a/doc/classes/RigidBody.xml
+++ b/doc/classes/RigidBody.xml
@@ -86,7 +86,7 @@
<return type="Array">
</return>
<description>
- Return a list of the bodies colliding with this one. By default, number of max contacts reported is at 0, see the [member contacts_reported] property to increase it. Note that the result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead.
+ Returns a list of the bodies colliding with this one. By default, number of max contacts reported is at 0, see the [member contacts_reported] property to increase it. Note that the result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead.
</description>
</method>
<method name="set_axis_velocity">
diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml
index 16ee1a444c..9a1802b515 100644
--- a/doc/classes/RigidBody2D.xml
+++ b/doc/classes/RigidBody2D.xml
@@ -7,7 +7,8 @@
This node implements simulated 2D physics. You do not control a RigidBody2D directly. Instead you apply forces to it (gravity, impulses, etc.) and the physics simulation calculates the resulting movement based on its mass, friction, and other physical properties.
A RigidBody2D has 4 behavior [member mode]s: Rigid, Static, Character, and Kinematic.
[b]Note:[/b] You should not change a RigidBody2D's [code]position[/code] or [code]linear_velocity[/code] every frame or even very often. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state.
- If you need to override the default physics behavior, you can write a custom force integration. See [member custom_integrator].
+ Please also keep in mind that physics bodies manage their own transform which overwrites the ones you set. So any direct or indirect transformation (including scaling of the node or its parent) will be visible in the editor only, and immediately reset at runtime.
+ If you need to override the default physics behavior or add a transformation at runtime, you can write a custom force integration. See [member custom_integrator].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml
index 666ab15802..28e1f75ac1 100644
--- a/doc/classes/ScriptEditor.xml
+++ b/doc/classes/ScriptEditor.xml
@@ -55,6 +55,15 @@
Returns an array with all [Script] objects which are currently open in editor.
</description>
</method>
+ <method name="goto_line">
+ <return type="void">
+ </return>
+ <argument index="0" name="line_number" type="int">
+ </argument>
+ <description>
+ Goes to the specified line in the current script.
+ </description>
+ </method>
<method name="open_script_create_dialog">
<return type="void">
</return>
diff --git a/doc/classes/Shape2D.xml b/doc/classes/Shape2D.xml
index dec3c2b43c..c887e23de0 100644
--- a/doc/classes/Shape2D.xml
+++ b/doc/classes/Shape2D.xml
@@ -52,7 +52,7 @@
<argument index="4" name="shape_motion" type="Vector2">
</argument>
<description>
- Return whether this shape would collide with another, if a given movement was applied.
+ Returns whether this shape would collide with another, if a given movement was applied.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the movement to test on this shape ([code]local_motion[/code]), the shape to check collisions with ([code]with_shape[/code]), the transformation matrix of that shape ([code]shape_xform[/code]), and the movement to test onto the other object ([code]shape_motion[/code]).
</description>
</method>
diff --git a/doc/classes/Skeleton.xml b/doc/classes/Skeleton.xml
index 8fab778a48..b693ee0a5e 100644
--- a/doc/classes/Skeleton.xml
+++ b/doc/classes/Skeleton.xml
@@ -44,14 +44,14 @@
<argument index="0" name="name" type="String">
</argument>
<description>
- Return the bone index that matches "name" as its name.
+ Returns the bone index that matches "name" as its name.
</description>
</method>
<method name="get_bone_count" qualifiers="const">
<return type="int">
</return>
<description>
- Return the amount of bones in the skeleton.
+ Returns the amount of bones in the skeleton.
</description>
</method>
<method name="get_bone_custom_pose" qualifiers="const">
@@ -60,7 +60,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the custom pose of the specified bone. Custom pose is applied on top of the rest pose.
+ Returns the custom pose of the specified bone. Custom pose is applied on top of the rest pose.
</description>
</method>
<method name="get_bone_global_pose" qualifiers="const">
@@ -69,7 +69,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the overall transform of the specified bone, with respect to the skeleton. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.
+ Returns the overall transform of the specified bone, with respect to the skeleton. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.
</description>
</method>
<method name="get_bone_name" qualifiers="const">
@@ -78,7 +78,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the name of the bone at index "index".
+ Returns the name of the bone at index "index".
</description>
</method>
<method name="get_bone_parent" qualifiers="const">
@@ -87,7 +87,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the bone index which is the parent of the bone at "bone_idx". If -1, then bone has no parent. Note that the parent bone returned will always be less than "bone_idx".
+ Returns the bone index which is the parent of the bone at "bone_idx". If -1, then bone has no parent. Note that the parent bone returned will always be less than "bone_idx".
</description>
</method>
<method name="get_bone_pose" qualifiers="const">
@@ -96,7 +96,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the pose transform of the specified bone. Pose is applied on top of the custom pose, which is applied on top the rest pose.
+ Returns the pose transform of the specified bone. Pose is applied on top of the custom pose, which is applied on top the rest pose.
</description>
</method>
<method name="get_bone_rest" qualifiers="const">
@@ -105,7 +105,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the rest transform for a bone "bone_idx".
+ Returns the rest transform for a bone "bone_idx".
</description>
</method>
<method name="get_bone_transform" qualifiers="const">
@@ -114,7 +114,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the combination of custom pose and pose. The returned transform is in skeleton's reference frame.
+ Returns the combination of custom pose and pose. The returned transform is in skeleton's reference frame.
</description>
</method>
<method name="get_bound_child_nodes_to_bone" qualifiers="const">
@@ -229,7 +229,7 @@
<argument index="1" name="pose" type="Transform">
</argument>
<description>
- Return the pose transform for bone "bone_idx".
+ Returns the pose transform for bone "bone_idx".
</description>
</method>
<method name="set_bone_rest">
diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml
index cc5fe93567..26ff67cc74 100644
--- a/doc/classes/Sprite.xml
+++ b/doc/classes/Sprite.xml
@@ -13,7 +13,13 @@
<return type="Rect2">
</return>
<description>
- Returns a Rect2 representing the Sprite's boundary relative to its local coordinates.
+ Returns a [Rect2] representing the Sprite's boundary in local coordinates. Can be used to detect if the Sprite was clicked. Example:
+ [codeblock]
+ func _input(event):
+ if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT:
+ if get_rect().has_point(to_local(event.position)):
+ print("A click!")
+ [/codeblock]
</description>
</method>
<method name="is_pixel_opaque" qualifiers="const">
@@ -48,7 +54,7 @@
The texture's drawing offset.
</member>
<member name="region_enabled" type="bool" setter="set_region" getter="is_region">
- If [code]true[/code], texture is cut from a larger atlas texture. See [code]region_rect[/code]. Default value: [code]false[/code].
+ If [code]true[/code], texture is cut from a larger atlas texture. See [member region_rect]. Default value: [code]false[/code].
</member>
<member name="region_filter_clip" type="bool" setter="set_region_filter_clip" getter="is_region_filter_clip_enabled">
If [code]true[/code], the outermost pixels get blurred out.
diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml
index af8e43944c..d278312fc3 100644
--- a/doc/classes/StreamPeer.xml
+++ b/doc/classes/StreamPeer.xml
@@ -41,7 +41,7 @@
<return type="int">
</return>
<description>
- Return the amount of bytes this [StreamPeer] has available.
+ Returns the amount of bytes this [StreamPeer] has available.
</description>
</method>
<method name="get_data">
@@ -50,7 +50,7 @@
<argument index="0" name="bytes" type="int">
</argument>
<description>
- Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an Error code and a data array.
+ Returns a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an Error code and a data array.
</description>
</method>
<method name="get_double">
@@ -73,7 +73,7 @@
<argument index="0" name="bytes" type="int">
</argument>
<description>
- Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an Error code, and a data array.
+ Returns a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an Error code, and a data array.
</description>
</method>
<method name="get_string">
diff --git a/doc/classes/StreamPeerSSL.xml b/doc/classes/StreamPeerSSL.xml
index f7fd36ed58..f28e6e5544 100644
--- a/doc/classes/StreamPeerSSL.xml
+++ b/doc/classes/StreamPeerSSL.xml
@@ -42,7 +42,7 @@
<return type="int" enum="StreamPeerSSL.Status">
</return>
<description>
- Return the status of the connection, one of STATUS_* enum.
+ Returns the status of the connection, one of STATUS_* enum.
</description>
</method>
<method name="poll">
diff --git a/doc/classes/StreamPeerTCP.xml b/doc/classes/StreamPeerTCP.xml
index 16bf69110d..0edea42521 100644
--- a/doc/classes/StreamPeerTCP.xml
+++ b/doc/classes/StreamPeerTCP.xml
@@ -31,21 +31,21 @@
<return type="String">
</return>
<description>
- Return the IP of this peer.
+ Returns the IP of this peer.
</description>
</method>
<method name="get_connected_port" qualifiers="const">
<return type="int">
</return>
<description>
- Return the port of this peer.
+ Returns the port of this peer.
</description>
</method>
<method name="get_status">
<return type="int" enum="StreamPeerTCP.Status">
</return>
<description>
- Return the status of the connection, see [enum StreamPeerTCP.Status].
+ Returns the status of the connection, see [enum StreamPeerTCP.Status].
</description>
</method>
<method name="is_connected_to_host" qualifiers="const">
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index 526a9427dc..e06f0738b8 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -7,6 +7,7 @@
This is the built-in string class (and the one used by GDScript). It supports Unicode and provides all necessary means for string handling. Strings are reference counted and use a copy-on-write approach, so passing them around is cheap in resources.
</description>
<tutorials>
+ <link>https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_format_string.html</link>
</tutorials>
<methods>
<method name="String">
diff --git a/doc/classes/StyleBox.xml b/doc/classes/StyleBox.xml
index 40cb2632b6..a156f134e7 100644
--- a/doc/classes/StyleBox.xml
+++ b/doc/classes/StyleBox.xml
@@ -37,7 +37,7 @@
<argument index="0" name="margin" type="int" enum="Margin">
</argument>
<description>
- Return the content margin offset for the specified margin
+ Returns the content margin offset for the specified margin
Positive values reduce size inwards, unlike [Control]'s margin values.
</description>
</method>
@@ -45,14 +45,14 @@
<return type="Vector2">
</return>
<description>
- Return the minimum size that this stylebox can be shrunk to.
+ Returns the minimum size that this stylebox can be shrunk to.
</description>
</method>
<method name="get_offset" qualifiers="const">
<return type="Vector2">
</return>
<description>
- Return the "offset" of a stylebox, this is a helper function, like writing [code]Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))[/code].
+ Returns the "offset" of a stylebox, this is a helper function, like writing [code]Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))[/code].
</description>
</method>
<method name="test_mask" qualifiers="const">
diff --git a/doc/classes/TCP_Server.xml b/doc/classes/TCP_Server.xml
index ac9b33bc34..663d3248e8 100644
--- a/doc/classes/TCP_Server.xml
+++ b/doc/classes/TCP_Server.xml
@@ -13,7 +13,7 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if a connection is available for taking.
+ Returns [code]true[/code] if a connection is available for taking.
</description>
</method>
<method name="listen">
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index fa78fbe305..eb70d7a1c3 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -69,14 +69,14 @@
<return type="int">
</return>
<description>
- Return the column the editing cursor is at.
+ Returns the column the editing cursor is at.
</description>
</method>
<method name="cursor_get_line" qualifiers="const">
<return type="int">
</return>
<description>
- Return the line the editing cursor is at.
+ Returns the line the editing cursor is at.
</description>
</method>
<method name="cursor_set_column">
@@ -137,7 +137,7 @@
<return type="Array">
</return>
<description>
- Return an array containing the line number of each breakpoint.
+ Returns an array containing the line number of each breakpoint.
</description>
</method>
<method name="get_keyword_color" qualifiers="const">
@@ -154,14 +154,14 @@
<argument index="0" name="line" type="int">
</argument>
<description>
- Return the text of a specific line.
+ Returns the text of a specific line.
</description>
</method>
<method name="get_line_count" qualifiers="const">
<return type="int">
</return>
<description>
- Return the amount of total lines in the text.
+ Returns the amount of total lines in the text.
</description>
</method>
<method name="get_menu" qualifiers="const">
@@ -175,35 +175,35 @@
<return type="int">
</return>
<description>
- Return the selection begin column.
+ Returns the selection begin column.
</description>
</method>
<method name="get_selection_from_line" qualifiers="const">
<return type="int">
</return>
<description>
- Return the selection begin line.
+ Returns the selection begin line.
</description>
</method>
<method name="get_selection_text" qualifiers="const">
<return type="String">
</return>
<description>
- Return the text inside the selection.
+ Returns the text inside the selection.
</description>
</method>
<method name="get_selection_to_column" qualifiers="const">
<return type="int">
</return>
<description>
- Return the selection end column.
+ Returns the selection end column.
</description>
</method>
<method name="get_selection_to_line" qualifiers="const">
<return type="int">
</return>
<description>
- Return the selection end line.
+ Returns the selection end line.
</description>
</method>
<method name="get_word_under_cursor" qualifiers="const">
@@ -250,7 +250,7 @@
<return type="bool">
</return>
<description>
- Return [code]true[/code] if the selection is active.
+ Returns [code]true[/code] if the selection is active.
</description>
</method>
<method name="menu_option">
@@ -382,6 +382,9 @@
<member name="context_menu_enabled" type="bool" setter="set_context_menu_enabled" getter="is_context_menu_enabled">
If [code]true[/code], a right click displays the context menu.
</member>
+ <member name="draw_spaces" type="bool" setter="set_draw_spaces" getter="is_drawing_spaces">
+ If [code]true[/code], the "space" character will have a visible representation.
+ </member>
<member name="draw_tabs" type="bool" setter="set_draw_tabs" getter="is_drawing_tabs">
If [code]true[/code], the "tab" character will have a visible representation.
</member>
@@ -494,6 +497,8 @@
<theme_items>
<theme_item name="background_color" type="Color">
</theme_item>
+ <theme_item name="bookmark_color" type="Color">
+ </theme_item>
<theme_item name="brace_mismatch_color" type="Color">
</theme_item>
<theme_item name="breakpoint_color" type="Color">
@@ -524,8 +529,14 @@
</theme_item>
<theme_item name="current_line_color" type="Color">
</theme_item>
+ <theme_item name="executing_line_color" type="Color">
+ </theme_item>
<theme_item name="focus" type="StyleBox">
</theme_item>
+ <theme_item name="fold" type="Texture">
+ </theme_item>
+ <theme_item name="folded" type="Texture">
+ </theme_item>
<theme_item name="font" type="Font">
</theme_item>
<theme_item name="font_color" type="Color">
@@ -552,6 +563,8 @@
</theme_item>
<theme_item name="selection_color" type="Color">
</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">
diff --git a/doc/classes/Texture.xml b/doc/classes/Texture.xml
index 39f3ee447c..4418a6ce8f 100644
--- a/doc/classes/Texture.xml
+++ b/doc/classes/Texture.xml
@@ -74,21 +74,21 @@
<return type="int">
</return>
<description>
- Return the texture height.
+ Returns the texture height.
</description>
</method>
<method name="get_size" qualifiers="const">
<return type="Vector2">
</return>
<description>
- Return the texture size.
+ Returns the texture size.
</description>
</method>
<method name="get_width" qualifiers="const">
<return type="int">
</return>
<description>
- Return the texture width.
+ Returns the texture width.
</description>
</method>
<method name="has_alpha" qualifiers="const">
diff --git a/doc/classes/Theme.xml b/doc/classes/Theme.xml
index bc44ec161a..c14e098b12 100644
--- a/doc/classes/Theme.xml
+++ b/doc/classes/Theme.xml
@@ -8,6 +8,7 @@
Theme resources can be alternatively loaded by writing them in a .theme file, see docs for more info.
</description>
<tutorials>
+ <link>https://docs.godotengine.org/en/stable/tutorials/gui/gui_skinning.html</link>
</tutorials>
<methods>
<method name="clear">
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index e6fb32a032..75221ccc82 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -216,7 +216,7 @@
<argument index="0" name="phi" type="float">
</argument>
<description>
- Returns the vector rotated by [code]phi[/code] radians.
+ Returns the vector rotated by [code]phi[/code] radians. See also [method @GDScript.deg2rad].
</description>
</method>
<method name="round">
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index b48dc9de35..53e66cee74 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -253,6 +253,9 @@
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process. Default value: [code]false[/code].
</member>
+ <member name="render_direct_to_screen" type="bool" setter="set_use_render_direct_to_screen" getter="is_using_render_direct_to_screen">
+ If [code]true[/code], renders the Viewport directly to the screen instead of to the root viewport. Only available in GLES2. This is a low-level optimization and should not be used in most cases. If used, reading from the Viewport or from [code]SCREEN_TEXTURE[/code] becomes unavailable. For more information see [method VisualServer.viewport_set_render_direct_to_screen]. Default value: [code]false[/code].
+ </member>
<member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="Viewport.ClearMode">
The clear mode when viewport used as a render target. Default value: [code]CLEAR_MODE_ALWAYS[/code].
</member>
diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml
index 87bf0b79b6..3563120f0f 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/VisualServer.xml
@@ -2085,6 +2085,17 @@
<description>
</description>
</method>
+ <method name="light_set_use_gi">
+ <return type="void">
+ </return>
+ <argument index="0" name="light" type="RID">
+ </argument>
+ <argument index="1" name="enabled" type="bool">
+ </argument>
+ <description>
+ Sets whether GI probes capture light information from this light.
+ </description>
+ </method>
<method name="lightmap_capture_create">
<return type="RID">
</return>
@@ -3579,7 +3590,14 @@
<argument index="2" name="screen" type="int" default="0">
</argument>
<description>
- Attaches a viewport to a screen.
+ Copies viewport to a region of the screen specified by [code]rect[/code]. If Viewport.[member Viewport.render_direct_to_screen] is [code]true[/code], then viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
+ For example, you can set the root viewport to not render at all with the following code:
+ [codeblock]
+ func _ready():
+ get_viewport().set_attach_to_screen_rect(Rect2())
+ $Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600))
+ [/codeblock]
+ Using this can result in significant optimization, especially on lower-end devices. However, it comes at the cost of having to manage your viewports manually. For a further optimization see, [method set_render_direct_to_screen].
</description>
</method>
<method name="viewport_create">
@@ -3778,6 +3796,17 @@
Sets the viewport's parent to another viewport.
</description>
</method>
+ <method name="viewport_set_render_direct_to_screen">
+ <return type="void">
+ </return>
+ <argument index="0" name="viewport" type="RID">
+ </argument>
+ <argument index="1" name="enabled" type="bool">
+ </argument>
+ <description>
+ If [code]true[/code], render the contents of the viewport directly to screen. This allows a low-level optimization where you can skip drawing a viewport to the root viewport. While this optimization can result in a significant increase in speed (especially on older devices), it comes at a cost of usability. When this is enabled, you cannot read from the viewport or from the [code]SCREEN_TEXTURE[/code]. You also lose the benefit of certain window settings, such as the various stretch modes. Another consequence to be aware of is that in 2D the rendering happens in window coordinates, so if you have a viewport that is double the size of the window, and you set this, then only the portion that fits within the window will be drawn, no automatic scaling is possible, even if your game scene is significantly larger than the window size.
+ </description>
+ </method>
<method name="viewport_set_scenario">
<return type="void">
</return>
diff --git a/modules/gdnative/doc_classes/WebRTCPeerGDNative.xml b/doc/classes/VisualShaderNodeFresnel.xml
index 478889e031..2484a44fcd 100644
--- a/modules/gdnative/doc_classes/WebRTCPeerGDNative.xml
+++ b/doc/classes/VisualShaderNodeFresnel.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebRTCPeerGDNative" inherits="WebRTCPeer" category="Core" version="3.2">
+<class name="VisualShaderNodeFresnel" inherits="VisualShaderNode" category="Core" version="3.2">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/VisualShaderNodeScalarFunc.xml b/doc/classes/VisualShaderNodeScalarFunc.xml
index 163276b3bc..b0ee422bbd 100644
--- a/doc/classes/VisualShaderNodeScalarFunc.xml
+++ b/doc/classes/VisualShaderNodeScalarFunc.xml
@@ -75,5 +75,7 @@
</constant>
<constant name="FUNC_TRUNC" value="30" enum="Function">
</constant>
+ <constant name="FUNC_ONEMINUS" value="31" enum="Function">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeVectorFunc.xml b/doc/classes/VisualShaderNodeVectorFunc.xml
index 71ce32c04e..e67cb2e07f 100644
--- a/doc/classes/VisualShaderNodeVectorFunc.xml
+++ b/doc/classes/VisualShaderNodeVectorFunc.xml
@@ -81,5 +81,7 @@
</constant>
<constant name="FUNC_TRUNC" value="33" enum="Function">
</constant>
+ <constant name="FUNC_ONEMINUS" value="34" enum="Function">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/WindowDialog.xml b/doc/classes/WindowDialog.xml
index 16b7bd84ad..c5d66af984 100644
--- a/doc/classes/WindowDialog.xml
+++ b/doc/classes/WindowDialog.xml
@@ -13,7 +13,7 @@
<return type="TextureButton">
</return>
<description>
- Return the close [TextureButton].
+ Returns the close [TextureButton].
</description>
</method>
</methods>
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index e81b4db13e..c3e15b2f9a 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -683,10 +683,16 @@ def rstize_text(text, state): # type: (str, State) -> str
# Handle [tags]
inside_code = False
+ inside_url = False
+ url_has_name = False
+ url_link = ""
pos = 0
tag_depth = 0
+ previous_pos = 0
while True:
pos = text.find('[', pos)
+ if inside_url and (pos > previous_pos):
+ url_has_name = True
if pos == -1:
break
@@ -795,12 +801,16 @@ def rstize_text(text, state): # type: (str, State) -> str
elif cmd.find('image=') == 0:
tag_text = "" # '![](' + cmd[6:] + ')'
elif cmd.find('url=') == 0:
- tag_text = ':ref:`' + cmd[4:] + '<' + cmd[4:] + ">`"
+ url_link = cmd[4:]
+ tag_text = ':ref:`'
tag_depth += 1
+ url_has_name = False
+ inside_url = True
elif cmd == '/url':
- tag_text = ''
+ tag_text = ('' if url_has_name else url_link) + '<' + url_link + ">`"
tag_depth -= 1
escape_post = True
+ inside_url = False
elif cmd == 'center':
tag_depth += 1
tag_text = ''
@@ -871,6 +881,7 @@ def rstize_text(text, state): # type: (str, State) -> str
text = pre_text + tag_text + post_text
pos = len(pre_text) + len(tag_text)
+ previous_pos = pos
if tag_depth > 0:
print_error("Tag depth mismatch: too many/little open/close tags, file: {}".format(state.current_class), state)
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index c0e07e0b8d..253936ca34 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -484,6 +484,7 @@ public:
void light_set_negative(RID p_light, bool p_enable) {}
void light_set_cull_mask(RID p_light, uint32_t p_mask) {}
void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {}
+ void light_set_use_gi(RID p_light, bool p_enabled) {}
void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {}
void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {}
@@ -503,6 +504,7 @@ public:
AABB light_get_aabb(RID p_light) const { return AABB(); }
float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; }
Color light_get_color(RID p_light) { return Color(); }
+ bool light_get_use_gi(RID p_light) { return false; }
uint64_t light_get_version(RID p_light) const { return 0; }
/* PROBE API */
@@ -690,6 +692,7 @@ public:
/* RENDER TARGET */
RID render_target_create() { return RID(); }
+ void render_target_set_position(RID p_render_target, int p_x, int p_y) {}
void render_target_set_size(RID p_render_target, int p_width, int p_height) {}
RID render_target_get_texture(RID p_render_target) const { return RID(); }
void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) {}
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index efb26a7908..ef5b57a0cc 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -10,7 +10,7 @@ if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env.Append(CPPPATH=[thirdparty_dir])
+ env.Prepend(CPPPATH=[thirdparty_dir])
env.Append(CPPFLAGS=['-DGLAD_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_OVER_GL'])
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 7232d2d95a..ee722e9d6c 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -113,9 +113,22 @@ void RasterizerCanvasGLES2::canvas_begin() {
state.canvas_shader.bind();
state.using_transparent_rt = false;
+ int viewport_x, viewport_y, viewport_width, viewport_height;
+
if (storage->frame.current_rt) {
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
state.using_transparent_rt = storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT];
+
+ if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ // set Viewport and Scissor when rendering directly to screen
+ viewport_width = storage->frame.current_rt->width;
+ viewport_height = storage->frame.current_rt->height;
+ viewport_x = storage->frame.current_rt->x;
+ viewport_y = OS::get_singleton()->get_window_size().height - viewport_height - storage->frame.current_rt->y;
+ glScissor(viewport_x, viewport_y, viewport_width, viewport_height);
+ glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
+ glEnable(GL_SCISSOR_TEST);
+ }
}
if (storage->frame.clear_request) {
@@ -179,6 +192,14 @@ void RasterizerCanvasGLES2::canvas_end() {
glDisableVertexAttribArray(i);
}
+ if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ //reset viewport to full window size
+ int viewport_width = OS::get_singleton()->get_window_size().width;
+ int viewport_height = OS::get_singleton()->get_window_size().height;
+ glViewport(0, 0, viewport_width, viewport_height);
+ glScissor(0, 0, viewport_width, viewport_height);
+ }
+
state.using_texture_rect = false;
state.using_skeleton = false;
state.using_ninepatch = false;
@@ -1192,6 +1213,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
void RasterizerCanvasGLES2::_copy_screen(const Rect2 &p_rect) {
+ if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ ERR_PRINT_ONCE("Cannot use screen texture copying in render target set to render direct to screen");
+ return;
+ }
+
if (storage->frame.current_rt->copy_screen_effect.color == 0) {
ERR_EXPLAIN("Can't use screen texture copying in a render target configured without copy buffers");
ERR_FAIL();
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index d3c6b041a8..f49f52e47b 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -202,6 +202,10 @@ Error RasterizerGLES2::is_viable() {
return ERR_UNAVAILABLE;
}
}
+
+ if (GLAD_GL_EXT_framebuffer_multisample) {
+ glRenderbufferStorageMultisample = glRenderbufferStorageMultisampleEXT;
+ }
#endif // GLES_OVER_GL
#endif // GLAD_ENABLED
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 9f1425189c..268b0f1c90 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -42,6 +42,16 @@
#define glClearDepth glClearDepthf
#endif
+#ifndef GLES_OVER_GL
+#ifdef IPHONE_ENABLED
+#include <OpenGLES/ES2/glext.h>
+//void *glResolveMultisampleFramebufferAPPLE;
+
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#endif
+#endif
+
static const GLenum _cube_side_enum[6] = {
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
@@ -570,7 +580,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
//the approach below is fatal for powervr
- // Set the initial (empty) mipmaps, all need to be set for this to work in GLES2, even if later wont be used.
+ // Set the initial (empty) mipmaps, all need to be set for this to work in GLES2, even if they won't be used later.
while (size >= 1) {
for (int i = 0; i < 6; i++) {
@@ -1001,7 +1011,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
has_alpha = false;
}
- RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element();
+ RenderList::Element *e = (has_alpha || p_material->shader->spatial.no_depth_test) ? render_list.add_alpha_element() : render_list.add_element();
if (!e) {
return;
@@ -1148,6 +1158,30 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
}
}
+void RasterizerSceneGLES2::_copy_texture_to_front_buffer(GLuint p_texture) {
+
+ //copy to front buffer
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
+
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthFunc(GL_LEQUAL);
+ glColorMask(1, 1, 1, 1);
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, p_texture);
+
+ glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height);
+
+ storage->shaders.copy.bind();
+
+ storage->bind_quad_array();
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
+
void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass, bool p_shadow_pass) {
render_pass++;
@@ -2435,6 +2469,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
if (p_env) {
state.scene_shader.set_uniform(SceneShaderGLES2::BG_ENERGY, p_env->bg_energy);
+ state.scene_shader.set_uniform(SceneShaderGLES2::BG_COLOR, p_env->bg_color);
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_SKY_CONTRIBUTION, p_env->ambient_sky_contribution);
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_COLOR, p_env->ambient_color);
@@ -2442,6 +2477,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
} else {
state.scene_shader.set_uniform(SceneShaderGLES2::BG_ENERGY, 1.0);
+ state.scene_shader.set_uniform(SceneShaderGLES2::BG_COLOR, state.default_bg);
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_SKY_CONTRIBUTION, 1.0);
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_COLOR, state.default_ambient);
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_ENERGY, 1.0);
@@ -2544,7 +2580,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
state.scene_shader.set_conditional(SceneShaderGLES2::USE_LIGHTMAP_CAPTURE, false);
state.scene_shader.set_conditional(SceneShaderGLES2::FOG_DEPTH_ENABLED, false);
state.scene_shader.set_conditional(SceneShaderGLES2::FOG_HEIGHT_ENABLED, false);
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_RADIANCE_MAP, false);
state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, false);
}
@@ -2660,6 +2695,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
Environment *env = NULL;
int viewport_width, viewport_height;
+ int viewport_x, viewport_y;
bool probe_interior = false;
bool reverse_cull = false;
@@ -2689,12 +2725,23 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
if (storage->frame.current_rt->external.fbo != 0) {
current_fb = storage->frame.current_rt->external.fbo;
} else {
- current_fb = storage->frame.current_rt->fbo;
+ if (storage->frame.current_rt->multisample_active) {
+ current_fb = storage->frame.current_rt->multisample_fbo;
+ } else {
+ current_fb = storage->frame.current_rt->fbo;
+ }
}
env = environment_owner.getornull(p_environment);
viewport_width = storage->frame.current_rt->width;
viewport_height = storage->frame.current_rt->height;
+ viewport_x = storage->frame.current_rt->x;
+
+ if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ viewport_y = OS::get_singleton()->get_window_size().height - viewport_height - storage->frame.current_rt->y;
+ } else {
+ viewport_y = storage->frame.current_rt->y;
+ }
}
state.used_screen_texture = false;
@@ -2760,7 +2807,13 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
// other stuff
glBindFramebuffer(GL_FRAMEBUFFER, current_fb);
- glViewport(0, 0, viewport_width, viewport_height);
+ glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
+
+ if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
+
+ glScissor(viewport_x, viewport_y, viewport_width, viewport_height);
+ glEnable(GL_SCISSOR_TEST);
+ }
glDepthFunc(GL_LEQUAL);
glDepthMask(GL_TRUE);
@@ -2791,9 +2844,14 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
}
state.default_ambient = Color(clear_color.r, clear_color.g, clear_color.b, 1.0);
+ state.default_bg = Color(clear_color.r, clear_color.g, clear_color.b, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ glDisable(GL_SCISSOR_TEST);
+ }
+
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
glBlendEquation(GL_FUNC_ADD);
@@ -2820,37 +2878,86 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
}
}
- if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
-
- if (sky && sky->panorama.is_valid()) {
- _draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
- }
- }
-
if (probe_interior) {
env_radiance_tex = 0; //do not use radiance texture on interiors
state.default_ambient = Color(0, 0, 0, 1); //black as default ambient for interior
+ state.default_bg = Color(0, 0, 0, 1); //black as default background for interior
}
// render opaque things first
render_list.sort_by_key(false);
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false);
+ // then draw the sky after
+ if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
+
+ if (sky && sky->panorama.is_valid()) {
+ _draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
+ }
+ }
+
if (storage->frame.current_rt && state.used_screen_texture) {
//copy screen texture
+
+ if (storage->frame.current_rt && storage->frame.current_rt->multisample_active) {
+ // Resolve framebuffer to front buffer before copying
+#ifdef GLES_OVER_GL
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo);
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo);
+ glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+#elif IPHONE_ENABLED
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo);
+ glResolveMultisampleFramebufferAPPLE();
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+#else
+ // In GLES2 Blit is not available, so just copy color texture manually
+ _copy_texture_to_front_buffer(storage->frame.current_rt->multisample_color);
+#endif
+ }
+
storage->canvas->_copy_screen(Rect2());
+
+ if (storage->frame.current_rt && storage->frame.current_rt->multisample_active) {
+ // Rebind the current framebuffer
+ glBindFramebuffer(GL_FRAMEBUFFER, current_fb);
+ glViewport(0, 0, viewport_width, viewport_height);
+ }
}
// alpha pass
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- render_list.sort_by_depth(true);
+ render_list.sort_by_reverse_depth_and_priority(true);
_render_render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, true, false);
glDisable(GL_DEPTH_TEST);
+ if (storage->frame.current_rt && storage->frame.current_rt->multisample_active) {
+#ifdef GLES_OVER_GL
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo);
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo);
+ glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+#else
+ // In GLES2 Blit is not available, so just copy color texture manually
+ _copy_texture_to_front_buffer(storage->frame.current_rt->multisample_color);
+#endif
+ }
+
//#define GLES2_SHADOW_ATLAS_DEBUG_VIEW
#ifdef GLES2_SHADOW_ATLAS_DEBUG_VIEW
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index f23e45b52f..bd1a61688c 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -104,6 +104,7 @@ public:
GLuint immediate_buffer;
Color default_ambient;
+ Color default_bg;
// ResolveShaderGLES3 resolve_shader;
// ScreenSpaceReflectionShaderGLES3 ssr_shader;
@@ -502,7 +503,8 @@ public:
enum {
MAX_LIGHTS = 255,
MAX_REFLECTION_PROBES = 255,
- DEFAULT_MAX_ELEMENTS = 65536
+ DEFAULT_MAX_ELEMENTS = 65536,
+ SORT_KEY_PRIORITY_SHIFT = 56
};
int max_elements;
@@ -598,6 +600,27 @@ public:
}
}
+ struct SortByReverseDepthAndPriority {
+
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
+ if (A->priority == B->priority) {
+ return A->instance->depth > B->instance->depth;
+ } else {
+ return A->priority < B->priority;
+ }
+ }
+ };
+
+ void sort_by_reverse_depth_and_priority(bool p_alpha) { //used for alpha
+
+ SortArray<Element *, SortByReverseDepthAndPriority> sorter;
+ if (p_alpha) {
+ sorter.sort(&elements[max_elements - alpha_element_count], alpha_element_count);
+ } else {
+ sorter.sort(elements, element_count);
+ }
+ }
+
// element adding and stuff
_FORCE_INLINE_ Element *add_element() {
@@ -646,6 +669,7 @@ public:
void _add_geometry(RasterizerStorageGLES2::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES2::GeometryOwner *p_owner, int p_material, bool p_depth_pass, bool p_shadow_pass);
void _add_geometry_with_material(RasterizerStorageGLES2::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES2::GeometryOwner *p_owner, RasterizerStorageGLES2::Material *p_material, bool p_depth_pass, bool p_shadow_pass);
+ void _copy_texture_to_front_buffer(GLuint texture);
void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass, bool p_shadow_pass);
void _render_render_list(RenderList::Element **p_elements, int p_element_count,
const Transform &p_view_transform,
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 1e32d8166f..c610f31bc1 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -81,6 +81,28 @@ GLuint RasterizerStorageGLES2::system_fbo = 0;
#define _DEPTH_COMPONENT24_OES 0x81A6
+#ifndef GLES_OVER_GL
+// enable extensions manually for android and ios
+#include <dlfcn.h> // needed to load extensions
+
+#ifdef IPHONE_ENABLED
+
+#include <OpenGLES/ES2/glext.h>
+//void *glRenderbufferStorageMultisampleAPPLE;
+//void *glResolveMultisampleFramebufferAPPLE;
+#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleAPPLE
+#else
+
+#include <GLES2/gl2ext.h>
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT;
+PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT;
+#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleEXT
+#define glFramebufferTexture2DMultisample glFramebufferTexture2DMultisampleEXT
+#endif
+
+#define GL_MAX_SAMPLES 0x8D57
+#endif //!GLES_OVER_GL
+
void RasterizerStorageGLES2::bind_quad_array() const {
glBindBuffer(GL_ARRAY_BUFFER, resources.quadie);
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0);
@@ -774,10 +796,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
for (int i = 0; i < texture->mipmaps; i++) {
- int ofs = 0;
- if (i > 0) {
- ofs = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, i - 1);
- }
+ int ofs = Image::get_image_mipmap_offset(texture->alloc_width, texture->alloc_height, real_format, i);
if (texture->compressed) {
glPixelStorei(GL_PACK_ALIGNMENT, 4);
@@ -3712,6 +3731,7 @@ RID RasterizerStorageGLES2::light_create(VS::LightType p_type) {
light->directional_blend_splits = false;
light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
light->reverse_cull = false;
+ light->use_gi = true;
light->version = 0;
return light_owner.make_rid(light);
@@ -3799,6 +3819,16 @@ void RasterizerStorageGLES2::light_set_reverse_cull_face_mode(RID p_light, bool
light->instance_change_notify(true, false);
}
+void RasterizerStorageGLES2::light_set_use_gi(RID p_light, bool p_enabled) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND(!light);
+
+ light->use_gi = p_enabled;
+
+ light->version++;
+ light->instance_change_notify(true, false);
+}
+
void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3894,6 +3924,13 @@ Color RasterizerStorageGLES2::light_get_color(RID p_light) {
return light->color;
}
+bool RasterizerStorageGLES2::light_get_use_gi(RID p_light) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND_V(!light, false);
+
+ return light->use_gi;
+}
+
bool RasterizerStorageGLES2::light_has_shadow(RID p_light) const {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND_V(!light, false);
@@ -4531,98 +4568,184 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
+ // do not allocate a render target with no size
if (rt->width <= 0 || rt->height <= 0)
return;
- Texture *texture = texture_owner.getornull(rt->texture);
- ERR_FAIL_COND(!texture);
-
- // create fbo
-
- glGenFramebuffers(1, &rt->fbo);
- glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
-
- // color
+ // do not allocate a render target that is attached to the screen
+ if (rt->flags[RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ rt->fbo = RasterizerStorageGLES2::system_fbo;
+ return;
+ }
- glGenTextures(1, &rt->color);
- glBindTexture(GL_TEXTURE_2D, rt->color);
+ GLuint color_internal_format;
+ GLuint color_format;
+ GLuint color_type = GL_UNSIGNED_BYTE;
if (rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ color_internal_format = GL_RGBA;
+ color_format = GL_RGBA;
} else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, rt->width, rt->height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ color_internal_format = GL_RGB;
+ color_format = GL_RGB;
}
- if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- } else {
+ /* Front FBO */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- }
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ Texture *texture = texture_owner.getornull(rt->texture);
+ ERR_FAIL_COND(!texture);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
+ // framebuffer
+ glGenFramebuffers(1, &rt->fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
- // depth
+ // color
+ glGenTextures(1, &rt->color);
+ glBindTexture(GL_TEXTURE_2D, rt->color);
- if (config.support_depth_texture) {
- glGenTextures(1, &rt->depth);
- glBindTexture(GL_TEXTURE_2D, rt->depth);
- glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, rt->width, rt->height, 0, GL_DEPTH_COMPONENT, config.depth_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
- } else {
- glGenRenderbuffers(1, &rt->depth);
- glBindRenderbuffer(GL_RENDERBUFFER, rt->depth);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ } else {
- glRenderbufferStorage(GL_RENDERBUFFER, config.depth_internalformat, rt->width, rt->height);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ }
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
- }
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
- if (status != GL_FRAMEBUFFER_COMPLETE) {
+ // depth
- glDeleteFramebuffers(1, &rt->fbo);
if (config.support_depth_texture) {
- glDeleteTextures(1, &rt->depth);
+
+ glGenTextures(1, &rt->depth);
+ glBindTexture(GL_TEXTURE_2D, rt->depth);
+ glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, rt->width, rt->height, 0, GL_DEPTH_COMPONENT, config.depth_type, NULL);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
} else {
- glDeleteRenderbuffers(1, &rt->depth);
+
+ glGenRenderbuffers(1, &rt->depth);
+ glBindRenderbuffer(GL_RENDERBUFFER, rt->depth);
+
+ glRenderbufferStorage(GL_RENDERBUFFER, config.depth_internalformat, rt->width, rt->height);
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
}
- glDeleteTextures(1, &rt->color);
- rt->fbo = 0;
- rt->width = 0;
- rt->height = 0;
- rt->color = 0;
- rt->depth = 0;
- texture->tex_id = 0;
- texture->active = false;
- WARN_PRINT("Could not create framebuffer!!");
- return;
+
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+
+ glDeleteFramebuffers(1, &rt->fbo);
+ if (config.support_depth_texture) {
+
+ glDeleteTextures(1, &rt->depth);
+ } else {
+
+ glDeleteRenderbuffers(1, &rt->depth);
+ }
+
+ glDeleteTextures(1, &rt->color);
+ rt->fbo = 0;
+ rt->width = 0;
+ rt->height = 0;
+ rt->color = 0;
+ rt->depth = 0;
+ texture->tex_id = 0;
+ texture->active = false;
+ WARN_PRINT("Could not create framebuffer!!");
+ return;
+ }
+
+ texture->format = Image::FORMAT_RGBA8;
+ texture->gl_format_cache = GL_RGBA;
+ texture->gl_type_cache = GL_UNSIGNED_BYTE;
+ texture->gl_internal_format_cache = GL_RGBA;
+ texture->tex_id = rt->color;
+ texture->width = rt->width;
+ texture->alloc_width = rt->width;
+ texture->height = rt->height;
+ texture->alloc_height = rt->height;
+ texture->active = true;
+
+ texture_set_flags(rt->texture, texture->flags);
}
- texture->format = Image::FORMAT_RGBA8;
- texture->gl_format_cache = GL_RGBA;
- texture->gl_type_cache = GL_UNSIGNED_BYTE;
- texture->gl_internal_format_cache = GL_RGBA;
- texture->tex_id = rt->color;
- texture->width = rt->width;
- texture->alloc_width = rt->width;
- texture->height = rt->height;
- texture->alloc_height = rt->height;
- texture->active = true;
+ /* BACK FBO */
+ /* For MSAA */
+
+ if (rt->msaa != VS::VIEWPORT_MSAA_DISABLED && config.multisample_supported) {
+
+ rt->multisample_active = true;
+
+ static const int msaa_value[] = { 0, 2, 4, 8, 16 };
+ int msaa = msaa_value[rt->msaa];
+
+ int max_samples = 0;
+ glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
+ if (msaa > max_samples) {
+ WARN_PRINTS("MSAA must be <= GL_MAX_SAMPLES, falling-back to GL_MAX_SAMPLES = " + itos(max_samples));
+ msaa = max_samples;
+ }
+
+ //regular fbo
+ glGenFramebuffers(1, &rt->multisample_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, rt->multisample_fbo);
+
+ glGenRenderbuffers(1, &rt->multisample_depth);
+ glBindRenderbuffer(GL_RENDERBUFFER, rt->multisample_depth);
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, config.depth_internalformat, rt->width, rt->height);
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->multisample_depth);
+
+#if defined(GLES_OVER_GL) || defined(IPHONE_ENABLED)
+
+ glGenRenderbuffers(1, &rt->multisample_color);
+ glBindRenderbuffer(GL_RENDERBUFFER, rt->multisample_color);
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, color_internal_format, rt->width, rt->height);
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rt->multisample_color);
+#else
+ // Render to a texture in android
+ glGenTextures(1, &rt->multisample_color);
+ glBindTexture(GL_TEXTURE_2D, rt->multisample_color);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
+
+ // multisample buffer is same size as front buffer, so just use nearest
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+
+ glFramebufferTexture2DMultisample(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0, msaa);
+#endif
+
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ printf("err status: %x\n", status);
+ _render_target_clear(rt);
+ ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
+ }
+
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
- texture_set_flags(rt->texture, texture->flags);
+ } else {
+ rt->multisample_active = false;
+ }
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -4651,7 +4774,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
- status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
_render_target_clear(rt);
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
@@ -4663,6 +4786,10 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) {
+ // there is nothing to clear when DIRECT_TO_SCREEN is used
+ if (rt->flags[RENDER_TARGET_DIRECT_TO_SCREEN])
+ return;
+
if (rt->fbo) {
glDeleteFramebuffers(1, &rt->fbo);
glDeleteTextures(1, &rt->color);
@@ -4710,6 +4837,20 @@ void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) {
glDeleteTextures(1, &rt->copy_screen_effect.color);
rt->copy_screen_effect.color = 0;
}
+
+ if (rt->multisample_active) {
+ glDeleteFramebuffers(1, &rt->multisample_fbo);
+ rt->multisample_fbo = 0;
+
+ glDeleteRenderbuffers(1, &rt->multisample_depth);
+ rt->multisample_depth = 0;
+#ifdef GLES_OVER_GL
+ glDeleteRenderbuffers(1, &rt->multisample_color);
+#else
+ glDeleteTextures(1, &rt->multisample_color);
+#endif
+ rt->multisample_color = 0;
+ }
}
RID RasterizerStorageGLES2::render_target_create() {
@@ -4743,6 +4884,15 @@ RID RasterizerStorageGLES2::render_target_create() {
return render_target_owner.make_rid(rt);
}
+void RasterizerStorageGLES2::render_target_set_position(RID p_render_target, int p_x, int p_y) {
+
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+
+ rt->x = p_x;
+ rt->y = p_y;
+}
+
void RasterizerStorageGLES2::render_target_set_size(RID p_render_target, int p_width, int p_height) {
RenderTarget *rt = render_target_owner.getornull(p_render_target);
@@ -4872,6 +5022,14 @@ void RasterizerStorageGLES2::render_target_set_flag(RID p_render_target, RenderT
RenderTarget *rt = render_target_owner.getornull(p_render_target);
ERR_FAIL_COND(!rt);
+ // When setting DIRECT_TO_SCREEN, you need to clear before the value is set, but allocate after as
+ // those functions change how they operate depending on the value of DIRECT_TO_SCREEN
+ if (p_flag == RENDER_TARGET_DIRECT_TO_SCREEN && p_value != rt->flags[RENDER_TARGET_DIRECT_TO_SCREEN]) {
+ _render_target_clear(rt);
+ rt->flags[p_flag] = p_value;
+ _render_target_allocate(rt);
+ }
+
rt->flags[p_flag] = p_value;
switch (p_flag) {
@@ -4911,6 +5069,11 @@ void RasterizerStorageGLES2::render_target_set_msaa(RID p_render_target, VS::Vie
if (rt->msaa == p_msaa)
return;
+ if (!config.multisample_supported) {
+ ERR_PRINT("MSAA not supported on this hardware.");
+ return;
+ }
+
_render_target_clear(rt);
rt->msaa = p_msaa;
_render_target_allocate(rt);
@@ -5434,6 +5597,26 @@ void RasterizerStorageGLES2::initialize() {
config.support_npot_repeat_mipmap = config.extensions.has("GL_OES_texture_npot");
#endif
+
+#ifndef GLES_OVER_GL
+ //Manually load extensions for android and ios
+
+#ifdef IPHONE_ENABLED
+
+ //void *gles2_lib = dlopen(NULL, RTLD_LAZY);
+ //glRenderbufferStorageMultisampleAPPLE = dlsym(gles2_lib, "glRenderbufferStorageMultisampleAPPLE");
+ //glResolveMultisampleFramebufferAPPLE = dlsym(gles2_lib, "glResolveMultisampleFramebufferAPPLE");
+#else
+
+ void *gles2_lib = dlopen("libGLESv2.so", RTLD_LAZY);
+ glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)dlsym(gles2_lib, "glRenderbufferStorageMultisampleEXT");
+ glFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)dlsym(gles2_lib, "glFramebufferTexture2DMultisampleEXT");
+#endif
+#endif
+
+ // Check for multisample support
+ config.multisample_supported = config.extensions.has("GL_EXT_framebuffer_multisample") || config.extensions.has("GL_EXT_multisampled_render_to_texture") || config.extensions.has("GL_APPLE_framebuffer_multisample");
+
#ifdef GLES_OVER_GL
config.use_rgba_2d_shadows = false;
config.support_depth_texture = true;
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 2ac68fa47a..af57aa3d9b 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -92,6 +92,8 @@ public:
bool support_shadow_cubemaps;
+ bool multisample_supported;
+
GLuint depth_internalformat;
GLuint depth_type;
@@ -910,6 +912,7 @@ public:
bool shadow;
bool negative;
bool reverse_cull;
+ bool use_gi;
uint32_t cull_mask;
@@ -936,6 +939,7 @@ public:
virtual void light_set_negative(RID p_light, bool p_enable);
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
+ virtual void light_set_use_gi(RID p_light, bool p_enabled);
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
@@ -955,6 +959,7 @@ public:
virtual VS::LightType light_get_type(RID p_light) const;
virtual float light_get_param(RID p_light, VS::LightParam p_param);
virtual Color light_get_color(RID p_light);
+ virtual bool light_get_use_gi(RID p_light);
virtual AABB light_get_aabb(RID p_light) const;
virtual uint64_t light_get_version(RID p_light) const;
@@ -1129,10 +1134,14 @@ public:
struct RenderTarget : public RID_Data {
GLuint fbo;
-
GLuint color;
GLuint depth;
+ GLuint multisample_fbo;
+ GLuint multisample_color;
+ GLuint multisample_depth;
+ bool multisample_active;
+
// TODO post processing effects?
// TODO HDR?
@@ -1166,7 +1175,7 @@ public:
}
} external;
- int width, height;
+ int x, y, width, height;
bool flags[RENDER_TARGET_FLAG_MAX];
@@ -1179,6 +1188,12 @@ public:
fbo(0),
color(0),
depth(0),
+ multisample_fbo(0),
+ multisample_color(0),
+ multisample_depth(0),
+ multisample_active(false),
+ x(0),
+ y(0),
width(0),
height(0),
used_in_frame(false),
@@ -1196,6 +1211,7 @@ public:
void _render_target_allocate(RenderTarget *rt);
virtual RID render_target_create();
+ virtual void render_target_set_position(RID p_render_target, int p_x, int p_y);
virtual void render_target_set_size(RID p_render_target, int p_width, int p_height);
virtual RID render_target_get_texture(RID p_render_target) const;
virtual void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id);
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index d00b03fb8a..9778d39a21 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -316,9 +316,14 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
for (Map<StringName, SL::ShaderNode::Uniform>::Element *E = snode->uniforms.front(); E; E = E->next()) {
StringBuffer<> uniform_code;
- uniform_code += "uniform ";
+ // use highp if no precision is specified to prevent different default values in fragment and vertex shader
+ SL::DataPrecision precision = E->get().precision;
+ if (precision == SL::PRECISION_DEFAULT) {
+ precision = SL::PRECISION_HIGHP;
+ }
- uniform_code += _prestr(E->get().precision);
+ uniform_code += "uniform ";
+ uniform_code += _prestr(precision);
uniform_code += _typestr(E->get().type);
uniform_code += " ";
uniform_code += _mkid(E->key());
@@ -934,6 +939,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
// No defines for particle shaders in GLES2, there are no GPU particles
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 7ba2856216..7dce784f52 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -347,7 +347,7 @@ void main() {
vec4 color = color_interp;
vec2 uv = uv_interp;
#ifdef USE_FORCE_REPEAT
- //needs to use this to workaround GLES2/WebGL1 forcing tiling that textures that dont support it
+ //needs to use this to workaround GLES2/WebGL1 forcing tiling that textures that don't support it
uv = mod(uv, vec2(1.0, 1.0));
#endif
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 1c35b455c4..2aef913ae8 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -424,9 +424,12 @@ void main() {
#endif
+ mat4 local_projection_matrix = projection_matrix;
+
mat4 modelview = camera_inverse_matrix * world_matrix;
float roughness = 1.0;
+#define projection_matrix local_projection_matrix
#define world_transform world_matrix
{
@@ -911,6 +914,7 @@ uniform mat4 radiance_inverse_xform;
#endif
+uniform vec4 bg_color;
uniform float bg_energy;
uniform float ambient_sky_contribution;
@@ -1147,7 +1151,8 @@ void light_compute(
float clearcoat_gloss,
float anisotropy,
inout vec3 diffuse_light,
- inout vec3 specular_light) {
+ inout vec3 specular_light,
+ inout float alpha) {
//this makes lights behave closer to linear, but then addition of lights looks bad
//better left disabled
@@ -1302,10 +1307,10 @@ LIGHT_SHADER_CODE
// shlick+ggx as default
#if defined(LIGHT_USE_ANISOTROPY)
- float alpha = roughness * roughness;
+ float alpha_ggx = roughness * roughness;
float aspect = sqrt(1.0 - anisotropy * 0.9);
- float ax = alpha / aspect;
- float ay = alpha * aspect;
+ float ax = alpha_ggx / aspect;
+ float ay = alpha_ggx * aspect;
float XdotH = dot(T, H);
float YdotH = dot(B, H);
float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH, cNdotH);
@@ -1313,10 +1318,10 @@ LIGHT_SHADER_CODE
float G = V_GGX_anisotropic(ax, ay, dot(T, V), dot(T, L), dot(B, V), dot(B, L), cNdotV, cNdotL);
#else
- float alpha = roughness * roughness;
- float D = D_GGX(cNdotH, alpha);
- //float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha);
- float G = V_GGX(cNdotL, cNdotV, alpha);
+ float alpha_ggx = roughness * roughness;
+ float D = D_GGX(cNdotH, alpha_ggx);
+ //float G = G_GGX_2cos(cNdotL, alpha_ggx) * G_GGX_2cos(cNdotV, alpha_ggx);
+ float G = V_GGX(cNdotL, cNdotV, alpha_ggx);
#endif
// F
vec3 f0 = F0(metallic, specular, diffuse_color);
@@ -1346,6 +1351,10 @@ LIGHT_SHADER_CODE
#endif
}
+#ifdef USE_SHADOW_TO_OPACITY
+ alpha = min(alpha, clamp(1.0 - length(attenuation), 0.0, 1.0));
+#endif
+
#endif //defined(USE_LIGHT_SHADER_CODE)
}
@@ -1531,17 +1540,21 @@ FRAGMENT_SHADER_CODE
vec3 eye_position = view;
+#if !defined(USE_SHADOW_TO_OPACITY)
+
#if defined(ALPHA_SCISSOR_USED)
if (alpha < alpha_scissor) {
discard;
}
-#endif
+#endif // ALPHA_SCISSOR_USED
#ifdef USE_DEPTH_PREPASS
if (alpha < 0.99) {
discard;
}
-#endif
+#endif // USE_DEPTH_PREPASS
+
+#endif // !USE_SHADOW_TO_OPACITY
#ifdef BASE_PASS
//none
@@ -1558,7 +1571,6 @@ FRAGMENT_SHADER_CODE
ref_vec.z *= -1.0;
specular_light = textureCubeLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).xyz * bg_energy;
-
{
vec3 ambient_dir = normalize((radiance_inverse_xform * vec4(normal, 0.0)).xyz);
vec3 env_ambient = textureCubeLod(radiance_map, ambient_dir, RADIANCE_MAX_LOD).xyz * bg_energy;
@@ -1569,6 +1581,7 @@ FRAGMENT_SHADER_CODE
#else
ambient_light = ambient_color.rgb;
+ specular_light = bg_color.rgb * bg_energy;
#endif
@@ -1628,6 +1641,19 @@ FRAGMENT_SHADER_CODE
#endif // defined(USE_REFLECTION_PROBE1) || defined(USE_REFLECTION_PROBE2)
+ // scales the specular reflections, needs to be be computed before lighting happens,
+ // but after environment and reflection probes are added
+ //TODO: this curve is not really designed for gammaspace, should be adjusted
+ const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
+ const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
+ vec4 r = roughness * c0 + c1;
+ float ndotv = clamp(dot(normal, eye_position), 0.0, 1.0);
+ float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
+ vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
+
+ vec3 f0 = F0(metallic, specular, albedo);
+ specular_light *= env.x * f0 + env.y;
+
#ifdef USE_LIGHTMAP
//ambient light will come entirely from lightmap is lightmap is used
ambient_light = texture2D(lightmap, uv2_interp).rgb * lightmap_energy;
@@ -1699,6 +1725,8 @@ FRAGMENT_SHADER_CODE
#endif
+#if !defined(SHADOWS_DISABLED)
+
#ifdef USE_SHADOW
{
highp vec4 splane = shadow_coord;
@@ -1729,6 +1757,8 @@ FRAGMENT_SHADER_CODE
}
#endif
+#endif //SHADOWS_DISABLED
+
#endif //type omni
#ifdef LIGHT_MODE_DIRECTIONAL
@@ -1739,6 +1769,8 @@ FRAGMENT_SHADER_CODE
#endif
float depth_z = -vertex.z;
+#if !defined(SHADOWS_DISABLED)
+
#ifdef USE_SHADOW
#ifdef USE_VERTEX_LIGHTING
@@ -1957,6 +1989,8 @@ FRAGMENT_SHADER_CODE
#endif //use shadow
+#endif // SHADOWS_DISABLED
+
#endif
#ifdef LIGHT_MODE_SPOT
@@ -1993,6 +2027,8 @@ FRAGMENT_SHADER_CODE
#endif
+#if !defined(SHADOWS_DISABLED)
+
#ifdef USE_SHADOW
{
highp vec4 splane = shadow_coord;
@@ -2002,6 +2038,8 @@ FRAGMENT_SHADER_CODE
}
#endif
+#endif // SHADOWS_DISABLED
+
#endif // LIGHT_MODE_SPOT
#ifdef USE_VERTEX_LIGHTING
@@ -2032,13 +2070,32 @@ FRAGMENT_SHADER_CODE
clearcoat_gloss,
anisotropy,
diffuse_light,
- specular_light);
+ specular_light,
+ alpha);
#endif //vertex lighting
#endif //USE_LIGHTING
//compute and merge
+#ifdef USE_SHADOW_TO_OPACITY
+
+ alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
+
+#if defined(ALPHA_SCISSOR_USED)
+ if (alpha < alpha_scissor) {
+ discard;
+ }
+#endif // ALPHA_SCISSOR_USED
+
+#ifdef USE_DEPTH_PREPASS
+ if (alpha < 0.99) {
+ discard;
+ }
+#endif // USE_DEPTH_PREPASS
+
+#endif // !USE_SHADOW_TO_OPACITY
+
#ifndef RENDER_DEPTH
#ifdef SHADELESS
@@ -2065,17 +2122,6 @@ FRAGMENT_SHADER_CODE
#if defined(DIFFUSE_TOON)
//simplify for toon, as
specular_light *= specular * metallic * albedo * 2.0;
-#else
- //TODO: this curve is not really designed for gammaspace, should be adjusted
- const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
- const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
- vec4 r = roughness * c0 + c1;
- float ndotv = clamp(dot(normal, eye_position), 0.0, 1.0);
- float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
- vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
-
- vec3 f0 = F0(metallic, specular, albedo);
- specular_light *= env.x * f0 + env.y;
#endif
}
@@ -2087,8 +2133,6 @@ FRAGMENT_SHADER_CODE
#endif
// gl_FragColor = vec4(normal, 1.0);
-#endif //unshaded
-
//apply fog
#if defined(FOG_DEPTH_ENABLED) || defined(FOG_HEIGHT_ENABLED)
@@ -2143,6 +2187,8 @@ FRAGMENT_SHADER_CODE
#endif // defined(FOG_DEPTH_ENABLED) || defined(FOG_HEIGHT_ENABLED)
+#endif //unshaded
+
#else // not RENDER_DEPTH
//depth render
#ifdef USE_RGBA_SHADOWS
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 9aec348291..4552fddfe8 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -2374,7 +2374,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
has_alpha = false;
}
- RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element();
+ RenderList::Element *e = (has_alpha || p_material->shader->spatial.no_depth_test) ? render_list.add_alpha_element() : render_list.add_element();
if (!e)
return;
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index be44d62efc..8311d0de84 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1210,10 +1210,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
for (int i = 0; i < texture->mipmaps; i++) {
- int ofs = 0;
- if (i > 0) {
- ofs = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, i - 1);
- }
+ int ofs = Image::get_image_mipmap_offset(texture->alloc_width, texture->alloc_height, real_format, i);
if (texture->compressed) {
@@ -5219,6 +5216,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light->directional_blend_splits = false;
light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
light->reverse_cull = false;
+ light->use_gi = true;
light->version = 0;
return light_owner.make_rid(light);
@@ -5310,6 +5308,15 @@ void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool
light->instance_change_notify(true, false);
}
+void RasterizerStorageGLES3::light_set_use_gi(RID p_light, bool p_enabled) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND(!light);
+
+ light->use_gi = p_enabled;
+
+ light->version++;
+ light->instance_change_notify(true, false);
+}
void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
@@ -5415,6 +5422,13 @@ Color RasterizerStorageGLES3::light_get_color(RID p_light) {
return light->color;
}
+bool RasterizerStorageGLES3::light_get_use_gi(RID p_light) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND_V(!light, false);
+
+ return light->use_gi;
+}
+
bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const {
const Light *light = light_owner.getornull(p_light);
@@ -7254,6 +7268,10 @@ RID RasterizerStorageGLES3::render_target_create() {
return render_target_owner.make_rid(rt);
}
+void RasterizerStorageGLES3::render_target_set_position(RID p_render_target, int p_x, int p_y) {
+ //only used in GLES2
+}
+
void RasterizerStorageGLES3::render_target_set_size(RID p_render_target, int p_width, int p_height) {
RenderTarget *rt = render_target_owner.getornull(p_render_target);
@@ -8140,7 +8158,7 @@ void RasterizerStorageGLES3::initialize() {
}
shaders.cubemap_filter.init();
- bool ggx_hq = GLOBAL_GET("rendering/quality/reflections/high_quality_ggx.mobile");
+ bool ggx_hq = GLOBAL_GET("rendering/quality/reflections/high_quality_ggx");
shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::LOW_QUALITY, !ggx_hq);
shaders.particles.init();
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 92916ed808..99aa34e1ce 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -930,6 +930,7 @@ public:
bool shadow;
bool negative;
bool reverse_cull;
+ bool use_gi;
uint32_t cull_mask;
VS::LightOmniShadowMode omni_shadow_mode;
VS::LightOmniShadowDetail omni_shadow_detail;
@@ -951,6 +952,7 @@ public:
virtual void light_set_negative(RID p_light, bool p_enable);
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
+ virtual void light_set_use_gi(RID p_light, bool p_enabled);
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
@@ -970,6 +972,7 @@ public:
virtual VS::LightType light_get_type(RID p_light) const;
virtual float light_get_param(RID p_light, VS::LightParam p_param);
virtual Color light_get_color(RID p_light);
+ virtual bool light_get_use_gi(RID p_light);
virtual AABB light_get_aabb(RID p_light) const;
virtual uint64_t light_get_version(RID p_light) const;
@@ -1391,6 +1394,7 @@ public:
void _render_target_allocate(RenderTarget *rt);
virtual RID render_target_create();
+ virtual void render_target_set_position(RID p_render_target, int p_x, int p_y);
virtual void render_target_set_size(RID p_render_target, int p_width, int p_height);
virtual RID render_target_get_texture(RID p_render_target) const;
virtual void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id);
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index ad26294527..e8417900ea 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -944,6 +944,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
/* PARTICLES SHADER */
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index f65f798ff0..619e29b130 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -163,7 +163,7 @@ vec2 Hammersley(uint i, uint N) {
#else
-#define SAMPLE_COUNT 512u
+#define SAMPLE_COUNT 1024u
#endif
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 630e1c2089..f08d3f4d23 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -993,7 +993,7 @@ vec3 F0(float metallic, float specular, vec3 albedo) {
return mix(vec3(dielectric), albedo, vec3(metallic));
}
-void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec3 attenuation, vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) {
+void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec3 attenuation, vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light, inout float alpha) {
#if defined(USE_LIGHT_SHADER_CODE)
// light is written by the light shader
@@ -1135,19 +1135,19 @@ LIGHT_SHADER_CODE
#if defined(LIGHT_USE_ANISOTROPY)
- float alpha = roughness * roughness;
+ float alpha_ggx = roughness * roughness;
float aspect = sqrt(1.0 - anisotropy * 0.9);
- float ax = alpha / aspect;
- float ay = alpha * aspect;
+ float ax = alpha_ggx / aspect;
+ float ay = alpha_ggx * aspect;
float XdotH = dot(T, H);
float YdotH = dot(B, H);
float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);
float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH);
#else
- float alpha = roughness * roughness;
- float D = D_GGX(cNdotH, alpha);
- float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha);
+ float alpha_ggx = roughness * roughness;
+ float D = D_GGX(cNdotH, alpha_ggx);
+ float G = G_GGX_2cos(cNdotL, alpha_ggx) * G_GGX_2cos(cNdotV, alpha_ggx);
#endif
// F
vec3 f0 = F0(metallic, specular, diffuse_color);
@@ -1174,6 +1174,10 @@ LIGHT_SHADER_CODE
#endif
}
+#ifdef USE_SHADOW_TO_OPACITY
+ alpha = min(alpha, clamp(1.0 - length(attenuation), 0.0, 1.0));
+#endif
+
#endif //defined(USE_LIGHT_SHADER_CODE)
}
@@ -1250,7 +1254,7 @@ vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 po
}
#endif
-void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light, inout float alpha) {
vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz - vertex;
float light_length = length(light_rel_vec);
@@ -1304,10 +1308,10 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
light_attenuation *= mix(omni_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow);
}
#endif //SHADOWS_DISABLED
- light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, omni_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, omni_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, specular, rim * omni_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
+ light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, omni_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, omni_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, specular, rim * omni_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light, alpha);
}
-void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
+void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light, inout float alpha) {
vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz - vertex;
float light_length = length(light_rel_vec);
@@ -1339,7 +1343,7 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
}
#endif //SHADOWS_DISABLED
- light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, spot_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, spot_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, specular, rim * spot_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
+ light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, spot_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, spot_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, specular, rim * spot_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light, alpha);
}
void reflection_process(int idx, vec3 vertex, vec3 normal, vec3 binormal, vec3 tangent, float roughness, float anisotropy, vec3 ambient, vec3 skybox, inout highp vec4 reflection_accum, inout highp vec4 ambient_accum) {
@@ -1705,11 +1709,13 @@ FRAGMENT_SHADER_CODE
/* clang-format on */
}
+#if !defined(USE_SHADOW_TO_OPACITY)
+
#if defined(ALPHA_SCISSOR_USED)
if (alpha < alpha_scissor) {
discard;
}
-#endif
+#endif // ALPHA_SCISSOR_USED
#ifdef USE_OPAQUE_PREPASS
@@ -1717,7 +1723,9 @@ FRAGMENT_SHADER_CODE
discard;
}
-#endif
+#endif // USE_OPAQUE_PREPASS
+
+#endif // !USE_SHADOW_TO_OPACITY
#if defined(ENABLE_NORMALMAP)
@@ -1802,6 +1810,7 @@ FRAGMENT_SHADER_CODE
ambient_light = vec3(0.0, 0.0, 0.0);
#else
ambient_light = ambient_light_color.rgb;
+ env_reflection_light = bg_color.rgb * bg_energy;
#endif //AMBIENT_LIGHT_DISABLED
#endif
@@ -1809,10 +1818,98 @@ FRAGMENT_SHADER_CODE
ambient_light *= ambient_energy;
float specular_blob_intensity = 1.0;
+
#if defined(SPECULAR_TOON)
specular_blob_intensity *= specular * 2.0;
#endif
+#ifdef USE_GI_PROBES
+ gi_probes_compute(vertex, normal, roughness, env_reflection_light, ambient_light);
+
+#endif
+
+#ifdef USE_LIGHTMAP
+ ambient_light = texture(lightmap, uv2).rgb * lightmap_energy;
+#endif
+
+#ifdef USE_LIGHTMAP_CAPTURE
+ {
+ vec3 cone_dirs[12] = vec3[](
+ vec3(0.0, 0.0, 1.0),
+ vec3(0.866025, 0.0, 0.5),
+ vec3(0.267617, 0.823639, 0.5),
+ vec3(-0.700629, 0.509037, 0.5),
+ vec3(-0.700629, -0.509037, 0.5),
+ vec3(0.267617, -0.823639, 0.5),
+ vec3(0.0, 0.0, -1.0),
+ vec3(0.866025, 0.0, -0.5),
+ vec3(0.267617, 0.823639, -0.5),
+ vec3(-0.700629, 0.509037, -0.5),
+ vec3(-0.700629, -0.509037, -0.5),
+ vec3(0.267617, -0.823639, -0.5));
+
+ vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz;
+ vec4 captured = vec4(0.0);
+ float sum = 0.0;
+ for (int i = 0; i < 12; i++) {
+ float amount = max(0.0, dot(local_normal, cone_dirs[i])); //not correct, but creates a nice wrap around effect
+ captured += lightmap_captures[i] * amount;
+ sum += amount;
+ }
+
+ captured /= sum;
+
+ if (lightmap_capture_sky) {
+ ambient_light = mix(ambient_light, captured.rgb, captured.a);
+ } else {
+ ambient_light = captured.rgb;
+ }
+ }
+#endif
+
+#ifdef USE_FORWARD_LIGHTING
+
+ highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
+ highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
+ for (int i = 0; i < reflection_count; i++) {
+ reflection_process(reflection_indices[i], vertex, normal, binormal, tangent, roughness, anisotropy, ambient_light, env_reflection_light, reflection_accum, ambient_accum);
+ }
+
+ if (reflection_accum.a > 0.0) {
+ specular_light += reflection_accum.rgb / reflection_accum.a;
+ } else {
+ specular_light += env_reflection_light;
+ }
+#if !defined(USE_LIGHTMAP) && !defined(USE_LIGHTMAP_CAPTURE)
+ if (ambient_accum.a > 0.0) {
+ ambient_light = ambient_accum.rgb / ambient_accum.a;
+ }
+#endif
+#endif
+
+ {
+
+#if defined(DIFFUSE_TOON)
+ //simplify for toon, as
+ specular_light *= specular * metallic * albedo * 2.0;
+#else
+
+ // scales the specular reflections, needs to be be computed before lighting happens,
+ // but after environment, GI, and reflection probes are added
+ // Environment brdf approximation (Lazarov 2013)
+ // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
+ const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
+ const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
+ vec4 r = roughness * c0 + c1;
+ float ndotv = clamp(dot(normal, eye_vec), 0.0, 1.0);
+ float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
+ vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
+
+ vec3 f0 = F0(metallic, specular, albedo);
+ specular_light *= env.x * f0 + env.y;
+#endif
+ }
+
#if defined(USE_LIGHT_DIRECTIONAL)
vec3 light_attenuation = vec3(1.0);
@@ -1955,91 +2052,49 @@ FRAGMENT_SHADER_CODE
specular_light *= mix(vec3(1.0), light_attenuation, specular_light_interp.a);
#else
- light_compute(normal, -light_direction_attenuation.xyz, eye_vec, binormal, tangent, light_color_energy.rgb, light_attenuation, albedo, transmission, light_params.z * specular_blob_intensity, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
+ light_compute(normal, -light_direction_attenuation.xyz, eye_vec, binormal, tangent, light_color_energy.rgb, light_attenuation, albedo, transmission, light_params.z * specular_blob_intensity, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light, alpha);
#endif
#endif //#USE_LIGHT_DIRECTIONAL
-#ifdef USE_GI_PROBES
- gi_probes_compute(vertex, normal, roughness, env_reflection_light, ambient_light);
-
-#endif
-
-#ifdef USE_LIGHTMAP
- ambient_light = texture(lightmap, uv2).rgb * lightmap_energy;
-#endif
-
-#ifdef USE_LIGHTMAP_CAPTURE
- {
- vec3 cone_dirs[12] = vec3[](
- vec3(0.0, 0.0, 1.0),
- vec3(0.866025, 0.0, 0.5),
- vec3(0.267617, 0.823639, 0.5),
- vec3(-0.700629, 0.509037, 0.5),
- vec3(-0.700629, -0.509037, 0.5),
- vec3(0.267617, -0.823639, 0.5),
- vec3(0.0, 0.0, -1.0),
- vec3(0.866025, 0.0, -0.5),
- vec3(0.267617, 0.823639, -0.5),
- vec3(-0.700629, 0.509037, -0.5),
- vec3(-0.700629, -0.509037, -0.5),
- vec3(0.267617, -0.823639, -0.5));
-
- vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz;
- vec4 captured = vec4(0.0);
- float sum = 0.0;
- for (int i = 0; i < 12; i++) {
- float amount = max(0.0, dot(local_normal, cone_dirs[i])); //not correct, but creates a nice wrap around effect
- captured += lightmap_captures[i] * amount;
- sum += amount;
- }
-
- captured /= sum;
-
- if (lightmap_capture_sky) {
- ambient_light = mix(ambient_light, captured.rgb, captured.a);
- } else {
- ambient_light = captured.rgb;
- }
- }
-#endif
-
#ifdef USE_FORWARD_LIGHTING
- highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
- highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
- for (int i = 0; i < reflection_count; i++) {
- reflection_process(reflection_indices[i], vertex, normal, binormal, tangent, roughness, anisotropy, ambient_light, env_reflection_light, reflection_accum, ambient_accum);
- }
-
- if (reflection_accum.a > 0.0) {
- specular_light += reflection_accum.rgb / reflection_accum.a;
- } else {
- specular_light += env_reflection_light;
- }
-#if !defined(USE_LIGHTMAP) && !defined(USE_LIGHTMAP_CAPTURE)
- if (ambient_accum.a > 0.0) {
- ambient_light = ambient_accum.rgb / ambient_accum.a;
- }
-#endif
-
#ifdef USE_VERTEX_LIGHTING
diffuse_light *= albedo;
#else
for (int i = 0; i < omni_light_count; i++) {
- light_process_omni(omni_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light);
+ light_process_omni(omni_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light, alpha);
}
for (int i = 0; i < spot_light_count; i++) {
- light_process_spot(spot_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light);
+ light_process_spot(spot_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light, alpha);
}
#endif //USE_VERTEX_LIGHTING
#endif
+#ifdef USE_SHADOW_TO_OPACITY
+ alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
+
+#if defined(ALPHA_SCISSOR_USED)
+ if (alpha < alpha_scissor) {
+ discard;
+ }
+#endif // ALPHA_SCISSOR_USED
+
+#ifdef USE_OPAQUE_PREPASS
+
+ if (alpha < opaque_prepass_threshold) {
+ discard;
+ }
+
+#endif // USE_OPAQUE_PREPASS
+
+#endif // USE_SHADOW_TO_OPACITY
+
#ifdef RENDER_DEPTH
//nothing happens, so a tree-ssa optimizer will result in no fragment shader :)
#else
@@ -2058,26 +2113,6 @@ FRAGMENT_SHADER_CODE
diffuse_light *= 1.0 - metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
ambient_light *= 1.0 - metallic;
- {
-
-#if defined(DIFFUSE_TOON)
- //simplify for toon, as
- specular_light *= specular * metallic * albedo * 2.0;
-#else
- // Environment brdf approximation (Lazarov 2013)
- // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
- const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
- const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
- vec4 r = roughness * c0 + c1;
- float ndotv = clamp(dot(normal, eye_vec), 0.0, 1.0);
- float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
- vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
-
- vec3 f0 = F0(metallic, specular, albedo);
- specular_light *= env.x * f0 + env.y;
-#endif
- }
-
if (fog_color_enabled.a > 0.5) {
float fog_amount = 0.0;
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 97ba1de3db..9dc80244ff 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -26,9 +26,9 @@ if env['builtin_libpng']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_png.Append(CPPPATH=[thirdparty_dir])
+ env_png.Prepend(CPPPATH=[thirdparty_dir])
# Needed for drivers includes and in platform/javascript
- env.Append(CPPPATH=[thirdparty_dir])
+ env.Prepend(CPPPATH=[thirdparty_dir])
# Currently .ASM filter_neon.S does not compile on NT.
import os
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index 2dffa083fe..37abccbe27 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -177,6 +177,13 @@ NetSocketPosix::~NetSocketPosix() {
close();
}
+// Silent a warning reported in #27594
+
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wlogical-op"
+#endif
+
NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
#if defined(WINDOWS_ENABLED)
int err = WSAGetLastError();
@@ -201,6 +208,10 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
#endif
}
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
bool NetSocketPosix::_can_use_ip(const IP_Address p_ip, const bool p_for_bind) const {
if (p_for_bind && !(p_ip.is_valid() || p_ip.is_wildcard())) {
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 25cdc8d8a0..4de910ee1c 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -170,7 +170,7 @@ String OS_Unix::get_stdin_string(bool p_block) {
return "";
}
-String OS_Unix::get_name() {
+String OS_Unix::get_name() const {
return "Unix";
}
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 6a05877a8c..53446a6b6f 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -76,7 +76,7 @@ public:
virtual Error set_cwd(const String &p_cwd);
- virtual String get_name();
+ virtual String get_name() const;
virtual Date get_date(bool utc) const;
virtual Time get_time(bool utc) const;
diff --git a/editor/SCsub b/editor/SCsub
index 82a4ecb6c0..7d48e47c9f 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -79,9 +79,6 @@ if env['tools']:
env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header))
env.add_source_files(env.editor_sources, "*.cpp")
- env_thirdparty = env.Clone()
- env_thirdparty.disable_warnings()
- env_thirdparty.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
SConscript('collada/SCsub')
SConscript('doc/SCsub')
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index f6d4a2665c..e524dffd43 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -453,6 +453,8 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
ep.point_rect.size = bezier_icon->get_size();
if (selection.has(i)) {
draw_texture(selected_icon, ep.point_rect.position);
+ draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height() - 4), TTR("Time:") + " " + rtos(Math::stepify(offset, 0.001)), accent);
+ draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + rtos(Math::stepify(value, 0.001)), accent);
} else {
draw_texture(bezier_icon, ep.point_rect.position);
}
@@ -518,6 +520,12 @@ void AnimationBezierTrackEdit::set_animation_and_track(const Ref<Animation> &p_a
animation = p_animation;
track = p_track;
+ if (is_connected("select_key", editor, "_key_selected"))
+ disconnect("select_key", editor, "_key_selected");
+ if (is_connected("deselect_key", editor, "_key_deselected"))
+ disconnect("deselect_key", editor, "_key_deselected");
+ connect("select_key", editor, "_key_selected", varray(p_track), CONNECT_DEFERRED);
+ connect("deselect_key", editor, "_key_deselected", varray(p_track), CONNECT_DEFERRED);
update();
}
@@ -536,6 +544,7 @@ void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) {
}
void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) {
editor = p_editor;
+ connect("clear_selection", editor, "_clear_selection");
}
void AnimationBezierTrackEdit::_play_position_draw() {
@@ -578,6 +587,7 @@ String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const {
void AnimationBezierTrackEdit::_clear_selection() {
selection.clear();
+ emit_signal("clear_selection");
update();
}
@@ -598,6 +608,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int
ERR_FAIL_COND(idx < 0);
selection.insert(idx);
+ emit_signal("select_key", idx, true);
update();
}
@@ -653,20 +664,22 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
menu_insert_key = mb->get_position();
- Vector2 popup_pos = get_global_transform().xform(mb->get_position());
-
- menu->clear();
- menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
- if (selection.size()) {
- menu->add_separator();
- menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
- menu->add_separator();
- menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
- }
+ if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) {
+ Vector2 popup_pos = get_global_transform().xform(mb->get_position());
+
+ menu->clear();
+ menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
+ if (selection.size()) {
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
+ }
- menu->set_as_minsize();
- menu->set_position(popup_pos);
- menu->popup();
+ menu->set_as_minsize();
+ menu->set_position(popup_pos);
+ menu->popup();
+ }
}
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -678,6 +691,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
for (Map<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) {
if (E->get().has_point(mb->get_position())) {
set_animation_and_track(animation, E->key());
+ _clear_selection();
return;
}
}
@@ -850,7 +864,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
// 2- remove overlapped keys
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
- float newtime = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ float newtime = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x);
int idx = animation->track_find_key(track, newtime, true);
if (idx == -1)
@@ -872,7 +886,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
// 3-move the keys (re insert them)
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
- float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ float newpos = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x);
/*
if (newpos<0)
continue; //no add at the beginning
@@ -887,7 +901,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
// 4-(undo) remove inserted keys
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
- float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ float newpos = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x);
/*
if (newpos<0)
continue; //no remove what no inserted
@@ -924,7 +938,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
float oldpos = animation->track_get_key_time(track, E->get());
- float newpos = oldpos + moving_selection_offset.x;
+ float newpos = editor->snap_time(oldpos + moving_selection_offset.x);
undo_redo->add_do_method(this, "_select_at_anim", animation, track, newpos);
undo_redo->add_undo_method(this, "_select_at_anim", animation, track, oldpos);
@@ -965,7 +979,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll;
- float x = ((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
+ float x = editor->snap_time(((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value());
moving_selection_offset = Vector2(x - animation->track_get_key_time(track, moving_selection_from_key), y - animation->bezier_track_get_key_value(track, moving_selection_from_key));
update();
@@ -1154,8 +1168,8 @@ void AnimationBezierTrackEdit::_bind_methods() {
ClassDB::bind_method("_play_position_draw", &AnimationBezierTrackEdit::_play_position_draw);
ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection);
- ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection);
- ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_clear_selection);
+ ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection_for_anim);
+ ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_select_at_anim);
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index def55d6057..e8490e8729 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -63,8 +63,6 @@ public:
ClassDB::bind_method("_dont_undo_redo", &AnimationTrackKeyEdit::_dont_undo_redo);
}
- //PopupDialog *ke_dialog;
-
void _fix_node_path(Variant &value) {
NodePath np = value;
@@ -309,8 +307,8 @@ public:
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
Vector2 prev = animation->bezier_track_get_key_in_handle(track, key);
- undo_redo->add_do_method(animation.ptr(), "bezier_track_set_in_handle", track, key, value);
- undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_in_handle", track, key, prev);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev);
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
@@ -325,8 +323,8 @@ public:
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
Vector2 prev = animation->bezier_track_get_key_out_handle(track, key);
- undo_redo->add_do_method(animation.ptr(), "bezier_track_set_out_handle", track, key, value);
- undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_out_handle", track, key, prev);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev);
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
@@ -1215,7 +1213,8 @@ void AnimationTrackEdit::_notification(int p_what) {
if (has_focus()) {
Color accent = get_color("accent_color", "Editor");
accent.a *= 0.7;
- draw_rect(Rect2(Point2(), get_size()), accent, false);
+ // Offside so the horizontal sides aren't cutoff.
+ draw_rect(Rect2(Point2(1, 0), get_size() - Size2(1, 0)), accent, false);
}
Ref<Font> font = get_font("font", "Label");
@@ -1274,13 +1273,7 @@ void AnimationTrackEdit::_notification(int p_what) {
} else if (animation->track_get_type(track) == Animation::TYPE_ANIMATION) {
text = TTR("Anim Clips:");
} else {
- Vector<StringName> sn = path.get_subnames();
- for (int i = 0; i < sn.size(); i++) {
- if (i > 0) {
- text += ".";
- }
- text += sn[i];
- }
+ text += path.get_concatenated_subnames();
}
text_color.a *= 0.7;
} else if (node) {
@@ -1294,14 +1287,10 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
icon_cache = icon;
- text = node->get_name();
+ text = String() + node->get_name() + ":" + path.get_concatenated_subnames();
ofs += hsep;
ofs += icon->get_width();
- Vector<StringName> sn = path.get_subnames();
- for (int i = 0; i < sn.size(); i++) {
- text += ".";
- text += sn[i];
- }
+
} else {
icon_cache = type_icon;
@@ -2197,6 +2186,9 @@ Variant AnimationTrackEdit::get_drag_data(const Point2 &p_point) {
Dictionary drag_data;
drag_data["type"] = "animation_track";
+ String base_path = animation->track_get_path(track);
+ base_path = base_path.get_slice(":", 0); // Remove sub-path.
+ drag_data["group"] = base_path;
drag_data["index"] = track;
ToolButton *tb = memnew(ToolButton);
@@ -2217,8 +2209,18 @@ bool AnimationTrackEdit::can_drop_data(const Point2 &p_point, const Variant &p_d
}
String type = d["type"];
- if (type != "animation_track")
+ if (type != "animation_track") {
return false;
+ }
+
+ // Don't allow moving tracks outside their groups.
+ if (get_editor()->is_grouping_tracks()) {
+ String base_path = animation->track_get_path(track);
+ base_path = base_path.get_slice(":", 0); // Remove sub-path.
+ if (d["group"] != base_path) {
+ return false;
+ }
+ }
if (p_point.y < get_size().height / 2) {
dropping_at = -1;
@@ -2239,8 +2241,18 @@ void AnimationTrackEdit::drop_data(const Point2 &p_point, const Variant &p_data)
}
String type = d["type"];
- if (type != "animation_track")
+ if (type != "animation_track") {
return;
+ }
+
+ // Don't allow moving tracks outside their groups.
+ if (get_editor()->is_grouping_tracks()) {
+ String base_path = animation->track_get_path(track);
+ base_path = base_path.get_slice(":", 0); // Remove sub-path.
+ if (d["group"] != base_path) {
+ return;
+ }
+ }
int from_track = d["index"];
@@ -2547,6 +2559,15 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim) {
step->set_read_only(false);
snap->set_disabled(false);
snap_mode->set_disabled(false);
+
+ imported_anim_warning->hide();
+ for (int i = 0; i < animation->get_track_count(); i++) {
+ if (animation->track_is_imported(i)) {
+ imported_anim_warning->show();
+ break;
+ }
+ }
+
} else {
hscroll->hide();
edit->set_disabled(true);
@@ -2686,6 +2707,13 @@ void AnimationTrackEditor::_track_remove_request(int p_track) {
}
}
+void AnimationTrackEditor::_track_grab_focus(int p_track) {
+
+ // Don't steal focus if not working with the track editor.
+ if (Object::cast_to<AnimationTrackEdit>(get_focus_owner()))
+ track_edits[p_track]->grab_focus();
+}
+
void AnimationTrackEditor::set_anim_pos(float p_pos) {
timeline->set_play_position(p_pos);
@@ -3450,14 +3478,14 @@ void AnimationTrackEditor::_update_tracks() {
if (use_grouping) {
String base_path = animation->track_get_path(i);
- base_path = base_path.get_slice(":", 0); // remove subpath
+ base_path = base_path.get_slice(":", 0); // Remove sub-path.
if (!group_sort.has(base_path)) {
AnimationTrackEditGroup *g = memnew(AnimationTrackEditGroup);
Ref<Texture> icon = get_icon("Node", "EditorIcons");
String name = base_path;
String tooltip;
- if (root) {
+ if (root && root->has_node(base_path)) {
Node *n = root->get_node(base_path);
if (n) {
if (has_icon(n->get_class(), "EditorIcons")) {
@@ -3521,13 +3549,16 @@ void AnimationTrackEditor::_update_tracks() {
void AnimationTrackEditor::_animation_changed() {
if (animation_changing_awaiting_update) {
- return; //all will be updated, dont bother with anything
+ return; //all will be updated, don't bother with anything
}
if (key_edit && key_edit->setting) {
//if editing a key, just update the edited track, makes refresh less costly
if (key_edit->track < track_edits.size()) {
- track_edits[key_edit->track]->update();
+ if (animation->track_get_type(key_edit->track) == Animation::TYPE_BEZIER)
+ bezier_edit->update();
+ else
+ track_edits[key_edit->track]->update();
}
return;
}
@@ -3616,6 +3647,7 @@ void AnimationTrackEditor::_notification(int p_what) {
snap->set_icon(get_icon("Snap", "EditorIcons"));
view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
selected_filter->set_icon(get_icon("AnimationFilter", "EditorIcons"));
+ imported_anim_warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
main_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
}
@@ -3653,7 +3685,8 @@ void AnimationTrackEditor::_update_step(double p_new_step) {
step->set_block_signals(true);
undo_redo->commit_action();
step->set_block_signals(false);
- emit_signal("animation_step_changed", step_value);
+ emit_signal("animation_step_changed", p_new_step);
+ animation->_change_notify("step");
}
void AnimationTrackEditor::_update_length(double p_new_len) {
@@ -3662,17 +3695,18 @@ void AnimationTrackEditor::_update_length(double p_new_len) {
}
void AnimationTrackEditor::_dropped_track(int p_from_track, int p_to_track) {
- if (p_to_track >= track_edits.size()) {
- p_to_track = track_edits.size() - 1;
- }
-
- if (p_from_track == p_to_track)
+ if (p_from_track == p_to_track || p_from_track == p_to_track - 1) {
return;
+ }
_clear_selection();
undo_redo->create_action(TTR("Rearrange Tracks"));
- undo_redo->add_do_method(animation.ptr(), "track_swap", p_from_track, p_to_track);
- undo_redo->add_undo_method(animation.ptr(), "track_swap", p_to_track, p_from_track);
+ undo_redo->add_do_method(animation.ptr(), "track_move_to", p_from_track, p_to_track);
+ // Take into account that the position of the tracks that come after the one removed will change.
+ int to_track_real = p_to_track > p_from_track ? p_to_track - 1 : p_to_track;
+ undo_redo->add_undo_method(animation.ptr(), "track_move_to", to_track_real, p_to_track > p_from_track ? p_from_track : p_from_track + 1);
+ undo_redo->add_do_method(this, "_track_grab_focus", to_track_real);
+ undo_redo->add_undo_method(this, "_track_grab_focus", p_from_track);
undo_redo->commit_action();
}
@@ -4874,10 +4908,20 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
}
void AnimationTrackEditor::_view_group_toggle() {
+
_update_tracks();
view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
}
+bool AnimationTrackEditor::is_grouping_tracks() {
+
+ if (!view_group) {
+ return false;
+ }
+
+ return !view_group->is_pressed();
+}
+
void AnimationTrackEditor::_selection_changed() {
if (selected_filter->is_pressed()) {
@@ -4909,17 +4953,26 @@ float AnimationTrackEditor::snap_time(float p_value) {
return p_value;
}
+void AnimationTrackEditor::_show_imported_anim_warning() const {
+
+ EditorNode::get_singleton()->show_warning(TTR("This animation belongs to an imported scene, so changes to imported tracks will not be saved.\n\n"
+ "To enable the ability to add custom tracks, navigate to the scene's import settings and set\n"
+ "\"Animation > Storage\" to \"Files\", enable \"Animation > Keep Custom Tracks\", then re-import.\n"
+ "Alternatively, use an import preset that imports animations to separate files."),
+ TTR("Warning: Editing imported animation"));
+}
+
void AnimationTrackEditor::_bind_methods() {
ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed);
ClassDB::bind_method("_animation_update", &AnimationTrackEditor::_animation_update);
ClassDB::bind_method("_timeline_changed", &AnimationTrackEditor::_timeline_changed);
ClassDB::bind_method("_track_remove_request", &AnimationTrackEditor::_track_remove_request);
+ ClassDB::bind_method("_track_grab_focus", &AnimationTrackEditor::_track_grab_focus);
ClassDB::bind_method("_name_limit_changed", &AnimationTrackEditor::_name_limit_changed);
ClassDB::bind_method("_update_scroll", &AnimationTrackEditor::_update_scroll);
ClassDB::bind_method("_update_tracks", &AnimationTrackEditor::_update_tracks);
ClassDB::bind_method("_update_step", &AnimationTrackEditor::_update_step);
- ClassDB::bind_method("_update_length", &AnimationTrackEditor::_update_length);
ClassDB::bind_method("_dropped_track", &AnimationTrackEditor::_dropped_track);
ClassDB::bind_method("_add_track", &AnimationTrackEditor::_add_track);
ClassDB::bind_method("_new_track_node_selected", &AnimationTrackEditor::_new_track_node_selected);
@@ -4947,6 +5000,7 @@ void AnimationTrackEditor::_bind_methods() {
ClassDB::bind_method("_view_group_toggle", &AnimationTrackEditor::_view_group_toggle);
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);
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
ADD_SIGNAL(MethodInfo("keying_changed"));
@@ -4979,7 +5033,6 @@ AnimationTrackEditor::AnimationTrackEditor() {
timeline->connect("name_limit_changed", this, "_name_limit_changed");
timeline->connect("track_added", this, "_add_track");
timeline->connect("value_changed", this, "_timeline_value_changed");
- timeline->connect("length_changed", this, "_update_length");
scroll = memnew(ScrollContainer);
timeline_vbox->add_child(scroll);
@@ -5014,9 +5067,15 @@ AnimationTrackEditor::AnimationTrackEditor() {
scroll->set_enable_v_scroll(true);
track_vbox->add_constant_override("separation", 0);
- //timeline_vbox->add_child(memnew(HSeparator));
HBoxContainer *bottom_hb = memnew(HBoxContainer);
add_child(bottom_hb);
+
+ imported_anim_warning = memnew(Button);
+ imported_anim_warning->hide();
+ imported_anim_warning->set_tooltip(TTR("Warning: Editing imported animation"));
+ imported_anim_warning->connect("pressed", this, "_show_imported_anim_warning");
+ bottom_hb->add_child(imported_anim_warning);
+
bottom_hb->add_spacer();
selected_filter = memnew(ToolButton);
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 5ac5999b68..c64f663b3b 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -309,6 +309,9 @@ class AnimationTrackEditor : public VBoxContainer {
ToolButton *snap;
OptionButton *snap_mode;
+ Button *imported_anim_warning;
+ void _show_imported_anim_warning() const;
+
void _snap_mode_changed(int p_mode);
Vector<AnimationTrackEdit *> track_edits;
Vector<AnimationTrackEditGroup *> groups;
@@ -322,6 +325,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _name_limit_changed();
void _timeline_changed(float p_new_pos, bool p_drag);
void _track_remove_request(int p_track);
+ void _track_grab_focus(int p_track);
UndoRedo *undo_redo;
@@ -510,6 +514,7 @@ public:
float get_moving_selection_offset() const;
bool is_snap_enabled();
float snap_time(float p_value);
+ bool is_grouping_tracks();
MenuButton *get_edit_menu();
AnimationTrackEditor();
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index d655f52f5d..695560ca34 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -755,6 +755,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size"));
text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
+ text_editor->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/indent/draw_spaces"));
text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded"));
text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_length_guideline"));
@@ -764,6 +765,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
+ text_editor->set_bookmark_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_bookmark_gutter"));
text_editor->set_breakpoint_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter"));
text_editor->set_hiding_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding"));
text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding"));
@@ -1203,6 +1205,7 @@ Variant CodeTextEditor::get_edit_state() {
state["folded_lines"] = text_editor->get_folded_lines();
state["breakpoints"] = text_editor->get_breakpoints_array();
+ state["bookmarks"] = text_editor->get_bookmarks_array();
state["syntax_highlighter"] = TTR("Standard");
SyntaxHighlighter *syntax_highlighter = text_editor->_get_syntax_highlighting();
@@ -1240,6 +1243,13 @@ void CodeTextEditor::set_edit_state(const Variant &p_state) {
}
}
+ if (state.has("bookmarks")) {
+ Array bookmarks = state["bookmarks"];
+ for (int i = 0; i < bookmarks.size(); i++) {
+ text_editor->set_line_as_bookmark(bookmarks[i], true);
+ }
+ }
+
text_editor->grab_focus();
}
@@ -1297,6 +1307,8 @@ void CodeTextEditor::_on_settings_change() {
text_editor->set_callhint_settings(
EDITOR_DEF("text_editor/completion/put_callhint_tooltip_below_current_line", true),
EDITOR_DEF("text_editor/completion/callhint_tooltip_offset", Vector2()));
+
+ idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay", 2.0));
}
void CodeTextEditor::_text_changed_idle_timeout() {
@@ -1355,6 +1367,70 @@ void CodeTextEditor::set_warning_nb(int p_warning_nb) {
_set_show_warnings_panel(false);
}
+void CodeTextEditor::toggle_bookmark() {
+
+ int line = text_editor->cursor_get_line();
+ text_editor->set_line_as_bookmark(line, !text_editor->is_line_set_as_bookmark(line));
+}
+
+void CodeTextEditor::goto_next_bookmark() {
+
+ List<int> bmarks;
+ text_editor->get_bookmarks(&bmarks);
+ if (bmarks.size() <= 0) {
+ return;
+ }
+
+ int line = text_editor->cursor_get_line();
+ if (line >= bmarks[bmarks.size() - 1]) {
+ text_editor->unfold_line(bmarks[0]);
+ text_editor->cursor_set_line(bmarks[0]);
+ } else {
+ for (List<int>::Element *E = bmarks.front(); E; E = E->next()) {
+ int bline = E->get();
+ if (bline > line) {
+ text_editor->unfold_line(bline);
+ text_editor->cursor_set_line(bline);
+ return;
+ }
+ }
+ }
+}
+
+void CodeTextEditor::goto_prev_bookmark() {
+
+ List<int> bmarks;
+ text_editor->get_bookmarks(&bmarks);
+ if (bmarks.size() <= 0) {
+ return;
+ }
+
+ int line = text_editor->cursor_get_line();
+ if (line <= bmarks[0]) {
+ text_editor->unfold_line(bmarks[bmarks.size() - 1]);
+ text_editor->cursor_set_line(bmarks[bmarks.size() - 1]);
+ } else {
+ for (List<int>::Element *E = bmarks.back(); E; E = E->prev()) {
+ int bline = E->get();
+ if (bline < line) {
+ text_editor->unfold_line(bline);
+ text_editor->cursor_set_line(bline);
+ return;
+ }
+ }
+ }
+}
+
+void CodeTextEditor::remove_all_bookmarks() {
+
+ List<int> bmarks;
+ text_editor->get_bookmarks(&bmarks);
+
+ for (List<int>::Element *E = bmarks.front(); E; E = E->next()) {
+ text_editor->set_line_as_bookmark(E->get(), false);
+ }
+}
+
void CodeTextEditor::_bind_methods() {
ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input);
@@ -1411,7 +1487,7 @@ CodeTextEditor::CodeTextEditor() {
idle = memnew(Timer);
add_child(idle);
idle->set_one_shot(true);
- idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay", 2));
+ idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay", 2.0));
code_complete_timer = memnew(Timer);
add_child(code_complete_timer);
diff --git a/editor/code_editor.h b/editor/code_editor.h
index b98af377ce..5c6b54ae44 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -234,6 +234,11 @@ public:
virtual void apply_code() {}
void goto_error();
+ void toggle_bookmark();
+ void goto_next_bookmark();
+ void goto_prev_bookmark();
+ void remove_all_bookmarks();
+
void set_code_complete_func(CodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud);
CodeTextEditor();
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 765fd023fa..b03fa78030 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -714,6 +714,7 @@ CreateDialog::CreateDialog() {
favorites->connect("cell_selected", this, "_favorite_selected");
favorites->connect("item_activated", this, "_favorite_activated");
favorites->set_drag_forwarding(this);
+ favorites->add_constant_override("draw_guides", 1);
VBoxContainer *rec_vb = memnew(VBoxContainer);
vsc->add_child(rec_vb);
@@ -726,6 +727,7 @@ CreateDialog::CreateDialog() {
recent->set_hide_folding(true);
recent->connect("cell_selected", this, "_history_selected");
recent->connect("item_activated", this, "_history_activated");
+ recent->add_constant_override("draw_guides", 1);
VBoxContainer *vbc = memnew(VBoxContainer);
hsc->add_child(vbc);
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 5df2b687cc..bde73e9268 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -225,9 +225,9 @@ void DependencyEditor::edit(const String &p_path) {
popup_centered_ratio();
if (EditorNode::get_singleton()->is_scene_open(p_path)) {
- EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will not take effect unless reloaded."), p_path.get_file()));
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will only take effect when reloaded."), p_path.get_file()));
} else if (ResourceCache::has(p_path)) {
- EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will take effect when reloaded."), p_path.get_file()));
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will only take effect when reloaded."), p_path.get_file()));
}
}
diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp
index 6ccf0e26ea..866d57e054 100644
--- a/editor/doc/doc_dump.cpp
+++ b/editor/doc/doc_dump.cpp
@@ -111,7 +111,7 @@ void DocDump::dump(const String &p_file) {
for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
if (E->get().name == "" || E->get().name[0] == '_')
- continue; //hiden
+ continue; //hidden
MethodBind *m = ClassDB::get_method(name, E->get().name);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 2beb0153f4..9cd7d781a4 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -322,13 +322,13 @@ void EditorAudioBus::_volume_changed(float p_normalized) {
float EditorAudioBus::_normalized_volume_to_scaled_db(float normalized) {
/* There are three different formulas for the conversion from normalized
- * values to relative decibal values.
- * One formula is an exponential graph which intends to counteract
- * the logorithmic nature of human hearing. This is an approximation
- * of the behaviour of a 'logarithmic potentiometer' found on most
- * musical instruments and also emulated in popular software.
- * The other two equations are hand-tuned linear tapers that intend to
- * try to ease the exponential equation in areas where it makes sense.*/
+ * values to relative decibal values.
+ * One formula is an exponential graph which intends to counteract
+ * the logorithmic nature of human hearing. This is an approximation
+ * of the behaviour of a 'logarithmic potentiometer' found on most
+ * musical instruments and also emulated in popular software.
+ * The other two equations are hand-tuned linear tapers that intend to
+ * try to ease the exponential equation in areas where it makes sense.*/
if (normalized > 0.6f) {
return 22.22f * normalized - 16.2f;
@@ -341,16 +341,16 @@ float EditorAudioBus::_normalized_volume_to_scaled_db(float normalized) {
float EditorAudioBus::_scaled_db_to_normalized_volume(float db) {
/* Inversion of equations found in _normalized_volume_to_scaled_db.
- * IMPORTANT: If one function changes, the other much change to reflect it. */
+ * IMPORTANT: If one function changes, the other much change to reflect it. */
if (db > -2.88) {
return (db + 16.2f) / 22.22f;
} else if (db < -38.602f) {
return (db + 80.00f) / 830.72f;
} else {
if (db < 0.0) {
- /* To acommodate for NaN on negative numbers for root, we will mirror the
- * results of the postive db range in order to get the desired numerical
- * value on the negative side. */
+ /* To accommodate for NaN on negative numbers for root, we will mirror the
+ * results of the positive db range in order to get the desired numerical
+ * value on the negative side. */
float positive_x = Math::pow(Math::abs(db) / 45.0f, 1.0f / 3.0f) + 1.0f;
Vector2 translation = Vector2(1.0f, 0.0f) - Vector2(positive_x, Math::abs(db));
Vector2 reflected_position = Vector2(1.0, 0.0f) + translation;
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 2f2b0d2cba..e0c90808a0 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -638,12 +638,12 @@ void EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
String path = p_path;
if (!FileAccess::exists(path)) {
- EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("File does not exist."));
+ EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist."));
return;
}
if (!path.begins_with("res://")) {
- EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("Not in resource path."));
+ EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("Not in resource path."));
return;
}
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index e8cf730796..e04bca2a9e 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -133,7 +133,7 @@ void EditorDirDialog::_make_dir() {
TreeItem *ti = tree->get_selected();
if (!ti) {
- mkdirerr->set_text(TTR("Please select a base directory first"));
+ mkdirerr->set_text(TTR("Please select a base directory first."));
mkdirerr->popup_centered_minsize();
return;
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index dc43faeff1..37f148bdbb 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -335,7 +335,9 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa
pd->file_ofs.push_back(sd);
- pd->ep->step(TTR("Storing File:") + " " + p_path, 2 + p_file * 100 / p_total, false);
+ if (pd->ep->step(TTR("Storing File:") + " " + p_path, 2 + p_file * 100 / p_total, false)) {
+ return ERR_SKIP;
+ }
return OK;
}
@@ -362,7 +364,9 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat
zipWriteInFileInZip(zip, p_data.ptr(), p_data.size());
zipCloseFileInZip(zip);
- zd->ep->step(TTR("Storing File:") + " " + p_path, 2 + p_file * 100 / p_total, false);
+ if (zd->ep->step(TTR("Storing File:") + " " + p_path, 2 + p_file * 100 / p_total, false)) {
+ return ERR_SKIP;
+ }
return OK;
}
@@ -611,6 +615,7 @@ void EditorExportPlugin::_bind_methods() {
BIND_VMETHOD(MethodInfo("_export_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "type"), PropertyInfo(Variant::POOL_STRING_ARRAY, "features")));
BIND_VMETHOD(MethodInfo("_export_begin", PropertyInfo(Variant::POOL_STRING_ARRAY, "features"), PropertyInfo(Variant::BOOL, "is_debug"), PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "flags")));
+ BIND_VMETHOD(MethodInfo("_export_end"));
}
EditorExportPlugin::EditorExportPlugin() {
@@ -688,6 +693,10 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
}
}
+ //add native icons to non-resource include list
+ _edit_filter_list(paths, String("*.icns"), false);
+ _edit_filter_list(paths, String("*.ico"), false);
+
_edit_filter_list(paths, p_preset->get_include_filter(), false);
_edit_filter_list(paths, p_preset->get_exclude_filter(), true);
@@ -749,27 +758,37 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
this->resolve_platform_feature_priorities(p_preset, remap_features);
}
+ err = OK;
+
for (List<String>::Element *F = remaps.front(); F; F = F->next()) {
String remap = F->get();
if (remap == "path") {
String remapped_path = config->get_value("remap", remap);
Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
- p_func(p_udata, remapped_path, array, idx, total);
+ err = p_func(p_udata, remapped_path, array, idx, total);
} else if (remap.begins_with("path.")) {
String feature = remap.get_slice(".", 1);
if (remap_features.has(feature)) {
String remapped_path = config->get_value("remap", remap);
Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
- p_func(p_udata, remapped_path, array, idx, total);
+ err = p_func(p_udata, remapped_path, array, idx, total);
}
}
}
+ if (err != OK) {
+ return err;
+ }
+
//also save the .import file
Vector<uint8_t> array = FileAccess::get_file_as_array(path + ".import");
- p_func(p_udata, path + ".import", array, idx, total);
+ err = p_func(p_udata, path + ".import", array, idx, total);
+
+ if (err != OK) {
+ return err;
+ }
} else {
@@ -884,7 +903,7 @@ Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObj
Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files) {
- EditorProgress ep("savepack", TTR("Packing"), 102);
+ EditorProgress ep("savepack", TTR("Packing"), 102, true);
String tmppath = EditorSettings::get_singleton()->get_cache_dir().plus_file("packtmp");
FileAccess *ftmp = FileAccess::open(tmppath, FileAccess::WRITE);
@@ -982,7 +1001,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
- EditorProgress ep("savezip", TTR("Packing"), 102);
+ EditorProgress ep("savezip", TTR("Packing"), 102, true);
//FileAccess *tmp = FileAccess::open(tmppath,FileAccess::WRITE);
@@ -995,7 +1014,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
zd.zip = zip;
Error err = export_project_files(p_preset, _save_zip_file, &zd);
- if (err != OK)
+ if (err != OK && err != ERR_SKIP)
ERR_PRINT("Failed to export project files");
zipClose(zip, NULL);
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index abd3bea951..4ddb28b440 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -218,7 +218,7 @@ void EditorFileSystem::_scan_filesystem() {
if (first_scan) {
// only use this on first scan, afterwards it gets ignored
// this is so on first reimport we synchronize versions, then
- // we dont care until editor restart. This is for usability mainly so
+ // we don't care until editor restart. This is for usability mainly so
// your workflow is not killed after changing a setting by forceful reimporting
// everything there is.
filesystem_settings_version_for_import = l.strip_edges();
@@ -844,7 +844,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
bool updated_dir = false;
String cd = p_dir->get_path();
- if (current_mtime != p_dir->modified_time || using_fat_32) {
+ if (current_mtime != p_dir->modified_time || using_fat32_or_exfat) {
updated_dir = true;
p_dir->modified_time = current_mtime;
@@ -2140,8 +2140,8 @@ EditorFileSystem::EditorFileSystem() {
if (da->change_dir("res://.import") != OK) {
da->make_dir("res://.import");
}
- //this should probably also work on Unix and use the string it returns for FAT32
- using_fat_32 = da->get_filesystem_type() == "FAT32";
+ // This should probably also work on Unix and use the string it returns for FAT32 or exFAT
+ using_fat32_or_exfat = (da->get_filesystem_type() == "FAT32" || da->get_filesystem_type() == "exFAT");
memdelete(da);
scan_total = 0;
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 8943706202..72d9489f21 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -237,7 +237,7 @@ class EditorFileSystem : public Node {
static Error _resource_import(const String &p_path);
- bool using_fat_32; //workaround for projects in FAT32 filesystem (pendrives, most of the time)
+ bool using_fat32_or_exfat; // Workaround for projects in FAT32 or exFAT filesystem (pendrives, most of the time)
void _find_group_files(EditorFileSystemDirectory *efd, Map<String, Vector<String> > &group_files, Set<String> &groups_to_reimport);
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index f6079624de..96653fec70 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -92,7 +92,7 @@ void EditorFolding::load_resource_folding(RES p_resource, const String &p_path)
_set_unfolds(p_resource.ptr(), unfolds);
}
-void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array& nodes_folded,Set<RES> &resources) {
+void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array &nodes_folded, Set<RES> &resources) {
if (p_root != p_node) {
if (!p_node->get_owner()) {
return; //not owned, bye
@@ -130,7 +130,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p
}
for (int i = 0; i < p_node->get_child_count(); i++) {
- _fill_folds(p_root, p_node->get_child(i), p_folds, resource_folds, nodes_folded,resources);
+ _fill_folds(p_root, p_node->get_child(i), p_folds, resource_folds, nodes_folded, resources);
}
}
void EditorFolding::save_scene_folding(const Node *p_scene, const String &p_path) {
@@ -205,7 +205,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) {
_set_unfolds(res.ptr(), unfolds2);
}
- for(int i=0;i<nodes_folded.size();i++) {
+ for (int i = 0; i < nodes_folded.size(); i++) {
NodePath fold_path = nodes_folded[i];
if (p_scene->has_node(fold_path)) {
Node *node = p_scene->get_node(fold_path);
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index fa4172cded..5b16b8f6d5 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -239,6 +239,9 @@ void editor_register_fonts(Ref<Theme> p_theme) {
MAKE_SOURCE_FONT(df_code, int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) * EDSCALE);
p_theme->set_font("source", "EditorFonts", df_code);
+ MAKE_SOURCE_FONT(df_expression, (int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) - 1) * EDSCALE);
+ p_theme->set_font("expression", "EditorFonts", df_expression);
+
MAKE_SOURCE_FONT(df_output_code, int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
p_theme->set_font("output_source", "EditorFonts", df_output_code);
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index aaca47622d..b5cdc76115 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -78,10 +78,19 @@ void EditorLog::_clear_request() {
tool_button->set_icon(Ref<Texture>());
}
+void EditorLog::_copy_request() {
+
+ log->selection_copy();
+}
+
void EditorLog::clear() {
_clear_request();
}
+void EditorLog::copy() {
+ _copy_request();
+}
+
void EditorLog::add_message(const String &p_msg, MessageType p_type) {
log->add_newline();
@@ -125,7 +134,9 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) {
void EditorLog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_clear_request"), &EditorLog::_clear_request);
+ ClassDB::bind_method(D_METHOD("_copy_request"), &EditorLog::_copy_request);
ADD_SIGNAL(MethodInfo("clear_request"));
+ ADD_SIGNAL(MethodInfo("copy_request"));
}
EditorLog::EditorLog() {
@@ -139,6 +150,12 @@ EditorLog::EditorLog() {
title->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(title);
+ copybutton = memnew(Button);
+ hb->add_child(copybutton);
+ copybutton->set_text(TTR("Copy"));
+ copybutton->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C));
+ copybutton->connect("pressed", this, "_copy_request");
+
clearbutton = memnew(Button);
hb->add_child(clearbutton);
clearbutton->set_text(TTR("Clear"));
diff --git a/editor/editor_log.h b/editor/editor_log.h
index 13318fd68f..bb56bd34fe 100644
--- a/editor/editor_log.h
+++ b/editor/editor_log.h
@@ -48,6 +48,7 @@ class EditorLog : public VBoxContainer {
GDCLASS(EditorLog, VBoxContainer);
Button *clearbutton;
+ Button *copybutton;
Label *title;
RichTextLabel *log;
HBoxContainer *title_hb;
@@ -62,6 +63,7 @@ class EditorLog : public VBoxContainer {
//void _dragged(const Point2& p_ofs);
void _clear_request();
+ void _copy_request();
static void _undo_redo_cbk(void *p_self, const String &p_name);
protected:
@@ -80,6 +82,7 @@ public:
void deinit();
void clear();
+ void copy();
EditorLog();
~EditorLog();
};
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 8aa8a32d7d..7bf6922205 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1015,8 +1015,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
y = (img->get_height() - size) / 2;
img->crop_from_point(x, y, size, size);
- // We could get better pictures with better filters
- img->resize(preview_size, preview_size, Image::INTERPOLATE_CUBIC);
+ img->resize(preview_size, preview_size, Image::INTERPOLATE_LANCZOS);
}
img->convert(Image::FORMAT_RGB8);
@@ -1271,6 +1270,11 @@ void EditorNode::_dialog_action(String p_file) {
switch (current_option) {
case FILE_NEW_INHERITED_SCENE: {
+ Node *scene = editor_data.get_edited_scene_root();
+ // If the previous scene is rootless, just close it in favor of the new one.
+ if (!scene)
+ _menu_option_confirm(FILE_CLOSE, false);
+
load_scene(p_file, false, true);
} break;
case FILE_OPEN_SCENE: {
@@ -1631,7 +1635,7 @@ void EditorNode::_edit_current() {
editable_warning = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
} else {
if ((!get_edited_scene() || get_edited_scene()->get_filename() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") {
- editable_warning = TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it will not be kept when saving the current scene.");
+ editable_warning = TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it won't be kept when saving the current scene.");
}
}
} else if (current_res->get_path().is_resource_file()) {
@@ -1656,14 +1660,14 @@ void EditorNode::_edit_current() {
if (get_edited_scene() && get_edited_scene()->get_filename() != String()) {
String source_scene = get_edited_scene()->get_filename();
if (FileAccess::exists(source_scene + ".import")) {
- editable_warning = TTR("This scene was imported, so changes to it will not be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
+ editable_warning = TTR("This scene was imported, so changes to it won't be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
}
}
} else {
if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) {
- editable_warning = TTR("This is a remote object so changes to it will not be kept.\nPlease read the documentation relevant to debugging to better understand this workflow.");
+ editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow.");
capitalize = false;
disable_folding = true;
}
@@ -1951,6 +1955,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_scene_tab_closed(editor_data.get_edited_scene());
}
+ if (p_confirmed)
+ _menu_option_confirm(SCENE_TAB_CLOSE, true);
+
} break;
case FILE_CLOSE_ALL_AND_QUIT:
case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
@@ -2283,10 +2290,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
project_settings->popup_project_settings();
} break;
- case RUN_PROJECT_DATA_FOLDER: {
-
- OS::get_singleton()->shell_open(String("file://") + OS::get_singleton()->get_user_data_dir());
- } break;
case FILE_INSTALL_ANDROID_SOURCE: {
if (p_confirmed) {
@@ -2516,6 +2519,9 @@ void EditorNode::_tool_menu_option(int p_idx) {
case TOOLS_ORPHAN_RESOURCES: {
orphan_resources->show();
} break;
+ case RUN_PROJECT_DATA_FOLDER: {
+ OS::get_singleton()->shell_open(String("file://") + OS::get_singleton()->get_user_data_dir());
+ } break;
case TOOLS_CUSTOM: {
if (tool_menu->get_item_submenu(p_idx) == "") {
Array params = tool_menu->get_item_metadata(p_idx);
@@ -3238,6 +3244,12 @@ InspectorDock *EditorNode::get_inspector_dock() {
return inspector_dock;
}
+void EditorNode::_inherit_request(String p_file) {
+
+ current_option = FILE_NEW_INHERITED_SCENE;
+ _dialog_action(p_file);
+}
+
void EditorNode::_instance_request(const Vector<String> &p_files) {
request_instance_scenes(p_files);
@@ -5011,6 +5023,7 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_get_scene_metadata", &EditorNode::_get_scene_metadata);
ClassDB::bind_method("set_edited_scene", &EditorNode::set_edited_scene);
ClassDB::bind_method("open_request", &EditorNode::open_request);
+ ClassDB::bind_method("_inherit_request", &EditorNode::_inherit_request);
ClassDB::bind_method("_instance_request", &EditorNode::_instance_request);
ClassDB::bind_method("_close_messages", &EditorNode::_close_messages);
ClassDB::bind_method("_show_messages", &EditorNode::_show_messages);
@@ -5978,7 +5991,7 @@ EditorNode::EditorNode() {
node_dock = memnew(NodeDock);
filesystem_dock = memnew(FileSystemDock(this));
- filesystem_dock->connect("open", this, "open_request");
+ filesystem_dock->connect("inherit", this, "_inherit_request");
filesystem_dock->connect("instance", this, "_instance_request");
filesystem_dock->connect("display_mode_changed", this, "_save_docks");
@@ -6383,7 +6396,7 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2);
ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack needed for script editor F3 search to work :) Assign like this or don't use F3
- ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F4);
+ ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_MASK_SHIFT | KEY_F1);
#endif
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"));
ED_SHORTCUT("editor/editor_next", TTR("Open the next Editor"));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 0084d421f9..cfe8bf9ec4 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -474,6 +474,7 @@ private:
int _next_unsaved_scene(bool p_valid_filename, int p_start = 0);
void _discard_changes(const String &p_str = String());
+ void _inherit_request(String p_file);
void _instance_request(const Vector<String> &p_files);
void _display_top_editors(bool p_display);
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index e3dc517a39..5f18959689 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -645,7 +645,7 @@ void EditorPropertyDictionary::update_property() {
page->set_h_size_flags(SIZE_EXPAND_FILL);
page->connect("value_changed", this, "_page_changed");
} else {
- // Queue childs for deletion, delete immediately might cause errors.
+ // Queue children for deletion, deleting immediately might cause errors.
for (int i = 1; i < vbox->get_child_count(); i++) {
vbox->get_child(i)->queue_delete();
}
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 173333dac9..2baad8c904 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -71,7 +71,21 @@ Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String &p_
return generate(res, p_size);
}
-bool EditorResourcePreviewGenerator::should_generate_small_preview() const {
+bool EditorResourcePreviewGenerator::generate_small_preview_automatically() const {
+
+ if (get_script_instance() && get_script_instance()->has_method("generate_small_preview_automatically")) {
+ return get_script_instance()->call("generate_small_preview_automatically");
+ }
+
+ return false;
+}
+
+bool EditorResourcePreviewGenerator::can_generate_small_preview() const {
+
+ if (get_script_instance() && get_script_instance()->has_method("can_generate_small_preview")) {
+ return get_script_instance()->call("can_generate_small_preview");
+ }
+
return false;
}
@@ -80,6 +94,8 @@ void EditorResourcePreviewGenerator::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::STRING, "type")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::VECTOR2, "size")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE), PropertyInfo(Variant::VECTOR2, "size")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "generate_small_preview_automatically"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "can_generate_small_preview"));
}
EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() {
@@ -154,16 +170,27 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
}
r_texture = generated;
- if (r_texture.is_valid() && preview_generators[i]->should_generate_small_preview()) {
- int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size
- small_thumbnail_size *= EDSCALE;
+ int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size
+ small_thumbnail_size *= EDSCALE;
+ if (preview_generators[i]->can_generate_small_preview()) {
+ Ref<Texture> generated_small;
+ if (p_item.resource.is_valid()) {
+ generated_small = preview_generators[i]->generate(p_item.resource, Vector2(small_thumbnail_size, small_thumbnail_size));
+ } else {
+ generated_small = preview_generators[i]->generate_from_path(p_item.path, Vector2(small_thumbnail_size, small_thumbnail_size));
+ }
+ r_small_texture = generated_small;
+ }
+
+ if (!r_small_texture.is_valid() && r_texture.is_valid() && preview_generators[i]->generate_small_preview_automatically()) {
Ref<Image> small_image = r_texture->get_data();
small_image = small_image->duplicate();
small_image->resize(small_thumbnail_size, small_thumbnail_size, Image::INTERPOLATE_CUBIC);
r_small_texture.instance();
r_small_texture->create_from_image(small_image);
}
+
break;
}
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 9b9223a818..e0fd54c924 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -48,7 +48,8 @@ public:
virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
virtual Ref<Texture> generate_from_path(const String &p_path, const Size2 p_size) const;
- virtual bool should_generate_small_preview() const;
+ virtual bool generate_small_preview_automatically() const;
+ virtual bool can_generate_small_preview() const;
EditorResourcePreviewGenerator();
};
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index bf582ca004..79dcbca7a2 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -268,6 +268,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
String host_lang = OS::get_singleton()->get_locale();
host_lang = TranslationServer::standardize_locale(host_lang);
+ // Some locales are not properly supported currently in Godot due to lack of font shaping
+ // (e.g. Arabic or Hindi), so even though we have work in progress translations for them,
+ // we skip them as they don't render properly. (GH-28577)
+ const Vector<String> locales_to_skip = String("ar,bn,fa,he,hi,ml,si,ta,te,ur").split(",");
+
String best;
EditorTranslationList *etl = _editor_translations;
@@ -275,6 +280,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
while (etl->data) {
const String &locale = etl->lang;
+
+ // Skip locales which we can't render properly (see above comment).
+ // Test against language code without regional variants (e.g. ur_PK).
+ String lang_code = locale.get_slice("_", 0);
+ if (locales_to_skip.find(lang_code) != -1) {
+ etl++;
+ continue;
+ }
+
lang_hint += ",";
lang_hint += locale;
@@ -407,6 +421,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/theme/color_theme", "Adaptive");
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom");
_initial_set("text_editor/theme/line_spacing", 6);
+ hints["text_editor/theme/line_spacing"] = PropertyInfo(Variant::INT, "text_editor/theme/line_spacing", PROPERTY_HINT_RANGE, "0,50,1");
_load_default_text_editor_theme();
@@ -424,10 +439,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/indent/auto_indent", true);
_initial_set("text_editor/indent/convert_indent_on_save", false);
_initial_set("text_editor/indent/draw_tabs", true);
+ _initial_set("text_editor/indent/draw_spaces", false);
// Line numbers
_initial_set("text_editor/line_numbers/show_line_numbers", true);
_initial_set("text_editor/line_numbers/line_numbers_zero_padded", false);
+ _initial_set("text_editor/line_numbers/show_bookmark_gutter", true);
_initial_set("text_editor/line_numbers/show_breakpoint_gutter", true);
_initial_set("text_editor/line_numbers/show_info_gutter", true);
_initial_set("text_editor/line_numbers/code_folding", true);
@@ -459,12 +476,14 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/cursor/right_click_moves_caret", true);
// Completion
- _initial_set("text_editor/completion/idle_parse_delay", 2);
+ _initial_set("text_editor/completion/idle_parse_delay", 2.0);
+ hints["text_editor/completion/idle_parse_delay"] = PropertyInfo(Variant::REAL, "text_editor/completion/idle_parse_delay", PROPERTY_HINT_RANGE, "0.1, 10, 0.01");
_initial_set("text_editor/completion/auto_brace_complete", false);
_initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true);
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
_initial_set("text_editor/completion/complete_file_paths", true);
_initial_set("text_editor/completion/add_type_hints", false);
+ _initial_set("text_editor/completion/use_single_quotes", false);
// Help
_initial_set("text_editor/help/show_help_index", true);
@@ -542,7 +561,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/2d/bone_ik_color", Color(0.9, 0.9, 0.45, 0.9));
_initial_set("editors/2d/bone_outline_color", Color(0.35, 0.35, 0.35));
_initial_set("editors/2d/bone_outline_size", 2);
- _initial_set("editors/2d/keep_margins_when_changing_anchors", false);
_initial_set("editors/2d/viewport_border_color", Color(0.4, 0.4, 1.0, 0.4));
_initial_set("editors/2d/warped_mouse_panning", true);
_initial_set("editors/2d/simple_spacebar_panning", false);
@@ -644,11 +662,12 @@ void EditorSettings::_load_default_text_editor_theme() {
_initial_set("text_editor/highlighting/function_color", Color::html("66a2ce"));
_initial_set("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
_initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
+ _initial_set("text_editor/highlighting/bookmark_color", Color(0.08, 0.49, 0.98));
_initial_set("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
_initial_set("text_editor/highlighting/executing_line_color", Color(0.2, 0.8, 0.2, 0.4));
_initial_set("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8));
_initial_set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
- _initial_set("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
+ _initial_set("text_editor/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38));
}
bool EditorSettings::_save_text_editor_theme(String p_file) {
@@ -970,6 +989,9 @@ void EditorSettings::setup_network() {
// link-local IPv6 addresses don't work, skipping them
if (ip.begins_with("fe80:0:0:0:")) // fe80::/64
continue;
+ // Same goes for IPv4 link-local (APIPA) addresses.
+ if (ip.begins_with("169.254.")) // 169.254.0.0/16
+ continue;
if (ip == current)
lip = current; //so it saves
if (hint != "")
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index b8dd29cecc..ff38b4b650 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -585,7 +585,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("hover", "CheckButton", style_menu);
theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons"));
+ theme->set_icon("on_disabled", "CheckButton", theme->get_icon("GuiToggleOnDisabled", "EditorIcons"));
theme->set_icon("off", "CheckButton", theme->get_icon("GuiToggleOff", "EditorIcons"));
+ theme->set_icon("off_disabled", "CheckButton", theme->get_icon("GuiToggleOffDisabled", "EditorIcons"));
theme->set_color("font_color", "CheckButton", font_color);
theme->set_color("font_color_hover", "CheckButton", font_color_hl);
@@ -831,6 +833,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("read_only", "TextEdit", style_widget_disabled);
theme->set_constant("side_margin", "TabContainer", 0);
theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons"));
+ theme->set_icon("space", "TextEdit", theme->get_icon("GuiSpace", "EditorIcons"));
theme->set_icon("folded", "TextEdit", theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
theme->set_icon("fold", "TextEdit", theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
theme->set_color("font_color", "TextEdit", font_color);
@@ -1115,11 +1118,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color function_color = main_color;
const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6);
const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3);
+ const Color bookmark_color = Color(0.08, 0.49, 0.98);
const Color breakpoint_color = error_color;
const Color executing_line_color = Color(0.2, 0.8, 0.2, 0.4);
const Color code_folding_color = alpha3;
const Color search_result_color = alpha1;
- const Color search_result_border_color = alpha3;
+ const Color search_result_border_color = Color(0.41, 0.61, 0.91, 0.38);
EditorSettings *setting = EditorSettings::get_singleton();
String text_editor_color_theme = setting->get("text_editor/theme/color_theme");
@@ -1151,6 +1155,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
setting->set_initial_value("text_editor/highlighting/function_color", function_color, true);
setting->set_initial_value("text_editor/highlighting/member_variable_color", member_variable_color, true);
setting->set_initial_value("text_editor/highlighting/mark_color", mark_color, true);
+ setting->set_initial_value("text_editor/highlighting/bookmark_color", bookmark_color, true);
setting->set_initial_value("text_editor/highlighting/breakpoint_color", breakpoint_color, true);
setting->set_initial_value("text_editor/highlighting/executing_line_color", executing_line_color, true);
setting->set_initial_value("text_editor/highlighting/code_folding_color", code_folding_color, true);
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index aa2a03510d..4e499021f9 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -566,7 +566,7 @@ Error ExportTemplateManager::install_android_template() {
f->close();
}
{
- //add version, to ensure building wont work if template and Godot version are mismatch
+ //add version, to ensure building won't work if template and Godot version don't match
FileAccessRef f = FileAccess::open("res://android/.build_version", FileAccess::WRITE);
ERR_FAIL_COND_V(!f, ERR_CANT_CREATE);
f->store_line(VERSION_FULL_CONFIG);
@@ -636,7 +636,7 @@ Error ExportTemplateManager::install_android_template() {
FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF);
#endif
} else {
- ERR_PRINTS("Cant uncompress file: " + to_write);
+ ERR_PRINTS("Can't uncompress file: " + to_write);
}
}
@@ -690,7 +690,7 @@ ExportTemplateManager::ExportTemplateManager() {
remove_confirm->connect("confirmed", this, "_uninstall_template_confirm");
template_open = memnew(FileDialog);
- template_open->set_title(TTR("Select template file"));
+ template_open->set_title(TTR("Select Template File"));
template_open->add_filter("*.tpz ; Godot Export Templates");
template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
template_open->set_mode(FileDialog::MODE_OPEN_FILE);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index aade606412..52ed94e428 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -90,7 +90,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
String file_type = p_dir->get_file_type(i);
if (_is_file_type_disabled_by_feature_profile(file_type)) {
- //if type is disabled, file wont be displayed.
+ //if type is disabled, file won't be displayed.
continue;
}
String file_name = p_dir->get_file(i);
@@ -462,6 +462,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
_update_tree(_compute_uncollapsed_paths(), false, p_select_in_favorites);
if (display_mode == DISPLAY_MODE_SPLIT) {
_update_file_list(false);
+ files->get_v_scroll()->set_value(0);
}
String file_name = p_path.get_file();
@@ -755,7 +756,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
Ref<Texture> type_icon;
Ref<Texture> big_icon;
- String tooltip = fname;
+ String tooltip = fpath;
// Select the icons
if (!finfo->import_broken) {
@@ -1208,7 +1209,7 @@ void FileSystemDock::_make_dir_confirm() {
return;
} else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.find("*") != -1 ||
dir_name.find("|") != -1 || dir_name.find(">") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) {
- EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters"));
+ EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters."));
return;
}
@@ -1489,12 +1490,28 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected)
} break;
case FILE_OPEN: {
+ // Open folders
+ TreeItem *selected = tree->get_root();
+ selected = tree->get_next_selected(selected);
+ while (selected) {
+ if (p_selected.find(selected->get_metadata(0)) >= 0) {
+ selected->set_collapsed(false);
+ }
+ selected = tree->get_next_selected(selected);
+ }
// Open the file
for (int i = 0; i < p_selected.size(); i++) {
_select_file(p_selected[i]);
}
} break;
+ case FILE_INHERIT: {
+ // Create a new scene inherited from the selected one
+ if (p_selected.size() == 1) {
+ emit_signal("inherit", p_selected[0]);
+ }
+ } break;
+
case FILE_INSTANCE: {
// Instance all selected scenes
Vector<String> paths;
@@ -2061,13 +2078,16 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
if (all_files) {
- if (all_files_scenes && filenames.size() >= 1) {
- p_popup->add_item(TTR("Open Scene(s)"), FILE_OPEN);
+ if (all_files_scenes) {
+ if (filenames.size() == 1) {
+ p_popup->add_item(TTR("Open Scene"), FILE_OPEN);
+ p_popup->add_item(TTR("New Inherited Scene"), FILE_INHERIT);
+ } else {
+ p_popup->add_item(TTR("Open Scenes"), FILE_OPEN);
+ }
p_popup->add_item(TTR("Instance"), FILE_INSTANCE);
p_popup->add_separator();
- }
-
- if (!all_files_scenes && filenames.size() == 1) {
+ } else if (filenames.size() == 1) {
p_popup->add_item(TTR("Open"), FILE_OPEN);
p_popup->add_separator();
}
@@ -2368,8 +2388,8 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed);
+ ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
- ADD_SIGNAL(MethodInfo("open"));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 8b27938c8a..9d20544ac2 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -73,6 +73,7 @@ public:
private:
enum FileMenu {
FILE_OPEN,
+ FILE_INHERIT,
FILE_INSTANCE,
FILE_ADD_FAVORITE,
FILE_REMOVE_FAVORITE,
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 4dbba952bf..11af9fc2eb 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -751,7 +751,6 @@ void FindInFilesPanel::_on_replace_text_changed(String text) {
void FindInFilesPanel::_on_replace_all_clicked() {
String replace_text = get_replace_text();
- ERR_FAIL_COND(replace_text.empty());
PoolStringArray modified_files;
@@ -887,7 +886,7 @@ String FindInFilesPanel::get_replace_text() {
void FindInFilesPanel::update_replace_buttons() {
String text = get_replace_text();
- bool disabled = text.empty() || _finder->is_searching();
+ bool disabled = _finder->is_searching();
_replace_all_button->set_disabled(disabled);
}
diff --git a/editor/icons/icon_GUI_space.svg b/editor/icons/icon_GUI_space.svg
new file mode 100644
index 0000000000..caa4565f4a
--- /dev/null
+++ b/editor/icons/icon_GUI_space.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 7.9999993"
+ id="svg98"
+ sodipodi:docname="icon_GUI_space.svg"
+ inkscape:version="0.92.4 (unknown)">
+ <metadata
+ id="metadata104">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs102">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 3.9999996 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="8 : 3.9999996 : 1"
+ inkscape:persp3d-origin="4 : 2.6666664 : 1"
+ id="perspective992" />
+ </defs>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1853"
+ inkscape:window-height="1025"
+ id="namedview100"
+ showgrid="false"
+ inkscape:zoom="70.333333"
+ inkscape:cx="3.4905213"
+ inkscape:cy="6"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg98"
+ inkscape:pagecheckerboard="true" />
+ <g
+ transform="matrix(0.5,0,0,-0.5,1,527.20001)"
+ id="g96"
+ style="fill:#ffffff;fill-opacity:0.19607843">
+ <circle
+ cx="6"
+ cy="1046.4"
+ r="3"
+ id="circle94"
+ style="fill:#ffffff;fill-opacity:0.19607843" />
+ </g>
+</svg>
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 8f66cce39a..5ac7bc3bc8 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -708,6 +708,10 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_interpolate(j, from, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, 0, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->value_track_interpolate(j, from);
+ new_anim->track_insert_key(dtrack, 0, var);
+ }
}
}
@@ -718,6 +722,10 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_get_key(j, k, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, kt - from, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->track_get_key_value(j, k);
+ new_anim->track_insert_key(dtrack, kt - from, var);
+ }
}
if (dtrack != -1 && kt >= to) {
@@ -729,6 +737,10 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_interpolate(j, to, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, to - from, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->value_track_interpolate(j, to);
+ new_anim->track_insert_key(dtrack, to - from, var);
+ }
}
}
@@ -746,6 +758,12 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_interpolate(j, to, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, to - from, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->value_track_interpolate(j, from);
+ new_anim->track_insert_key(dtrack, 0, var);
+ Variant to_var = default_anim->value_track_interpolate(j, to);
+ new_anim->track_insert_key(dtrack, to - from, to_var);
+ }
}
}
@@ -1290,7 +1308,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale));
}
- scene->set_name(p_options["nodes/root_name"]);
+ if (p_options["nodes/root_name"] != "Scene Root")
+ scene->set_name(p_options["nodes/root_name"]);
+ else
+ scene->set_name(p_save_path.get_file().get_basename());
err = OK;
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index d72de3de48..5865ceb3af 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -81,7 +81,7 @@ void ResourceImporterTexture::_texture_reimport_normal(const Ref<StreamTexture>
void ResourceImporterTexture::update_imports() {
if (EditorFileSystem::get_singleton()->is_scanning() || EditorFileSystem::get_singleton()->is_importing()) {
- return; // do nothing for noe
+ return; // do nothing for now
}
mutex->lock();
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 52dec47343..fdf1103258 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -409,12 +409,12 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
float amp = Math::abs(ampChannelSum / (float)format_channels);
if (!found && amp > limit) {
- first = i / format_channels;
+ first = i;
found = true;
}
if (found && amp > limit) {
- last = i / format_channels;
+ last = i;
}
}
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 918f3a2149..5e8fb8e059 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -195,7 +195,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
//add triangle!
if (blend_space->has_triangle(making_triangle[0], making_triangle[1], making_triangle[2])) {
making_triangle.clear();
- EditorNode::get_singleton()->show_warning(TTR("Triangle already exists"));
+ EditorNode::get_singleton()->show_warning(TTR("Triangle already exists."));
return;
}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index f13c2170ea..bfee76492b 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -949,7 +949,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
filter_dialog->add_child(filter_vbox);
filter_enabled = memnew(CheckBox);
- filter_enabled->set_text(TTR("Enable filtering"));
+ filter_enabled->set_text(TTR("Enable Filtering"));
filter_enabled->connect("pressed", this, "_filter_toggled");
filter_vbox->add_child(filter_enabled);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 41f35c3bed..951e971615 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -54,13 +54,9 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) {
track_editor->set_root(NULL);
track_editor->show_select_node_warning(true);
_update_player();
- //editor->animation_editor_make_visible(false);
}
}
-void AnimationPlayerEditor::_gui_input(Ref<InputEvent> p_event) {
-}
-
void AnimationPlayerEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_PROCESS: {
@@ -129,8 +125,10 @@ void AnimationPlayerEditor::_notification(int p_what) {
autoplay_icon = get_icon("AutoPlay", "EditorIcons");
stop->set_icon(get_icon("Stop", "EditorIcons"));
+ onion_toggle->set_icon(get_icon("Onion", "EditorIcons"));
+ onion_skinning->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons"));
+
pin->set_icon(get_icon("Pin", "EditorIcons"));
- onion_skinning->set_icon(get_icon("Onion", "EditorIcons"));
tool_anim->add_style_override("normal", get_stylebox("normal", "Button"));
track_editor->get_edit_menu()->add_style_override("normal", get_stylebox("normal", "Button"));
@@ -291,25 +289,40 @@ void AnimationPlayerEditor::_pause_pressed() {
//player->set_pause( pause->is_pressed() );
}
-void AnimationPlayerEditor::_animation_selected(int p_which) {
- if (updating)
- return;
+String AnimationPlayerEditor::_get_current_animation() const {
+
// when selecting an animation, the idea is that the only interesting behavior
// ui-wise is that it should play/blend the next one if currently playing
- String current;
if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count()) {
- current = animation->get_item_text(animation->get_selected());
+ return animation->get_item_text(animation->get_selected());
}
- if (current != "") {
+ return "";
+}
- player->set_assigned_animation(current);
+void AnimationPlayerEditor::_animation_selected(int p_which) {
+
+ if (updating)
+ return;
+
+ _current_animation_updated();
+}
+void AnimationPlayerEditor::_current_animation_updated() {
+
+ String current = _get_current_animation();
+
+ if (current != "") {
Ref<Animation> anim = player->get_animation(current);
+
+ player->set_assigned_animation(current);
{
+ if (!anim->is_connected("changed", this, "_current_animation_updated"))
+ anim->connect("changed", this, "_current_animation_updated");
+
track_editor->set_animation(anim);
Node *root = player->get_node(player->get_root());
if (root) {
@@ -677,19 +690,22 @@ Dictionary AnimationPlayerEditor::get_state() const {
}
void AnimationPlayerEditor::set_state(const Dictionary &p_state) {
- if (p_state.has("visible") && p_state["visible"]) {
+ if (!p_state.has("visible") || !p_state["visible"]) {
+ return;
+ }
+ if (!EditorNode::get_singleton()->get_edited_scene()) {
+ return;
+ }
- if (!EditorNode::get_singleton()->get_edited_scene())
- return;
+ if (p_state.has("player")) {
Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["player"]);
if (Object::cast_to<AnimationPlayer>(n) && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
player = Object::cast_to<AnimationPlayer>(n);
_update_player();
- show();
+ editor->make_bottom_panel_item_visible(this);
set_process(true);
ensure_visibility();
- //EditorNode::get_singleton()->animation_panel_make_visible(true);
if (p_state.has("animation")) {
String anim = p_state["animation"];
@@ -697,10 +713,10 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) {
_animation_edit();
}
}
+ }
- if (p_state.has("track_editor_state")) {
- track_editor->set_state(p_state["track_editor_state"]);
- }
+ if (p_state.has("track_editor_state")) {
+ track_editor->set_state(p_state["track_editor_state"]);
}
}
@@ -719,17 +735,17 @@ void AnimationPlayerEditor::_animation_edit() {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
track_editor->set_animation(anim);
+
Node *root = player->get_node(player->get_root());
if (root) {
track_editor->set_root(root);
}
-
} else {
-
track_editor->set_animation(Ref<Animation>());
track_editor->set_root(NULL);
}
}
+
void AnimationPlayerEditor::_dialog_action(String p_file) {
switch (current_option) {
@@ -846,6 +862,12 @@ void AnimationPlayerEditor::_update_player() {
onion_skinning->set_disabled(player == NULL);
pin->set_disabled(player == NULL);
+ if (!player) {
+ AnimationPlayerEditor::singleton->get_track_editor()->update_keying();
+ EditorNode::get_singleton()->update_keying();
+ return;
+ }
+
int active_idx = -1;
for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) {
@@ -858,12 +880,6 @@ void AnimationPlayerEditor::_update_player() {
active_idx = animation->get_item_count() - 1;
}
- if (!player) {
- AnimationPlayerEditor::singleton->get_track_editor()->update_keying();
- EditorNode::get_singleton()->update_keying();
- return;
- }
-
updating = false;
if (active_idx != -1) {
animation->select(active_idx);
@@ -879,8 +895,6 @@ void AnimationPlayerEditor::_update_player() {
_animation_selected(0);
}
- //pause->set_pressed(player->is_paused());
-
if (animation->get_item_count()) {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
@@ -908,8 +922,6 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
track_editor->show_select_node_warning(false);
} else {
track_editor->show_select_node_warning(true);
-
- //hide();
}
}
@@ -1066,17 +1078,19 @@ void AnimationPlayerEditor::_list_changed() {
_update_player();
}
-void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) {
-
- frame->set_max(p_len);
-}
-
void AnimationPlayerEditor::_animation_key_editor_anim_step_changed(float p_len) {
if (p_len)
frame->set_step(p_len);
else
frame->set_step(0.00001);
+
+ String current = _get_current_animation();
+
+ if (current != "") {
+ Ref<Animation> anim = player->get_animation(current);
+ anim->_change_notify("step");
+ }
}
void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_drag) {
@@ -1108,7 +1122,6 @@ void AnimationPlayerEditor::_hide_anim_editors() {
track_editor->set_animation(Ref<Animation>());
track_editor->set_root(NULL);
track_editor->show_select_node_warning(true);
- //editor->animation_editor_make_visible(false);
}
void AnimationPlayerEditor::_animation_about_to_show_menu() {
@@ -1229,7 +1242,6 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) {
case ONION_SKINNING_ENABLE: {
onion.enabled = !onion.enabled;
- menu->set_item_checked(idx, onion.enabled);
if (onion.enabled)
_start_onion_skinning();
@@ -1430,6 +1442,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
new_state["show_rulers"] = false;
new_state["show_guides"] = false;
new_state["show_helpers"] = false;
+ new_state["show_zoom_control"] = false;
// TODO: Save/restore only affected entries
CanvasItemEditor::get_singleton()->set_state(new_state);
}
@@ -1482,7 +1495,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
if (valid) {
player->seek(pos, true);
get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials
- values_backup.update_skeletons(); // Needed for Skeletons
+ 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]);
@@ -1546,7 +1559,6 @@ void AnimationPlayerEditor::_pin_pressed() {
void AnimationPlayerEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &AnimationPlayerEditor::_gui_input);
ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationPlayerEditor::_node_removed);
ClassDB::bind_method(D_METHOD("_play_pressed"), &AnimationPlayerEditor::_play_pressed);
ClassDB::bind_method(D_METHOD("_play_from_pressed"), &AnimationPlayerEditor::_play_from_pressed);
@@ -1556,6 +1568,7 @@ void AnimationPlayerEditor::_bind_methods() {
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("_current_animation_updated"), &AnimationPlayerEditor::_current_animation_updated);
ClassDB::bind_method(D_METHOD("_animation_name_edited"), &AnimationPlayerEditor::_animation_name_edited);
ClassDB::bind_method(D_METHOD("_animation_new"), &AnimationPlayerEditor::_animation_new);
ClassDB::bind_method(D_METHOD("_animation_rename"), &AnimationPlayerEditor::_animation_rename);
@@ -1575,7 +1588,6 @@ void AnimationPlayerEditor::_bind_methods() {
//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);
ClassDB::bind_method(D_METHOD("_animation_key_editor_anim_step_changed"), &AnimationPlayerEditor::_animation_key_editor_anim_step_changed);
ClassDB::bind_method(D_METHOD("_hide_anim_editors"), &AnimationPlayerEditor::_hide_anim_editors);
ClassDB::bind_method(D_METHOD("_animation_duplicate"), &AnimationPlayerEditor::_animation_duplicate);
@@ -1609,12 +1621,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
player = NULL;
- Label *l;
-
- /*l= memnew( Label );
- l->set_text("Animation Player:");
- add_child(l);*/
-
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
@@ -1639,10 +1645,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
play_from->set_tooltip(TTR("Play selected animation from current pos. (D)"));
hb->add_child(play_from);
- //pause = memnew( Button );
- //pause->set_toggle_mode(true);
- //hb->add_child(pause);
-
frame = memnew(SpinBox);
hb->add_child(frame);
frame->set_custom_minimum_size(Size2(60, 0));
@@ -1668,7 +1670,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
tool_anim = memnew(MenuButton);
tool_anim->set_flat(false);
- //tool_anim->set_flat(false);
tool_anim->set_tooltip(TTR("Animation Tools"));
tool_anim->set_text(TTR("Animation"));
tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/new_animation", TTR("New")), TOOL_NEW_ANIM);
@@ -1699,28 +1700,27 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
hb->add_child(autoplay);
autoplay->set_tooltip(TTR("Autoplay on Load"));
- //tool_anim->get_popup()->add_separator();
- //tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM);
-
hb->add_child(memnew(VSeparator));
track_editor = memnew(AnimationTrackEditor);
hb->add_child(track_editor->get_edit_menu());
+ hb->add_child(memnew(VSeparator));
+
+ onion_toggle = memnew(ToolButton);
+ onion_toggle->set_toggle_mode(true);
+ onion_toggle->set_tooltip(TTR("Enable Onion Skinning"));
+ onion_toggle->connect("pressed", this, "_onion_skinning_menu", varray(ONION_SKINNING_ENABLE));
+ hb->add_child(onion_toggle);
+
onion_skinning = memnew(MenuButton);
- //onion_skinning->set_flat(false);
- onion_skinning->set_tooltip(TTR("Onion Skinning"));
- onion_skinning->get_popup()->add_check_shortcut(ED_SHORTCUT("animation_player_editor/onion_skinning", TTR("Enable Onion Skinning")), ONION_SKINNING_ENABLE);
- onion_skinning->get_popup()->add_separator();
- onion_skinning->get_popup()->add_item(TTR("Directions"), -1);
- onion_skinning->get_popup()->set_item_disabled(onion_skinning->get_popup()->get_item_count() - 1, true);
+ onion_skinning->set_tooltip(TTR("Onion Skinning Options"));
+ onion_skinning->get_popup()->add_separator(TTR("Directions"));
onion_skinning->get_popup()->add_check_item(TTR("Past"), ONION_SKINNING_PAST);
onion_skinning->get_popup()->set_item_checked(onion_skinning->get_popup()->get_item_count() - 1, true);
onion_skinning->get_popup()->add_check_item(TTR("Future"), ONION_SKINNING_FUTURE);
- onion_skinning->get_popup()->add_separator();
- onion_skinning->get_popup()->add_item(TTR("Depth"), -1);
- onion_skinning->get_popup()->set_item_disabled(onion_skinning->get_popup()->get_item_count() - 1, true);
+ onion_skinning->get_popup()->add_separator(TTR("Depth"));
onion_skinning->get_popup()->add_radio_check_item(TTR("1 step"), ONION_SKINNING_1_STEP);
onion_skinning->get_popup()->set_item_checked(onion_skinning->get_popup()->get_item_count() - 1, true);
onion_skinning->get_popup()->add_radio_check_item(TTR("2 steps"), ONION_SKINNING_2_STEPS);
@@ -1731,6 +1731,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
onion_skinning->get_popup()->add_check_item(TTR("Include Gizmos (3D)"), ONION_SKINNING_INCLUDE_GIZMOS);
hb->add_child(onion_skinning);
+ hb->add_child(memnew(VSeparator));
+
pin = memnew(ToolButton);
pin->set_toggle_mode(true);
pin->set_tooltip(TTR("Pin AnimationPlayer"));
@@ -1747,10 +1749,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
VBoxContainer *vb = memnew(VBoxContainer);
name_dialog->add_child(vb);
- l = memnew(Label);
- l->set_text(TTR("Animation Name:"));
- vb->add_child(l);
- name_title = l;
+ name_title = memnew(Label(TTR("Animation Name:")));
+ vb->add_child(name_title);
name = memnew(LineEdit);
vb->add_child(name);
@@ -1769,7 +1769,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
blend_editor.dialog->set_hide_on_ok(true);
VBoxContainer *blend_vb = memnew(VBoxContainer);
blend_editor.dialog->add_child(blend_vb);
- //blend_editor.dialog->set_child_rect(blend_vb);
blend_editor.tree = memnew(Tree);
blend_editor.tree->set_columns(2);
blend_vb->add_margin_child(TTR("Blend Times:"), blend_editor.tree, true);
@@ -1787,8 +1786,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
play_bw->connect("pressed", this, "_play_bw_pressed");
play_bw_from->connect("pressed", this, "_play_bw_from_pressed");
stop->connect("pressed", this, "_stop_pressed");
- //pause->connect("pressed", this,"_pause_pressed");
- //frame->connect("text_entered", this,"_seek_frame_changed");
animation->connect("item_selected", this, "_animation_selected", Vector<Variant>(), true);
@@ -1804,7 +1801,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
add_child(track_editor);
track_editor->set_v_size_flags(SIZE_EXPAND_FILL);
track_editor->connect("timeline_changed", this, "_animation_key_editor_seek");
- track_editor->connect("animation_len_changed", this, "_animation_key_editor_anim_len_changed");
track_editor->connect("animation_step_changed", this, "_animation_key_editor_anim_step_changed");
_update_player();
@@ -1892,11 +1888,6 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
editor->make_bottom_panel_item_visible(anim_editor);
anim_editor->set_process(true);
anim_editor->ensure_visibility();
- //editor->animation_panel_make_visible(true);
- } else {
-
- //anim_editor->hide();
- //anim_editor->set_idle_process(false);
}
}
@@ -1905,16 +1896,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) {
editor = p_node;
anim_editor = memnew(AnimationPlayerEditor(editor, this));
anim_editor->set_undo_redo(editor->get_undo_redo());
-
editor->add_bottom_panel_item(TTR("Animation"), anim_editor);
- /*
- editor->get_viewport()->add_child(anim_editor);
- anim_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- anim_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END);
- anim_editor->set_margin( MARGIN_TOP, 75 );
- anim_editor->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END);
- anim_editor->set_margin( MARGIN_RIGHT, 0 );*/
- anim_editor->hide();
}
AnimationPlayerEditorPlugin::~AnimationPlayerEditorPlugin() {
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 9085c70410..b1026b5b9f 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -97,11 +97,10 @@ class AnimationPlayerEditor : public VBoxContainer {
Button *play_from;
Button *play_bw;
Button *play_bw_from;
-
- //Button *pause;
Button *autoplay;
MenuButton *tool_anim;
+ ToolButton *onion_toggle;
MenuButton *onion_skinning;
ToolButton *pin;
SpinBox *frame;
@@ -172,7 +171,9 @@ class AnimationPlayerEditor : public VBoxContainer {
void _autoplay_pressed();
void _stop_pressed();
void _pause_pressed();
+ String _get_current_animation() const;
void _animation_selected(int p_which);
+ void _current_animation_updated();
void _animation_new();
void _animation_rename();
void _animation_name_edited();
@@ -228,7 +229,6 @@ class AnimationPlayerEditor : public VBoxContainer {
protected:
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
void _node_removed(Node *p_node);
static void _bind_methods();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index ab5ff7dee4..92cc12d931 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1387,7 +1387,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
// Starts anchor dragging if needed
if (drag_type == DRAG_NONE) {
- if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT && show_helpers) {
+ if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
Control *control = Object::cast_to<Control>(selection[0]);
@@ -1471,10 +1471,14 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
break;
case DRAG_ANCHOR_ALL:
- if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
- if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
- if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
- if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
+ if (!use_single_axis || !use_y) {
+ control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
+ control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
+ }
+ if (!use_single_axis || use_y) {
+ control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
+ control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
+ }
break;
default:
break;
@@ -2209,6 +2213,7 @@ bool CanvasItemEditor::_gui_input_hover(const Ref<InputEvent> &p_event) {
void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
bool accepted = false;
+
if (EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") || !Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
if ((accepted = _gui_input_rulers_and_guides(p_event))) {
//printf("Rulers and guides\n");
@@ -2508,20 +2513,50 @@ void CanvasItemEditor::_draw_grid() {
}
}
-void CanvasItemEditor::_draw_control_helpers(Control *control) {
+void CanvasItemEditor::_draw_control_anchors(Control *control) {
Transform2D xform = transform * control->get_global_transform_with_canvas();
RID ci = viewport->get_canvas_item();
+ if (tool == TOOL_SELECT && !Object::cast_to<Container>(control->get_parent())) {
+
+ // Compute the anchors
+ float anchors_values[4];
+ anchors_values[0] = control->get_anchor(MARGIN_LEFT);
+ anchors_values[1] = control->get_anchor(MARGIN_TOP);
+ anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
+ anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
+
+ Vector2 anchors_pos[4];
+ for (int i = 0; i < 4; i++) {
+ Vector2 value = Vector2((i % 2 == 0) ? anchors_values[i] : anchors_values[(i + 1) % 4], (i % 2 == 1) ? anchors_values[i] : anchors_values[(i + 1) % 4]);
+ anchors_pos[i] = xform.xform(_anchor_to_position(control, value));
+ }
+
+ // Draw the anchors handles
+ Rect2 anchor_rects[4];
+ anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size());
+ anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y));
+ anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size());
+ anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y));
+
+ for (int i = 0; i < 4; i++) {
+ anchor_handle->draw_rect(ci, anchor_rects[i]);
+ }
+ }
+}
+
+void CanvasItemEditor::_draw_control_helpers(Control *control) {
+ Transform2D xform = transform * control->get_global_transform_with_canvas();
if (tool == TOOL_SELECT && show_helpers && !Object::cast_to<Container>(control->get_parent())) {
// Draw the helpers
Color color_base = Color(0.8, 0.8, 0.8, 0.5);
+ // Compute the anchors
float anchors_values[4];
anchors_values[0] = control->get_anchor(MARGIN_LEFT);
anchors_values[1] = control->get_anchor(MARGIN_TOP);
anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
- // Draw the anchors
Vector2 anchors[4];
Vector2 anchors_pos[4];
for (int i = 0; i < 4; i++) {
@@ -2588,16 +2623,6 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
_draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4));
}
- Rect2 anchor_rects[4];
- anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size());
- anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y));
- anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size());
- anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y));
-
- for (int i = 0; i < 4; i++) {
- anchor_handle->draw_rect(ci, anchor_rects[i]);
- }
-
// Draw the margin values and the node width/height when dragging control side
float ratio = 0.33;
Transform2D parent_transform = xform * control->get_transform().affine_inverse();
@@ -2775,6 +2800,7 @@ void CanvasItemEditor::_draw_selection() {
// Draw control-related helpers
Control *control = Object::cast_to<Control>(canvas_item);
if (control && _is_node_movable(control)) {
+ _draw_control_anchors(control);
_draw_control_helpers(control);
}
@@ -3307,24 +3333,32 @@ void CanvasItemEditor::_notification(int p_what) {
// Activate / Deactivate the pivot tool
pivot_button->set_disabled(nb_having_pivot == 0);
- // Show / Hide the layout button
+ // Show / Hide the layout and anchors mode buttons
if (nb_control > 0 && nb_control == selection.size()) {
presets_menu->set_visible(true);
presets_menu->set_tooltip(TTR("Presets for the anchors and margins values of a Control node."));
+ anchor_mode_button->set_visible(true);
+ anchor_mode_button->set_tooltip(TTR("When active, moving Control nodes changes their anchors instead of their margins."));
+
+ // Set the pressed state of the node
+ anchor_mode_button->set_pressed(anchors_mode);
// Disable if the selected node is child of a container
presets_menu->set_disabled(false);
+ anchor_mode_button->set_disabled(false);
for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
Control *control = Object::cast_to<Control>(E->get());
if (!control || Object::cast_to<Container>(control->get_parent())) {
presets_menu->set_disabled(true);
presets_menu->set_tooltip(TTR("Children of containers have their anchors and margins values overridden by their parent."));
+ anchor_mode_button->set_disabled(true);
+ anchor_mode_button->set_tooltip(TTR("Children of containers have their anchors and margins values overridden by their parent."));
break;
}
}
-
} else {
presets_menu->set_visible(false);
+ anchor_mode_button->set_visible(false);
}
// Update the viewport if bones changes
@@ -3432,9 +3466,10 @@ void CanvasItemEditor::_notification(int p_what) {
p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE);
p->add_separator();
p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_AND_MARGINS_PRESET_WIDE);
+ p->add_icon_item(get_icon("Anchor", "EditorIcons"), "Keep Ratio", ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO);
p->add_separator();
p->add_submenu_item(TTR("Anchors only"), "Anchors");
- p->set_item_icon(20, get_icon("Anchor", "EditorIcons"));
+ p->set_item_icon(21, get_icon("Anchor", "EditorIcons"));
anchors_popup->clear();
anchors_popup->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHORS_PRESET_TOP_LEFT);
@@ -3456,9 +3491,31 @@ void CanvasItemEditor::_notification(int p_what) {
anchors_popup->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHORS_PRESET_HCENTER_WIDE);
anchors_popup->add_separator();
anchors_popup->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_PRESET_WIDE);
+
+ anchor_mode_button->set_icon(get_icon("Anchor", "EditorIcons"));
}
}
+void CanvasItemEditor::_selection_changed() {
+ // Update the anchors_mode
+ int nbValidControls = 0;
+ int nbAnchorsMode = 0;
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Control *control = Object::cast_to<Control>(E->get());
+ if (!control)
+ continue;
+ if (Object::cast_to<Container>(control->get_parent()))
+ continue;
+
+ nbValidControls++;
+ if (control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_")) {
+ nbAnchorsMode++;
+ }
+ }
+ anchors_mode = (nbValidControls == nbAnchorsMode);
+}
+
void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
Array selection = editor_selection->get_selected_nodes();
@@ -3676,6 +3733,36 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p
}
undo_redo->commit_action();
+
+ anchors_mode = false;
+}
+
+void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action(TTR("Change Anchors and Margins"));
+
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+
+ Control *control = Object::cast_to<Control>(E->get());
+ if (control) {
+ Point2 top_left_anchor = _position_to_anchor(control, Point2());
+ Point2 bottom_right_anchor = _position_to_anchor(control, control->get_size());
+ undo_redo->add_do_method(control, "set_anchor", MARGIN_LEFT, top_left_anchor.x, false, true);
+ undo_redo->add_do_method(control, "set_anchor", MARGIN_RIGHT, bottom_right_anchor.x, false, true);
+ undo_redo->add_do_method(control, "set_anchor", MARGIN_TOP, top_left_anchor.y, false, true);
+ undo_redo->add_do_method(control, "set_anchor", MARGIN_BOTTOM, bottom_right_anchor.y, false, true);
+ undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true);
+
+ bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_");
+ undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
+ undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors);
+
+ anchors_mode = true;
+ }
+ }
+
+ undo_redo->commit_action();
}
void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
@@ -3807,6 +3894,21 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
}
}
+void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) {
+ List<CanvasItem *> selection = _get_edited_canvas_items(false, false);
+ for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
+ Control *control = Object::cast_to<Control>(E->get());
+ if (!control || Object::cast_to<Container>(control->get_parent()))
+ continue;
+
+ control->set_meta("_edit_use_anchors_", p_status);
+ }
+
+ anchors_mode = p_status;
+
+ viewport->update();
+}
+
void CanvasItemEditor::_popup_callback(int p_op) {
last_option = MenuOption(p_op);
@@ -3907,6 +4009,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
show_rulers = !show_rulers;
int idx = view_menu->get_popup()->get_item_index(SHOW_RULERS);
view_menu->get_popup()->set_item_checked(idx, show_rulers);
+ _update_scrollbars();
viewport->update();
} break;
case SHOW_GUIDES: {
@@ -4043,6 +4146,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case ANCHORS_AND_MARGINS_PRESET_WIDE: {
_set_anchors_and_margins_preset(Control::PRESET_WIDE);
} break;
+ case ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO: {
+ _set_anchors_and_margins_to_keep_ratio();
+ } break;
case ANCHORS_PRESET_TOP_LEFT: {
_set_anchors_preset(PRESET_TOP_LEFT);
@@ -4216,6 +4322,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
Map<Node *, Object *> &selection = editor_selection->get_selection();
+ undo_redo->create_action(TTR("Create Custom Bone(s) from Node(s)"));
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
Node2D *n2d = Object::cast_to<Node2D>(E->key());
@@ -4225,19 +4332,24 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (!n2d->get_parent_item())
continue;
+ if (n2d->has_meta("_edit_bone_") && (bool)n2d->get_meta("_edit_bone_") == true)
+ continue;
- n2d->set_meta("_edit_bone_", true);
- if (!skeleton_show_bones)
- skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
+ undo_redo->add_do_method(n2d, "set_meta", "_edit_bone_", true);
+ undo_redo->add_undo_method(n2d, "remove_meta", "_edit_bone_");
}
- _queue_update_bone_list();
- viewport->update();
+ undo_redo->add_do_method(this, "_queue_update_bone_list");
+ undo_redo->add_undo_method(this, "_queue_update_bone_list");
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
+ undo_redo->commit_action();
} break;
case SKELETON_CLEAR_BONES: {
Map<Node *, Object *> &selection = editor_selection->get_selection();
+ undo_redo->create_action(TTR("Clear Bones"));
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
Node2D *n2d = Object::cast_to<Node2D>(E->key());
@@ -4245,40 +4357,47 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (!n2d->is_visible_in_tree())
continue;
+ if (!n2d->has_meta("_edit_bone_"))
+ continue;
- n2d->set_meta("_edit_bone_", Variant());
- if (!skeleton_show_bones)
- skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
+ undo_redo->add_do_method(n2d, "remove_meta", "_edit_bone_");
+ undo_redo->add_undo_method(n2d, "set_meta", "_edit_bone_", n2d->get_meta("_edit_bone_"));
}
- _queue_update_bone_list();
- viewport->update();
+ undo_redo->add_do_method(this, "_queue_update_bone_list");
+ undo_redo->add_undo_method(this, "_queue_update_bone_list");
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
+ undo_redo->commit_action();
} break;
case SKELETON_SET_IK_CHAIN: {
List<Node *> selection = editor_selection->get_selected_node_list();
+ undo_redo->create_action(TTR("Make IK Chain"));
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
if (!canvas_item || !canvas_item->is_visible_in_tree())
continue;
-
if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root())
continue;
+ if (canvas_item->has_meta("_edit_ik_") && (bool)canvas_item->get_meta("_edit_ik_") == true)
+ continue;
- canvas_item->set_meta("_edit_ik_", true);
- if (!skeleton_show_bones)
- skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
+ undo_redo->add_do_method(canvas_item, "set_meta", "_edit_ik_", true);
+ undo_redo->add_undo_method(canvas_item, "remove_meta", "_edit_ik_");
}
-
- viewport->update();
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
+ undo_redo->commit_action();
} break;
case SKELETON_CLEAR_IK_CHAIN: {
Map<Node *, Object *> &selection = editor_selection->get_selection();
+ undo_redo->create_action(TTR("Clear IK Chain"));
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *n2d = Object::cast_to<CanvasItem>(E->key());
@@ -4286,12 +4405,15 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (!n2d->is_visible_in_tree())
continue;
+ if (!n2d->has_meta("_edit_ik_"))
+ continue;
- n2d->set_meta("_edit_ik_", Variant());
- if (!skeleton_show_bones)
- skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
+ undo_redo->add_do_method(n2d, "remove_meta", "_edit_ik_");
+ undo_redo->add_undo_method(n2d, "set_meta", "_edit_ik_", n2d->get_meta("_edit_ik_"));
}
- viewport->update();
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
+ undo_redo->commit_action();
} break;
}
@@ -4362,6 +4484,7 @@ void CanvasItemEditor::_bind_methods() {
ClassDB::bind_method("_button_zoom_reset", &CanvasItemEditor::_button_zoom_reset);
ClassDB::bind_method("_button_zoom_plus", &CanvasItemEditor::_button_zoom_plus);
ClassDB::bind_method("_button_toggle_snap", &CanvasItemEditor::_button_toggle_snap);
+ ClassDB::bind_method("_button_toggle_anchor_mode", &CanvasItemEditor::_button_toggle_anchor_mode);
ClassDB::bind_method("_update_scroll", &CanvasItemEditor::_update_scroll);
ClassDB::bind_method("_update_scrollbars", &CanvasItemEditor::_update_scrollbars);
ClassDB::bind_method("_popup_callback", &CanvasItemEditor::_popup_callback);
@@ -4372,8 +4495,10 @@ void CanvasItemEditor::_bind_methods() {
ClassDB::bind_method("_draw_viewport", &CanvasItemEditor::_draw_viewport);
ClassDB::bind_method("_gui_input_viewport", &CanvasItemEditor::_gui_input_viewport);
ClassDB::bind_method("_snap_changed", &CanvasItemEditor::_snap_changed);
+ ClassDB::bind_method("_queue_update_bone_list", &CanvasItemEditor::_update_bone_list);
ClassDB::bind_method("_update_bone_list", &CanvasItemEditor::_update_bone_list);
ClassDB::bind_method("_tree_changed", &CanvasItemEditor::_tree_changed);
+ ClassDB::bind_method("_selection_changed", &CanvasItemEditor::_selection_changed);
ClassDB::bind_method("_popup_warning_depop", &CanvasItemEditor::_popup_warning_depop);
ClassDB::bind_method(D_METHOD("_selection_result_pressed"), &CanvasItemEditor::_selection_result_pressed);
ClassDB::bind_method(D_METHOD("_selection_menu_hide"), &CanvasItemEditor::_selection_menu_hide);
@@ -4407,6 +4532,7 @@ Dictionary CanvasItemEditor::get_state() const {
state["show_rulers"] = show_rulers;
state["show_guides"] = show_guides;
state["show_helpers"] = show_helpers;
+ state["show_zoom_control"] = zoom_hb->is_visible();
state["show_edit_locks"] = show_edit_locks;
state["snap_rotation"] = snap_rotation;
state["snap_relative"] = snap_relative;
@@ -4417,6 +4543,7 @@ Dictionary CanvasItemEditor::get_state() const {
void CanvasItemEditor::set_state(const Dictionary &p_state) {
+ bool update_scrollbars = false;
Dictionary state = p_state;
if (state.has("zoom")) {
zoom = p_state["zoom"];
@@ -4425,7 +4552,7 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
if (state.has("ofs")) {
view_offset = p_state["ofs"];
previous_update_view_offset = view_offset;
- _update_scrollbars();
+ update_scrollbars = true;
}
if (state.has("grid_offset")) {
@@ -4513,6 +4640,7 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
show_rulers = state["show_rulers"];
int idx = view_menu->get_popup()->get_item_index(SHOW_RULERS);
view_menu->get_popup()->set_item_checked(idx, show_rulers);
+ update_scrollbars = true;
}
if (state.has("show_guides")) {
@@ -4533,6 +4661,11 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
view_menu->get_popup()->set_item_checked(idx, show_edit_locks);
}
+ if (state.has("show_zoom_control")) {
+ // This one is not user-controllable, but instrumentable
+ zoom_hb->set_visible(state["show_zoom_control"]);
+ }
+
if (state.has("snap_rotation")) {
snap_rotation = state["snap_rotation"];
int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_ROTATION);
@@ -4557,6 +4690,9 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
skeleton_menu->get_popup()->set_item_checked(idx, skeleton_show_bones);
}
+ if (update_scrollbars) {
+ _update_scrollbars();
+ }
viewport->update();
}
@@ -4632,6 +4768,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
snap_relative = false;
snap_pixel = false;
+ anchors_mode = false;
+
skeleton_show_bones = true;
drag_type = DRAG_NONE;
@@ -4650,6 +4788,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
editor_selection = p_editor->get_editor_selection();
editor_selection->add_editor_plugin(this);
editor_selection->connect("selection_changed", this, "update");
+ editor_selection->connect("selection_changed", this, "_selection_changed");
hb = memnew(HBoxContainer);
add_child(hb);
@@ -4811,24 +4950,24 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
PopupMenu *p = snap_config_menu->get_popup();
p->connect("id_pressed", this, "_popup_callback");
p->set_hide_on_checkable_item_selection(false);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_grid", TTR("Snap to grid")), SNAP_USE_GRID);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_grid", TTR("Snap to Grid")), SNAP_USE_GRID);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap...")), SNAP_CONFIGURE);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL);
- p->add_submenu_item(TTR("Smart snapping"), "SmartSnapping");
+ p->add_submenu_item(TTR("Smart Snapping"), "SmartSnapping");
smartsnap_config_popup = memnew(PopupMenu);
p->add_child(smartsnap_config_popup);
smartsnap_config_popup->set_name("SmartSnapping");
smartsnap_config_popup->connect("id_pressed", this, "_popup_callback");
smartsnap_config_popup->set_hide_on_checkable_item_selection(false);
- smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to parent")), SNAP_USE_NODE_PARENT);
- smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to node anchor")), SNAP_USE_NODE_ANCHORS);
- smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_sides", TTR("Snap to node sides")), SNAP_USE_NODE_SIDES);
- smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_center", TTR("Snap to node center")), SNAP_USE_NODE_CENTER);
- smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to other nodes")), SNAP_USE_OTHER_NODES);
- smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_guides", TTR("Snap to guides")), SNAP_USE_GUIDES);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to Parent")), SNAP_USE_NODE_PARENT);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to Node Anchor")), SNAP_USE_NODE_ANCHORS);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_sides", TTR("Snap to Node Sides")), SNAP_USE_NODE_SIDES);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_center", TTR("Snap to Node Center")), SNAP_USE_NODE_CENTER);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to Other Nodes")), SNAP_USE_OTHER_NODES);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_guides", TTR("Snap to Guides")), SNAP_USE_GUIDES);
hb->add_child(memnew(VSeparator));
@@ -4909,6 +5048,12 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
anchors_popup->set_name("Anchors");
anchors_popup->connect("id_pressed", this, "_popup_callback");
+ anchor_mode_button = memnew(ToolButton);
+ hb->add_child(anchor_mode_button);
+ anchor_mode_button->set_toggle_mode(true);
+ anchor_mode_button->hide();
+ anchor_mode_button->connect("toggled", this, "_button_toggle_anchor_mode");
+
animation_hb = memnew(HBoxContainer);
hb->add_child(animation_hb);
animation_hb->add_child(memnew(VSeparator));
@@ -5466,7 +5611,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
selector = memnew(AcceptDialog);
editor->get_gui_base()->add_child(selector);
- selector->set_title(TTR("Change default type"));
+ selector->set_title(TTR("Change Default Type"));
selector->connect("confirmed", this, "_on_change_type_confirmed");
selector->connect("popup_hide", this, "_on_change_type_closed");
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 14ea81f302..e098d261c0 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -129,6 +129,7 @@ private:
ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE,
ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE,
ANCHORS_AND_MARGINS_PRESET_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO,
ANCHORS_PRESET_TOP_LEFT,
ANCHORS_PRESET_TOP_RIGHT,
ANCHORS_PRESET_BOTTOM_LEFT,
@@ -240,6 +241,8 @@ private:
Point2 view_offset;
Point2 previous_update_view_offset;
+ bool anchors_mode;
+
Point2 grid_offset;
Point2 grid_step;
int grid_step_multiplier;
@@ -347,6 +350,8 @@ private:
PopupMenu *anchors_and_margins_popup;
PopupMenu *anchors_popup;
+ ToolButton *anchor_mode_button;
+
Button *key_loc_button;
Button *key_rot_button;
Button *key_scale_button;
@@ -438,6 +443,7 @@ private:
void _draw_guides();
void _draw_focus();
void _draw_grid();
+ void _draw_control_anchors(Control *control);
void _draw_control_helpers(Control *control);
void _draw_selection();
void _draw_axis();
@@ -462,6 +468,8 @@ private:
void _gui_input_viewport(const Ref<InputEvent> &p_event);
+ void _selection_changed();
+
void _focus_selection(int p_op);
void _solve_IK(Node2D *leaf_node, Point2 target_position);
@@ -473,6 +481,9 @@ private:
void _set_anchors_preset(Control::LayoutPreset p_preset);
void _set_margins_preset(Control::LayoutPreset p_preset);
void _set_anchors_and_margins_preset(Control::LayoutPreset p_preset);
+ void _set_anchors_and_margins_to_keep_ratio();
+
+ void _button_toggle_anchor_mode(bool p_status);
HBoxContainer *zoom_hb;
void _zoom_on_position(float p_zoom, Point2 p_position = Point2());
@@ -575,6 +586,8 @@ public:
void focus_selection();
+ bool is_anchors_mode_enabled() { return anchors_mode; };
+
CanvasItemEditor(EditorNode *p_editor);
};
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 2c0dd5f1db..55feb40c2c 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -53,11 +53,11 @@ CurveEditor::CurveEditor() {
_presets_menu = memnew(PopupMenu);
_presets_menu->set_name("_presets_menu");
- _presets_menu->add_item(TTR("Flat0"), PRESET_FLAT0);
- _presets_menu->add_item(TTR("Flat1"), PRESET_FLAT1);
+ _presets_menu->add_item(TTR("Flat 0"), PRESET_FLAT0);
+ _presets_menu->add_item(TTR("Flat 1"), PRESET_FLAT1);
_presets_menu->add_item(TTR("Linear"), PRESET_LINEAR);
- _presets_menu->add_item(TTR("Ease in"), PRESET_EASE_IN);
- _presets_menu->add_item(TTR("Ease out"), PRESET_EASE_OUT);
+ _presets_menu->add_item(TTR("Ease In"), PRESET_EASE_IN);
+ _presets_menu->add_item(TTR("Ease Out"), PRESET_EASE_OUT);
_presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP);
_presets_menu->connect("id_pressed", this, "_on_preset_item_selected");
_context_menu->add_child(_presets_menu);
@@ -330,10 +330,10 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->clear();
if (_curve_ref.is_valid()) {
- _context_menu->add_item(TTR("Add point"), CONTEXT_ADD_POINT);
+ _context_menu->add_item(TTR("Add Point"), CONTEXT_ADD_POINT);
if (_selected_point >= 0) {
- _context_menu->add_item(TTR("Remove point"), CONTEXT_REMOVE_POINT);
+ _context_menu->add_item(TTR("Remove Point"), CONTEXT_REMOVE_POINT);
if (_selected_tangent != TANGENT_NONE) {
_context_menu->add_separator();
@@ -351,12 +351,12 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->add_separator();
if (_selected_point > 0) {
- _context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR);
+ _context_menu->add_check_item(TTR("Left Linear"), CONTEXT_LEFT_LINEAR);
_context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LEFT_LINEAR),
_curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR);
}
if (_selected_point + 1 < _curve_ref->get_point_count()) {
- _context_menu->add_check_item(TTR("Right linear"), CONTEXT_RIGHT_LINEAR);
+ _context_menu->add_check_item(TTR("Right Linear"), CONTEXT_RIGHT_LINEAR);
_context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_RIGHT_LINEAR),
_curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR);
}
@@ -366,7 +366,7 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->add_separator();
}
- _context_menu->add_submenu_item(TTR("Load preset"), _presets_menu->get_name());
+ _context_menu->add_submenu_item(TTR("Load Preset"), _presets_menu->get_name());
_context_menu->set_size(Size2(0, 0));
_context_menu->popup();
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 58d7968723..28e57ac48a 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -78,7 +78,7 @@ bool EditorTexturePreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Texture");
}
-bool EditorTexturePreviewPlugin::should_generate_small_preview() const {
+bool EditorTexturePreviewPlugin::generate_small_preview_automatically() const {
return true;
}
@@ -186,7 +186,7 @@ Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from, const Size2 p
EditorImagePreviewPlugin::EditorImagePreviewPlugin() {
}
-bool EditorImagePreviewPlugin::should_generate_small_preview() const {
+bool EditorImagePreviewPlugin::generate_small_preview_automatically() const {
return true;
}
////////////////////////////////////////////////////////////////////////////
@@ -250,7 +250,7 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size2
return ptex;
}
-bool EditorBitmapPreviewPlugin::should_generate_small_preview() const {
+bool EditorBitmapPreviewPlugin::generate_small_preview_automatically() const {
return true;
}
@@ -317,7 +317,7 @@ bool EditorMaterialPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Material"); //any material
}
-bool EditorMaterialPreviewPlugin::should_generate_small_preview() const {
+bool EditorMaterialPreviewPlugin::generate_small_preview_automatically() const {
return true;
}
diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h
index ed2c003a0a..16b1f3082b 100644
--- a/editor/plugins/editor_preview_plugins.h
+++ b/editor/plugins/editor_preview_plugins.h
@@ -39,7 +39,7 @@ class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator)
public:
virtual bool handles(const String &p_type) const;
- virtual bool should_generate_small_preview() const;
+ virtual bool generate_small_preview_automatically() const;
virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorTexturePreviewPlugin();
@@ -49,7 +49,7 @@ class EditorImagePreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorImagePreviewPlugin, EditorResourcePreviewGenerator)
public:
virtual bool handles(const String &p_type) const;
- virtual bool should_generate_small_preview() const;
+ virtual bool generate_small_preview_automatically() const;
virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorImagePreviewPlugin();
@@ -59,7 +59,7 @@ class EditorBitmapPreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorBitmapPreviewPlugin, EditorResourcePreviewGenerator)
public:
virtual bool handles(const String &p_type) const;
- virtual bool should_generate_small_preview() const;
+ virtual bool generate_small_preview_automatically() const;
virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorBitmapPreviewPlugin();
@@ -98,7 +98,7 @@ protected:
public:
virtual bool handles(const String &p_type) const;
- virtual bool should_generate_small_preview() const;
+ virtual bool generate_small_preview_automatically() const;
virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorMaterialPreviewPlugin();
diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp
index 9ea37aceb9..96681a105f 100644
--- a/editor/plugins/physical_bone_plugin.cpp
+++ b/editor/plugins/physical_bone_plugin.cpp
@@ -61,7 +61,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
button_transform_joint = memnew(ToolButton);
spatial_editor_hb->add_child(button_transform_joint);
- button_transform_joint->set_text(TTR("Move joint"));
+ button_transform_joint->set_text(TTR("Move Joint"));
button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_icon("PhysicalBone", "EditorIcons"));
button_transform_joint->set_toggle_mode(true);
button_transform_joint->connect("toggled", this, "_on_toggle_button_transform_joint");
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d84a5a1e48..839c9483d7 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -603,6 +603,8 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
idx = history[history_pos].control->get_index();
}
tab_container->set_current_tab(idx);
+ } else {
+ _update_selected_editor_menu();
}
_update_history_arrows();
@@ -1002,6 +1004,9 @@ void ScriptEditor::_menu_option(int p_option) {
save_all_scripts();
} break;
+ case SEARCH_IN_FILES: {
+ _on_find_in_files_requested("");
+ } break;
case SEARCH_HELP: {
help_search_dialog->popup_dialog();
@@ -1553,7 +1558,15 @@ struct _ScriptEditorItemData {
bool operator<(const _ScriptEditorItemData &id) const {
- return category == id.category ? sort_key < id.sort_key : category < id.category;
+ if (category == id.category) {
+ if (sort_key == id.sort_key) {
+ return index < id.index;
+ } else {
+ return sort_key < id.sort_key;
+ }
+ } else {
+ return category < id.category;
+ }
}
};
@@ -2694,10 +2707,22 @@ void ScriptEditor::_update_selected_editor_menu() {
}
EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_current_tab_control());
+ script_search_menu->get_popup()->clear();
if (eh) {
+
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
+ script_search_menu->get_popup()->add_separator();
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
script_search_menu->show();
} else {
- script_search_menu->hide();
+
+ if (tab_container->get_child_count() == 0) {
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
+ script_search_menu->show();
+ } else {
+ script_search_menu->hide();
+ }
}
}
@@ -2950,6 +2975,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw);
ClassDB::bind_method(D_METHOD("drop_data_fw", "point", "data", "from"), &ScriptEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("goto_line", "line_number"), &ScriptEditor::_goto_script_line2);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &ScriptEditor::open_script_create_dialog);
@@ -3029,7 +3055,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
members_overview->set_custom_minimum_size(Size2(0, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
members_overview->set_v_size_flags(SIZE_EXPAND_FILL);
members_overview->set_allow_rmb_select(true);
- members_overview->set_drag_forwarding(this);
help_overview = memnew(ItemList);
overview_vbox->add_child(help_overview);
@@ -3108,10 +3133,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_search_menu->set_text(TTR("Search"));
script_search_menu->set_switch_on_hover(true);
script_search_menu->get_popup()->set_hide_on_window_lose_focus(true);
- script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
- script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
script_search_menu->get_popup()->connect("id_pressed", this, "_menu_option");
- script_search_menu->hide();
debug_menu = memnew(MenuButton);
menu_hb->add_child(debug_menu);
@@ -3290,9 +3312,7 @@ void ScriptEditorPlugin::edit(Object *p_object) {
} else {
script_editor->edit(p_script);
}
- }
-
- if (Object::cast_to<TextFile>(p_object)) {
+ } else if (Object::cast_to<TextFile>(p_object)) {
script_editor->edit(Object::cast_to<TextFile>(p_object));
}
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index a17fed1e06..683fa881f8 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -157,6 +157,7 @@ class ScriptEditor : public PanelContainer {
DEBUG_SHOW,
DEBUG_SHOW_KEEP_OPEN,
DEBUG_WITH_EXTERNAL_EDITOR,
+ SEARCH_IN_FILES,
SEARCH_HELP,
SEARCH_WEBSITE,
REQUEST_DOCS,
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index d40e67cc8c..f66ae0465f 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -213,6 +213,7 @@ void ScriptTextEditor::_load_theme_settings() {
Color function_color = EDITOR_GET("text_editor/highlighting/function_color");
Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
Color mark_color = EDITOR_GET("text_editor/highlighting/mark_color");
+ Color bookmark_color = EDITOR_GET("text_editor/highlighting/bookmark_color");
Color breakpoint_color = EDITOR_GET("text_editor/highlighting/breakpoint_color");
Color executing_line_color = EDITOR_GET("text_editor/highlighting/executing_line_color");
Color code_folding_color = EDITOR_GET("text_editor/highlighting/code_folding_color");
@@ -245,6 +246,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_color_override("number_color", number_color);
text_edit->add_color_override("function_color", function_color);
text_edit->add_color_override("member_variable_color", member_variable_color);
+ text_edit->add_color_override("bookmark_color", bookmark_color);
text_edit->add_color_override("breakpoint_color", breakpoint_color);
text_edit->add_color_override("executing_line_color", executing_line_color);
text_edit->add_color_override("mark_color", mark_color);
@@ -376,7 +378,6 @@ void ScriptTextEditor::reload_text() {
int v = te->get_v_scroll();
te->set_text(script->get_source_code());
- te->clear_undo_history();
te->cursor_set_line(row);
te->cursor_set_column(column);
te->set_h_scroll(h);
@@ -1066,6 +1067,22 @@ void ScriptTextEditor::_edit_option(int p_op) {
goto_line_dialog->popup_find_line(tx);
} break;
+ case BOOKMARK_TOGGLE: {
+
+ code_editor->toggle_bookmark();
+ } break;
+ case BOOKMARK_GOTO_NEXT: {
+
+ code_editor->goto_next_bookmark();
+ } break;
+ case BOOKMARK_GOTO_PREV: {
+
+ code_editor->goto_prev_bookmark();
+ } break;
+ case BOOKMARK_REMOVE_ALL: {
+
+ code_editor->remove_all_bookmarks();
+ } break;
case DEBUG_TOGGLE_BREAKPOINT: {
int line = tx->cursor_get_line();
@@ -1266,7 +1283,8 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
Dictionary d = p_data;
if (d.has("type") && (String(d["type"]) == "resource" ||
String(d["type"]) == "files" ||
- String(d["type"]) == "nodes")) {
+ String(d["type"]) == "nodes" ||
+ String(d["type"]) == "files_and_dirs")) {
return true;
}
@@ -1328,7 +1346,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
te->insert_text_at_cursor(res->get_path());
}
- if (d.has("type") && String(d["type"]) == "files") {
+ if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) {
Array files = d["files"];
@@ -1499,6 +1517,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
if (p_selection) {
context_menu->add_separator();
@@ -1651,6 +1670,16 @@ ScriptTextEditor::ScriptTextEditor() {
search_menu->get_popup()->connect("id_pressed", this, "_edit_option");
+ PopupMenu *bookmarks = memnew(PopupMenu);
+ bookmarks->set_name("bookmarks");
+ edit_menu->get_popup()->add_child(bookmarks);
+ edit_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "bookmarks");
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
+ bookmarks->connect("id_pressed", this, "_edit_option");
+
edit_hb->add_child(edit_menu);
quick_open = memnew(ScriptEditorQuickOpen);
@@ -1692,6 +1721,10 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), 0);
ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0);
ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD | KEY_K);
+ ED_SHORTCUT("script_text_editor/toggle_bookmark", TTR("Toggle Bookmark"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_B);
+ ED_SHORTCUT("script_text_editor/goto_next_bookmark", TTR("Go to Next Bookmark"), KEY_MASK_CMD | KEY_B);
+ ED_SHORTCUT("script_text_editor/goto_previous_bookmark", TTR("Go to Previous Bookmark"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
+ ED_SHORTCUT("script_text_editor/remove_all_bookmarks", TTR("Remove All Bookmarks"), 0);
ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KEY_MASK_ALT | KEY_F);
ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), 0);
ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), 0);
@@ -1699,7 +1732,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CTRL | KEY_SPACE);
#else
- ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_B);
+ ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_D);
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
#endif
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
@@ -1739,7 +1772,7 @@ void ScriptTextEditor::register_editor() {
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);
#else
- ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_SHIFT | KEY_F1);
+ ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_F1);
#endif
ScriptEditor::register_create_script_editor_function(create_editor);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 0dbc884594..bdfdf18d45 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -128,6 +128,10 @@ class ScriptTextEditor : public ScriptEditorBase {
SEARCH_LOCATE_FUNCTION,
SEARCH_GOTO_LINE,
SEARCH_IN_FILES,
+ BOOKMARK_TOGGLE,
+ BOOKMARK_GOTO_NEXT,
+ BOOKMARK_GOTO_PREV,
+ BOOKMARK_REMOVE_ALL,
DEBUG_TOGGLE_BREAKPOINT,
DEBUG_REMOVE_ALL_BREAKPOINTS,
DEBUG_GOTO_NEXT_BREAKPOINT,
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 31660a9e19..a795405dfc 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -84,6 +84,7 @@ void ShaderTextEditor::_load_theme_settings() {
Color function_color = EDITOR_GET("text_editor/highlighting/function_color");
Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
Color mark_color = EDITOR_GET("text_editor/highlighting/mark_color");
+ Color bookmark_color = EDITOR_GET("text_editor/highlighting/bookmark_color");
Color breakpoint_color = EDITOR_GET("text_editor/highlighting/breakpoint_color");
Color executing_line_color = EDITOR_GET("text_editor/highlighting/executing_line_color");
Color code_folding_color = EDITOR_GET("text_editor/highlighting/code_folding_color");
@@ -113,6 +114,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_override("function_color", function_color);
get_text_edit()->add_color_override("member_variable_color", member_variable_color);
get_text_edit()->add_color_override("mark_color", mark_color);
+ get_text_edit()->add_color_override("bookmark_color", bookmark_color);
get_text_edit()->add_color_override("breakpoint_color", breakpoint_color);
get_text_edit()->add_color_override("executing_line_color", executing_line_color);
get_text_edit()->add_color_override("code_folding_color", code_folding_color);
@@ -304,6 +306,22 @@ void ShaderEditor::_menu_option(int p_option) {
goto_line_dialog->popup_find_line(shader_editor->get_text_edit());
} break;
+ case BOOKMARK_TOGGLE: {
+
+ shader_editor->toggle_bookmark();
+ } break;
+ case BOOKMARK_GOTO_NEXT: {
+
+ shader_editor->goto_next_bookmark();
+ } break;
+ case BOOKMARK_GOTO_PREV: {
+
+ shader_editor->goto_prev_bookmark();
+ } break;
+ case BOOKMARK_REMOVE_ALL: {
+
+ shader_editor->remove_all_bookmarks();
+ } break;
}
if (p_option != SEARCH_FIND && p_option != SEARCH_REPLACE && p_option != SEARCH_GOTO_LINE) {
shader_editor->get_text_edit()->call_deferred("grab_focus");
@@ -535,6 +553,16 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);
search_menu->get_popup()->connect("id_pressed", this, "_menu_option");
+ PopupMenu *bookmarks = memnew(PopupMenu);
+ bookmarks->set_name("bookmarks");
+ edit_menu->get_popup()->add_child(bookmarks);
+ edit_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "bookmarks");
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
+ bookmarks->connect("id_pressed", this, "_edit_option");
+
add_child(main_container);
main_container->add_child(hbc);
hbc->add_child(search_menu);
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index 46c78c1d33..28ac9faaa5 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -88,6 +88,10 @@ class ShaderEditor : public PanelContainer {
SEARCH_FIND_PREV,
SEARCH_REPLACE,
SEARCH_GOTO_LINE,
+ BOOKMARK_TOGGLE,
+ BOOKMARK_GOTO_NEXT,
+ BOOKMARK_GOTO_PREV,
+ BOOKMARK_REMOVE_ALL,
};
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 5a733f6509..60f1248ace 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -3510,10 +3510,14 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
camera->make_current();
surface->set_focus_mode(FOCUS_ALL);
+ VBoxContainer *vbox = memnew(VBoxContainer);
+ surface->add_child(vbox);
+ vbox->set_position(Point2(10, 10) * EDSCALE);
+
view_menu = memnew(MenuButton);
view_menu->set_flat(false);
- surface->add_child(view_menu);
- view_menu->set_position(Point2(10, 10) * EDSCALE);
+ vbox->add_child(view_menu);
+ view_menu->set_h_size_flags(0);
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP);
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM);
@@ -3566,9 +3570,9 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT);
preview_camera = memnew(CheckBox);
- preview_camera->set_position(Point2(10, 38) * EDSCALE); // Below the 'view_menu' MenuButton.
preview_camera->set_text(TTR("Preview"));
- surface->add_child(preview_camera);
+ vbox->add_child(preview_camera);
+ preview_camera->set_h_size_flags(0);
preview_camera->hide();
preview_camera->connect("toggled", this, "_toggle_camera_preview");
previewing = NULL;
@@ -5605,7 +5609,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
ED_SHORTCUT("spatial_editor/front_view", TTR("Front View"), KEY_KP_1);
ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KEY_MASK_ALT + KEY_KP_3);
ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), KEY_KP_3);
- ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal view"), KEY_KP_5);
+ ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal View"), KEY_KP_5);
ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K);
ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), KEY_O);
ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F);
@@ -5626,7 +5630,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
hbc_menu->add_child(transform_menu);
p = transform_menu->get_popup();
- p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap object to floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog...")), MENU_TRANSFORM_DIALOG);
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 6edd19901b..c509202a88 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -51,32 +51,42 @@ void SpriteFramesEditor::_open_sprite_sheet() {
}
void SpriteFramesEditor::_sheet_preview_draw() {
+
Size2i size = split_sheet_preview->get_size();
int h = split_sheet_h->get_value();
int v = split_sheet_v->get_value();
+ int width = size.width / h;
+ int height = size.height / v;
const float a = 0.3;
for (int i = 1; i < h; i++) {
- for (int j = 1; j < v; j++) {
- int x = i * size.width / h;
- int y = j * size.height / v;
+ int x = i * width;
+ split_sheet_preview->draw_line(Point2(x, 0), Point2(x, size.height), Color(1, 1, 1, a));
+ split_sheet_preview->draw_line(Point2(x + 1, 0), Point2(x + 1, size.height), Color(0, 0, 0, a));
- split_sheet_preview->draw_line(Point2(x, 0), Point2(x, size.height), Color(1, 1, 1, a));
- split_sheet_preview->draw_line(Point2(x + 1, 0), Point2(x + 1, size.height), Color(0, 0, 0, a));
+ for (int j = 1; j < v; j++) {
+
+ int y = j * height;
split_sheet_preview->draw_line(Point2(0, y), Point2(size.width, y), Color(1, 1, 1, a));
split_sheet_preview->draw_line(Point2(0, y + 1), Point2(size.width, y + 1), Color(0, 0, 0, a));
}
}
+ if (frames_selected.size() == 0) {
+ split_sheet_dialog->get_ok()->set_disabled(true);
+ split_sheet_dialog->get_ok()->set_text(TTR("No Frames Selected"));
+ return;
+ }
+
Color accent = get_color("accent_color", "Editor");
for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) {
int idx = E->get();
- int x = (idx % h) * size.width / h;
- int y = (idx / v) * size.height / v;
- int width = size.width / h;
- int height = size.height / v;
+ int xp = idx % h;
+ int yp = (idx - xp) / h;
+ int x = xp * width;
+ int y = yp * height;
split_sheet_preview->draw_rect(Rect2(x + 5, y + 5, width - 10, height - 10), Color(0, 0, 0, 0.35), true);
split_sheet_preview->draw_rect(Rect2(x + 0, y + 0, width - 0, height - 0), Color(0, 0, 0, 1), false);
@@ -87,13 +97,8 @@ void SpriteFramesEditor::_sheet_preview_draw() {
split_sheet_preview->draw_rect(Rect2(x + 5, y + 5, width - 10, height - 10), Color(0, 0, 0, 1), false);
}
- if (frames_selected.size() == 0) {
- split_sheet_dialog->get_ok()->set_disabled(true);
- split_sheet_dialog->get_ok()->set_text(TTR("No Frames Selected"));
- } else {
- split_sheet_dialog->get_ok()->set_disabled(false);
- split_sheet_dialog->get_ok()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size()));
- }
+ split_sheet_dialog->get_ok()->set_disabled(false);
+ split_sheet_dialog->get_ok()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size()));
}
void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
@@ -149,10 +154,12 @@ void SpriteFramesEditor::_sheet_add_frames() {
for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) {
int idx = E->get();
- int x = (idx % h) * size.width / h;
- int y = (idx / v) * size.height / v;
int width = size.width / h;
int height = size.height / v;
+ int xp = idx % h;
+ int yp = (idx - xp) / h;
+ int x = xp * width;
+ int y = yp * height;
Ref<AtlasTexture> at;
at.instance();
@@ -456,6 +463,10 @@ void SpriteFramesEditor::_animation_select() {
if (updating)
return;
+ double value = anim_speed->get_line_edit()->get_text().to_double();
+ if (!Math::is_equal_approx(value, frames->get_animation_speed(edited_anim)))
+ _animation_fps_changed(value);
+
TreeItem *selected = animations->get_selected();
ERR_FAIL_COND(!selected);
edited_anim = selected->get_text(0);
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index becaae3567..a0f3c253d1 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -93,6 +93,7 @@ void TextEditor::_load_theme_settings() {
Color function_color = EDITOR_GET("text_editor/highlighting/function_color");
Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
Color mark_color = EDITOR_GET("text_editor/highlighting/mark_color");
+ Color bookmark_color = EDITOR_GET("text_editor/highlighting/bookmark_color");
Color breakpoint_color = EDITOR_GET("text_editor/highlighting/breakpoint_color");
Color executing_line_color = EDITOR_GET("text_editor/highlighting/executing_line_color");
Color code_folding_color = EDITOR_GET("text_editor/highlighting/code_folding_color");
@@ -127,6 +128,7 @@ void TextEditor::_load_theme_settings() {
text_edit->add_color_override("breakpoint_color", breakpoint_color);
text_edit->add_color_override("executing_line_color", executing_line_color);
text_edit->add_color_override("mark_color", mark_color);
+ text_edit->add_color_override("bookmark_color", bookmark_color);
text_edit->add_color_override("code_folding_color", code_folding_color);
text_edit->add_color_override("search_result_color", search_result_color);
text_edit->add_color_override("search_result_border_color", search_result_border_color);
@@ -202,7 +204,6 @@ void TextEditor::reload_text() {
int v = te->get_v_scroll();
te->set_text(text_file->get_text());
- te->clear_undo_history();
te->cursor_set_line(row);
te->cursor_set_column(column);
te->set_h_scroll(h);
@@ -438,6 +439,22 @@ void TextEditor::_edit_option(int p_op) {
goto_line_dialog->popup_find_line(tx);
} break;
+ case BOOKMARK_TOGGLE: {
+
+ code_editor->toggle_bookmark();
+ } break;
+ case BOOKMARK_GOTO_NEXT: {
+
+ code_editor->goto_next_bookmark();
+ } break;
+ case BOOKMARK_GOTO_PREV: {
+
+ code_editor->goto_prev_bookmark();
+ } break;
+ case BOOKMARK_REMOVE_ALL: {
+
+ code_editor->remove_all_bookmarks();
+ } break;
}
}
@@ -620,5 +637,15 @@ TextEditor::TextEditor() {
highlighter_menu->add_radio_check_item(TTR("Standard"));
highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter");
+ PopupMenu *bookmarks = memnew(PopupMenu);
+ bookmarks->set_name("bookmarks");
+ edit_menu->get_popup()->add_child(bookmarks);
+ edit_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "bookmarks");
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT);
+ bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
+ bookmarks->connect("id_pressed", this, "_edit_option");
+
code_editor->get_text_edit()->set_drag_forwarding(this);
}
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index 767001e2f6..2da7474793 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -87,6 +87,10 @@ private:
SEARCH_FIND_PREV,
SEARCH_REPLACE,
SEARCH_GOTO_LINE,
+ BOOKMARK_TOGGLE,
+ BOOKMARK_GOTO_NEXT,
+ BOOKMARK_GOTO_PREV,
+ BOOKMARK_REMOVE_ALL,
};
protected:
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 80e2e99685..5b67d259ba 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -631,12 +631,14 @@ ThemeEditor::ThemeEditor() {
scroll = memnew(ScrollContainer);
add_child(scroll);
+ scroll->set_theme(Theme::get_default());
scroll->set_enable_v_scroll(true);
scroll->set_enable_h_scroll(false);
scroll->set_v_size_flags(SIZE_EXPAND_FILL);
main_container = memnew(MarginContainer);
scroll->add_child(main_container);
+ main_container->set_theme(Theme::get_default());
main_container->set_clip_contents(true);
main_container->set_custom_minimum_size(Size2(700, 0) * EDSCALE);
main_container->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -646,11 +648,9 @@ ThemeEditor::ThemeEditor() {
Panel *panel = memnew(Panel);
main_container->add_child(panel);
- panel->set_theme(Theme::get_default());
MarginContainer *mc = memnew(MarginContainer);
main_container->add_child(mc);
- mc->set_theme(Theme::get_default());
mc->add_constant_override("margin_right", 4 * EDSCALE);
mc->add_constant_override("margin_top", 4 * EDSCALE);
mc->add_constant_override("margin_left", 4 * EDSCALE);
@@ -683,7 +683,6 @@ ThemeEditor::ThemeEditor() {
CheckButton *cb = memnew(CheckButton);
cb->set_text("CheckButton");
first_vb->add_child(cb);
- cb = memnew(CheckButton);
CheckBox *cbx = memnew(CheckBox);
cbx->set_text("CheckBox");
first_vb->add_child(cbx);
@@ -880,11 +879,9 @@ ThemeEditor::ThemeEditor() {
void ThemeEditorPlugin::edit(Object *p_node) {
if (Object::cast_to<Theme>(p_node)) {
- theme_editor->show();
theme_editor->edit(Object::cast_to<Theme>(p_node));
} else {
theme_editor->edit(Ref<Theme>());
- theme_editor->hide();
}
}
@@ -899,11 +896,11 @@ void ThemeEditorPlugin::make_visible(bool p_visible) {
theme_editor->set_process(true);
button->show();
editor->make_bottom_panel_item_visible(theme_editor);
-
} else {
theme_editor->set_process(false);
if (theme_editor->is_visible_in_tree())
editor->hide_bottom_panel();
+
button->hide();
}
}
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index abb52f8359..29a54f815d 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -115,6 +115,9 @@ void TileMapEditor::_update_button_tool() {
default:
break;
}
+
+ if (tool != TOOL_PICKING)
+ last_tool = tool;
}
void TileMapEditor::_button_tool_select(int p_tool) {
@@ -237,22 +240,23 @@ void TileMapEditor::set_selected_tiles(Vector<int> p_tiles) {
palette->ensure_current_is_visible();
}
-void TileMapEditor::_create_set_cell_undo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) {
+Dictionary TileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord) {
+
+ Dictionary cell;
- Dictionary cell_old;
- Dictionary cell_new;
+ cell["id"] = tile;
+ cell["flip_h"] = flip_x;
+ cell["flip_y"] = flip_y;
+ cell["transpose"] = transpose;
+ cell["auto_coord"] = autotile_coord;
- cell_old["id"] = p_cell_old.idx;
- cell_old["flip_h"] = p_cell_old.xf;
- cell_old["flip_y"] = p_cell_old.yf;
- cell_old["transpose"] = p_cell_old.tr;
- cell_old["auto_coord"] = p_cell_old.ac;
+ return cell;
+}
- cell_new["id"] = p_cell_new.idx;
- cell_new["flip_h"] = p_cell_new.xf;
- cell_new["flip_y"] = p_cell_new.yf;
- cell_new["transpose"] = p_cell_new.tr;
- cell_new["auto_coord"] = p_cell_new.ac;
+void TileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) {
+
+ Dictionary cell_old = _create_cell_dictionary(p_cell_old.idx, p_cell_old.xf, p_cell_old.yf, p_cell_old.tr, p_cell_old.ac);
+ Dictionary cell_new = _create_cell_dictionary(p_cell_new.idx, p_cell_new.xf, p_cell_new.yf, p_cell_new.tr, p_cell_new.ac);
undo_redo->add_undo_method(node, "_set_celld", p_vec, cell_old);
undo_redo->add_do_method(node, "_set_celld", p_vec, cell_new);
@@ -268,7 +272,7 @@ void TileMapEditor::_finish_undo() {
if (undo_data.size()) {
for (Map<Point2i, CellOp>::Element *E = undo_data.front(); E; E = E->next()) {
- _create_set_cell_undo(E->key(), E->get(), _get_op_from_cell(E->key()));
+ _create_set_cell_undo_redo(E->key(), E->get(), _get_op_from_cell(E->key()));
}
undo_data.clear();
@@ -316,10 +320,7 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p
}
}
- Variant v_pos_x = p_pos.x, v_pos_y = p_pos.y, v_tile = p_value, v_flip_h = p_flip_h, v_flip_v = p_flip_v, v_transpose = p_transpose, v_autotile_coord = Vector2(p_autotile_coord.x, p_autotile_coord.y);
- const Variant *args[7] = { &v_pos_x, &v_pos_y, &v_tile, &v_flip_h, &v_flip_v, &v_transpose, &v_autotile_coord };
- Variant::CallError ce;
- node->call("set_cell", args, 7, ce);
+ node->_set_celld(p_pos, _create_cell_dictionary(p_value, p_flip_h, p_flip_v, p_transpose, p_autotile_coord));
if (manual_autotile || (p_value != -1 && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE)) {
if (current != -1) {
@@ -949,11 +950,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mb->get_shift()) {
-#ifdef APPLE_STYLE_KEYS
if (mb->get_command())
-#else
- if (mb->get_control())
-#endif
tool = TOOL_RECTANGLE_PAINT;
else
tool = TOOL_LINE_PAINT;
@@ -964,11 +961,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
_update_button_tool();
return true;
}
-#ifdef APPLE_STYLE_KEYS
+
if (mb->get_command()) {
-#else
- if (mb->get_control()) {
-#endif
tool = TOOL_PICKING;
_pick_tile(over_tile);
_update_button_tool();
@@ -1136,11 +1130,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
_start_undo(TTR("Erase TileMap"));
if (mb->get_shift()) {
-#ifdef APPLE_STYLE_KEYS
if (mb->get_command())
-#else
- if (mb->get_control())
-#endif
tool = TOOL_RECTANGLE_ERASE;
else
tool = TOOL_LINE_ERASE;
@@ -1344,6 +1334,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (k.is_valid() && k->is_pressed()) {
+ if (last_tool == TOOL_NONE && tool == TOOL_PICKING && k->get_scancode() == KEY_SHIFT && k->get_command()) {
+ // trying to draw a rectangle with the painting tool, so change to the correct tool
+ tool = last_tool;
+
+ CanvasItemEditor::get_singleton()->update_viewport();
+ _update_button_tool();
+ }
+
if (k->get_scancode() == KEY_ESCAPE) {
if (tool == TOOL_PASTING)
@@ -1448,8 +1446,30 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
CanvasItemEditor::get_singleton()->update_viewport();
return true;
}
- }
+ } else if (k.is_valid()) { // release event
+
+ if (tool == TOOL_NONE) {
+
+ if (k->get_scancode() == KEY_SHIFT && k->get_command()) {
+ tool = TOOL_PICKING;
+ _update_button_tool();
+ }
+ } else if (tool == TOOL_PICKING) {
+
+#ifdef APPLE_STYLE_KEYS
+ if (k->get_scancode() == KEY_META) {
+#else
+ if (k->get_scancode() == KEY_CONTROL) {
+#endif
+ // go back to that last tool if KEY_CONTROL was released
+ tool = last_tool;
+
+ CanvasItemEditor::get_singleton()->update_viewport();
+ _update_button_tool();
+ }
+ }
+ }
return false;
}
@@ -1923,6 +1943,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
// Tools
paint_button = memnew(ToolButton);
paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P));
+ paint_button->set_tooltip(TTR("Shift+RMB: Line Draw\nShift+Ctrl+RMB: Rectangle Paint"));
paint_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_NONE));
paint_button->set_toggle_mode(true);
toolbar->add_child(paint_button);
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 3bc10861f0..fcdada1111 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -105,6 +105,7 @@ class TileMapEditor : public VBoxContainer {
CheckBox *manual_button;
Tool tool;
+ Tool last_tool;
bool selection_active;
bool mouse_over;
@@ -192,9 +193,10 @@ class TileMapEditor : public VBoxContainer {
void _palette_selected(int index);
void _palette_multi_selected(int index, bool selected);
+ Dictionary _create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord);
void _start_undo(const String &p_action);
void _finish_undo();
- void _create_set_cell_undo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new);
+ void _create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new);
void _set_cell(const Point2i &p_pos, Vector<int> p_values, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false, const Point2i p_autotile_coord = Point2());
void _canvas_mouse_enter();
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 21470d81ed..93c6614841 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -1654,7 +1654,7 @@ void TileSetEditor::_on_tool_clicked(int p_tool) {
edited_collision_shape = _convex;
_set_edited_shape_points(_get_collision_shape_points(concave));
} else {
- // Shoudn't haphen
+ // Shouldn't happen
}
for (int i = 0; i < sd.size(); i++) {
if (sd[i].get("shape") == previous_shape) {
@@ -1892,7 +1892,7 @@ void TileSetEditor::_update_toggle_shape_button() {
tools[SHAPE_TOGGLE_TYPE]->set_icon(get_icon("ConcavePolygonShape2D", "EditorIcons"));
tools[SHAPE_TOGGLE_TYPE]->set_text("Make Concave");
} else {
- // Shoudn't happen
+ // Shouldn't happen
separator_shape_toggle->hide();
tools[SHAPE_TOGGLE_TYPE]->hide();
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 964303ba22..c2e847f211 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -31,6 +31,7 @@
#include "visual_shader_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/math/math_defs.h"
#include "core/os/input.h"
#include "core/os/keyboard.h"
#include "core/project_settings.h"
@@ -58,7 +59,15 @@ void VisualShaderNodePlugin::_bind_methods() {
void VisualShaderEditor::edit(VisualShader *p_visual_shader) {
+ bool changed = false;
if (p_visual_shader) {
+ if (visual_shader.is_null()) {
+ changed = true;
+ } else {
+ if (visual_shader.ptr() != p_visual_shader) {
+ changed = true;
+ }
+ }
visual_shader = Ref<VisualShader>(p_visual_shader);
} else {
visual_shader.unref();
@@ -67,6 +76,9 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) {
if (visual_shader.is_null()) {
hide();
} else {
+ if (changed) { // to avoid tree collapse
+ _update_options_menu();
+ }
_update_graph();
}
}
@@ -174,6 +186,12 @@ void VisualShaderEditor::_update_options_menu() {
int item_count2 = 0;
bool is_first_item = true;
+ int current_func = -1;
+
+ if (!visual_shader.is_null()) {
+ current_func = visual_shader->get_mode();
+ }
+
for (int i = 0; i < add_options.size() + 1; i++) {
if (i == add_options.size()) {
@@ -220,7 +238,7 @@ void VisualShaderEditor::_update_options_menu() {
}
}
if (sub_category != NULL) {
- if (_is_available(add_options[i].mode)) {
+ if ((add_options[i].func == current_func || add_options[i].func == -1) && _is_available(add_options[i].mode)) {
++item_count2;
TreeItem *item = members->create_item(sub_category);
item->set_text(0, add_options[i].name);
@@ -252,7 +270,7 @@ void VisualShaderEditor::_update_options_menu() {
}
} else {
if (category != NULL) {
- if (_is_available(add_options[i].mode)) {
+ if ((add_options[i].func == current_func || add_options[i].func == -1) && _is_available(add_options[i].mode)) {
++item_count;
TreeItem *item = members->create_item(category);
item->set_text(0, add_options[i].name);
@@ -341,7 +359,9 @@ void VisualShaderEditor::_update_graph() {
for (int i = 0; i < graph->get_child_count(); i++) {
if (Object::cast_to<GraphNode>(graph->get_child(i))) {
- memdelete(graph->get_child(i));
+ Node *node = graph->get_child(i);
+ graph->remove_child(node);
+ memdelete(node);
i--;
}
}
@@ -360,13 +380,33 @@ void VisualShaderEditor::_update_graph() {
Vector<int> nodes = visual_shader->get_node_list(type);
+ Control *offset;
+
for (int n_i = 0; n_i < nodes.size(); n_i++) {
Vector2 position = visual_shader->get_node_position(type, nodes[n_i]);
Ref<VisualShaderNode> vsnode = visual_shader->get_node(type, nodes[n_i]);
+ Ref<VisualShaderNodeGroupBase> group_node = Object::cast_to<VisualShaderNodeGroupBase>(vsnode.ptr());
+ bool is_group = !group_node.is_null();
+ Size2 size = Size2(0, 0);
+
+ Ref<VisualShaderNodeExpression> expression_node = Object::cast_to<VisualShaderNodeExpression>(group_node.ptr());
+ bool is_expression = !expression_node.is_null();
+ String expression = "";
+
GraphNode *node = memnew(GraphNode);
+ if (is_group) {
+ size = group_node->get_size();
+
+ node->set_resizable(true);
+ node->connect("resize_request", this, "_node_resized", varray((int)type, nodes[n_i]));
+ }
+ if (is_expression) {
+ expression = expression_node->get_expression();
+ }
+
/*if (!vsnode->is_connected("changed", this, "_node_changed")) {
vsnode->connect("changed", this, "_node_changed", varray(vsnode->get_instance_id()), CONNECT_DEFERRED);
}*/
@@ -386,6 +426,10 @@ void VisualShaderEditor::_update_graph() {
Control *custom_editor = NULL;
int port_offset = 0;
+ if (is_group) {
+ port_offset++;
+ }
+
Ref<VisualShaderNodeUniform> uniform = vsnode;
if (uniform.is_valid()) {
graph->add_child(node);
@@ -421,6 +465,24 @@ void VisualShaderEditor::_update_graph() {
custom_editor = NULL;
}
+ if (is_group) {
+ HBoxContainer *hb2 = memnew(HBoxContainer);
+
+ Button *add_input_btn = memnew(Button);
+ add_input_btn->set_text(TTR("Add input +"));
+ add_input_btn->connect("pressed", this, "_add_input_port", varray(nodes[n_i], group_node->get_free_input_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "input" + itos(group_node->get_free_input_port_id())), CONNECT_DEFERRED);
+ hb2->add_child(add_input_btn);
+
+ hb2->add_spacer();
+
+ Button *add_output_btn = memnew(Button);
+ add_output_btn->set_text(TTR("Add output +"));
+ add_output_btn->connect("pressed", this, "_add_output_port", varray(nodes[n_i], group_node->get_free_output_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "output" + itos(group_node->get_free_output_port_id())), CONNECT_DEFERRED);
+ hb2->add_child(add_output_btn);
+
+ node->add_child(hb2);
+ }
+
for (int i = 0; i < MAX(vsnode->get_input_port_count(), vsnode->get_output_port_count()); i++) {
if (vsnode->is_port_separator(i)) {
@@ -490,21 +552,75 @@ void VisualShaderEditor::_update_graph() {
if (valid_left) {
- Label *label = memnew(Label);
- label->set_text(name_left);
- label->add_style_override("normal", label_style); //more compact
- hb->add_child(label);
+ if (is_group) {
+
+ OptionButton *type_box = memnew(OptionButton);
+ hb->add_child(type_box);
+ type_box->add_item(TTR("Scalar"));
+ type_box->add_item(TTR("Vector"));
+ type_box->add_item(TTR("Boolean"));
+ type_box->add_item(TTR("Transform"));
+ type_box->select(group_node->get_input_port_type(i));
+ type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
+ type_box->connect("item_selected", this, "_change_input_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED);
+
+ LineEdit *name_box = memnew(LineEdit);
+ hb->add_child(name_box);
+ name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
+ name_box->set_text(name_left);
+ name_box->set_expand_to_text_length(true);
+ 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);
+ }
+ } else {
+
+ Label *label = memnew(Label);
+ label->set_text(name_left);
+ label->add_style_override("normal", label_style); //more compact
+ hb->add_child(label);
+ }
}
hb->add_spacer();
if (valid_right) {
-
- Label *label = memnew(Label);
- label->set_text(name_right);
- label->set_align(Label::ALIGN_RIGHT);
- label->add_style_override("normal", label_style); //more compact
- hb->add_child(label);
+ 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_output_port", varray(nodes[n_i], i), CONNECT_DEFERRED);
+ hb->add_child(remove_btn);
+
+ LineEdit *name_box = memnew(LineEdit);
+ hb->add_child(name_box);
+ name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
+ name_box->set_text(name_right);
+ name_box->set_expand_to_text_length(true);
+ name_box->connect("text_entered", this, "_change_output_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, true));
+
+ OptionButton *type_box = memnew(OptionButton);
+ hb->add_child(type_box);
+ type_box->add_item(TTR("Scalar"));
+ type_box->add_item(TTR("Vector"));
+ type_box->add_item(TTR("Boolean"));
+ type_box->add_item(TTR("Transform"));
+ type_box->select(group_node->get_output_port_type(i));
+ type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
+ type_box->connect("item_selected", this, "_change_output_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED);
+ } else {
+ Label *label = memnew(Label);
+ label->set_text(name_right);
+ label->add_style_override("normal", label_style); //more compact
+ hb->add_child(label);
+ }
}
}
@@ -523,18 +639,33 @@ void VisualShaderEditor::_update_graph() {
hb->add_child(preview);
}
+ if (is_group) {
+ offset = memnew(Control);
+ offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE));
+ node->add_child(offset);
+ port_offset++;
+ }
+
node->add_child(hb);
node->set_slot(i + port_offset, valid_left, port_left, type_color[port_left], valid_right, port_right, type_color[port_right]);
}
if (vsnode->get_output_port_for_preview() >= 0 && vsnode->get_output_port_type(vsnode->get_output_port_for_preview()) != VisualShaderNode::PORT_TYPE_TRANSFORM) {
+ offset = memnew(Control);
+ offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE));
+ node->add_child(offset);
+
VisualShaderNodePortPreview *port_preview = memnew(VisualShaderNodePortPreview);
port_preview->setup(visual_shader, type, nodes[n_i], vsnode->get_output_port_for_preview());
port_preview->set_h_size_flags(SIZE_SHRINK_CENTER);
node->add_child(port_preview);
}
+ offset = memnew(Control);
+ offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE));
+ node->add_child(offset);
+
String error = vsnode->get_warning(visual_shader->get_mode(), type);
if (error != String()) {
Label *error_label = memnew(Label);
@@ -543,9 +674,42 @@ void VisualShaderEditor::_update_graph() {
node->add_child(error_label);
}
+ if (is_expression) {
+
+ TextEdit *expression_box = memnew(TextEdit);
+ expression_node->set_control(expression_box, 0);
+ node->add_child(expression_box);
+
+ Color text_color = EDITOR_GET("text_editor/highlighting/text_color");
+ Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
+ Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
+ Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color");
+
+ expression_box->set_syntax_coloring(true);
+
+ for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) {
+
+ expression_box->add_keyword_color(E->get(), keyword_color);
+ }
+
+ expression_box->add_font_override("font", get_font("expression", "EditorFonts"));
+ expression_box->add_color_override("font_color", text_color);
+ expression_box->add_color_override("symbol_color", symbol_color);
+ expression_box->add_color_region("/*", "*/", comment_color, false);
+ expression_box->add_color_region("//", "", comment_color, false);
+
+ expression_box->set_text(expression);
+ expression_box->set_context_menu_enabled(false);
+ expression_box->set_show_line_numbers(true);
+
+ expression_box->connect("focus_exited", this, "_expression_focus_out", varray(expression_box, nodes[n_i]));
+ }
+
if (!uniform.is_valid()) {
graph->add_child(node);
_update_created_node(node);
+ if (is_group)
+ call_deferred("_set_node_size", (int)type, nodes[n_i], size);
}
}
@@ -560,6 +724,285 @@ void VisualShaderEditor::_update_graph() {
}
}
+void VisualShaderEditor::_add_input_port(int p_node, int p_port, int p_port_type, const String &p_name) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeExpression> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Add input port"));
+ undo_redo->add_do_method(node.ptr(), "add_input_port", p_port, p_port_type, p_name);
+ undo_redo->add_undo_method(node.ptr(), "remove_input_port", p_port);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_add_output_port(int p_node, int p_port, int p_port_type, const String &p_name) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Add output port"));
+ undo_redo->add_do_method(node.ptr(), "add_output_port", p_port, p_port_type, p_name);
+ undo_redo->add_undo_method(node.ptr(), "remove_output_port", p_port);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_change_input_port_type(int p_type, int p_node, int p_port) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Change input port type"));
+ undo_redo->add_do_method(node.ptr(), "set_input_port_type", p_port, p_type);
+ undo_redo->add_undo_method(node.ptr(), "set_input_port_type", p_port, node->get_input_port_type(p_port));
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_change_output_port_type(int p_type, int p_node, int p_port) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Change output port type"));
+ undo_redo->add_do_method(node.ptr(), "set_output_port_type", p_port, p_type);
+ undo_redo->add_undo_method(node.ptr(), "set_output_port_type", p_port, node->get_output_port_type(p_port));
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_change_input_port_name(const String &p_text, Object *line_edit, int p_node_id, int p_port_id) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node_id);
+ ERR_FAIL_COND(!node.is_valid());
+
+ undo_redo->create_action(TTR("Change input port name"));
+ undo_redo->add_do_method(node.ptr(), "set_input_port_name", p_port_id, p_text);
+ undo_redo->add_undo_method(node.ptr(), "set_input_port_name", p_port_id, node->get_input_port_name(p_port_id));
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_change_output_port_name(const String &p_text, Object *line_edit, int p_node_id, int p_port_id) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node_id);
+ ERR_FAIL_COND(!node.is_valid());
+
+ undo_redo->create_action(TTR("Change output port name"));
+ undo_redo->add_do_method(node.ptr(), "set_output_port_name", p_port_id, p_text);
+ undo_redo->add_undo_method(node.ptr(), "set_output_port_name", p_port_id, node->get_output_port_name(p_port_id));
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_remove_input_port(int p_node, int p_port) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Remove input port"));
+
+ List<VisualShader::Connection> conns;
+ visual_shader->get_node_connections(type, &conns);
+ for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
+
+ int from_node = E->get().from_node;
+ int from_port = E->get().from_port;
+ int to_node = E->get().to_node;
+ int to_port = E->get().to_port;
+
+ if (to_node == p_node) {
+ if (to_port == p_port) {
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_port, to_node, to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes_forced", type, from_node, from_port, to_node, to_port);
+ } else if (to_port > p_port) {
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_port, to_node, to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes_forced", type, from_node, from_port, to_node, to_port);
+
+ undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes_forced", type, from_node, from_port, to_node, to_port - 1);
+ undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_port, to_node, to_port - 1);
+ }
+ }
+ }
+
+ undo_redo->add_do_method(node.ptr(), "remove_input_port", p_port);
+ undo_redo->add_undo_method(node.ptr(), "add_input_port", p_port, (int)node->get_input_port_type(p_port), node->get_input_port_name(p_port));
+
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_remove_output_port(int p_node, int p_port) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Remove output port"));
+
+ List<VisualShader::Connection> conns;
+ visual_shader->get_node_connections(type, &conns);
+ for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
+
+ int from_node = E->get().from_node;
+ int from_port = E->get().from_port;
+ int to_node = E->get().to_node;
+ int to_port = E->get().to_port;
+
+ if (from_node == p_node) {
+ if (from_port == p_port) {
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_port, to_node, to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes_forced", type, from_node, from_port, to_node, to_port);
+ } else if (from_port > p_port) {
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_port, to_node, to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes_forced", type, from_node, from_port, to_node, to_port);
+
+ undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes_forced", type, from_node, from_port - 1, to_node, to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_port - 1, to_node, to_port);
+ }
+ }
+ }
+
+ undo_redo->add_do_method(node.ptr(), "remove_output_port", p_port);
+ undo_redo->add_undo_method(node.ptr(), "add_output_port", p_port, (int)node->get_output_port_type(p_port), node->get_output_port_name(p_port));
+
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_expression_focus_out(Object *text_edit, int p_node) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNodeExpression> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ TextEdit *expression_box = Object::cast_to<TextEdit>(text_edit);
+
+ if (node->get_expression() == expression_box->get_text())
+ return;
+
+ undo_redo->create_action(TTR("Set expression"));
+ undo_redo->add_do_method(node.ptr(), "set_expression", expression_box->get_text());
+ undo_redo->add_undo_method(node.ptr(), "set_expression", node->get_expression());
+ undo_redo->add_do_method(this, "_rebuild");
+ undo_redo->add_undo_method(this, "_rebuild");
+ undo_redo->commit_action();
+}
+
+void VisualShaderEditor::_rebuild() {
+ EditorNode::get_singleton()->get_log()->clear();
+ visual_shader->rebuild();
+}
+
+void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p_size) {
+
+ VisualShader::Type type = VisualShader::Type(p_type);
+ Ref<VisualShaderNode> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ Ref<VisualShaderNodeGroupBase> group_node = Object::cast_to<VisualShaderNodeGroupBase>(node.ptr());
+
+ if (group_node.is_null()) {
+ return;
+ }
+
+ Vector2 size = p_size;
+
+ group_node->set_size(size);
+
+ GraphNode *gn = NULL;
+ if (edit_type->get_selected() == p_type) { // check - otherwise the error will be emitted
+ Node *node2 = graph->get_node(itos(p_node));
+ gn = Object::cast_to<GraphNode>(node2);
+ if (!gn)
+ return;
+
+ gn->set_custom_minimum_size(size);
+ gn->set_size(Size2(1, 1));
+ }
+
+ Ref<VisualShaderNodeExpression> expression_node = Object::cast_to<VisualShaderNodeExpression>(node.ptr());
+ if (!expression_node.is_null()) {
+ Control *text_box = expression_node->get_control(0);
+ Size2 box_size = size;
+ if (gn != NULL) {
+ if (box_size.x < 150 * EDSCALE || box_size.y < 0) {
+ box_size.x = gn->get_size().x;
+ }
+ }
+ box_size.x -= text_box->get_margin(MARGIN_LEFT);
+ box_size.x -= 28 * EDSCALE;
+ box_size.y -= text_box->get_margin(MARGIN_TOP);
+ box_size.y -= 28 * EDSCALE;
+ text_box->set_custom_minimum_size(Size2(box_size.x, box_size.y));
+ text_box->set_size(Size2(1, 1));
+ }
+}
+
+void VisualShaderEditor::_node_resized(const Vector2 &p_new_size, int p_type, int p_node) {
+
+ VisualShader::Type type = VisualShader::Type(p_type);
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node);
+ if (node.is_null()) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Resize VisualShader node"), UndoRedo::MERGE_ENDS);
+ undo_redo->add_do_method(this, "_set_node_size", p_type, p_node, p_new_size / EDSCALE);
+ undo_redo->add_undo_method(this, "_set_node_size", p_type, p_node, node->get_size());
+ undo_redo->commit_action();
+}
+
void VisualShaderEditor::_preview_select_port(int p_node, int p_port) {
VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
@@ -606,6 +1049,52 @@ void VisualShaderEditor::_line_edit_focus_out(Object *line_edit, int p_node_id)
_line_edit_changed(text, line_edit, p_node_id);
}
+void VisualShaderEditor::_port_name_focus_out(Object *line_edit, int p_node_id, int p_port_id, bool p_output) {
+
+ VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+
+ Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(type, p_node_id);
+ ERR_FAIL_COND(!node.is_valid());
+
+ String text = Object::cast_to<LineEdit>(line_edit)->get_text();
+
+ if (!p_output) {
+ if (node->get_input_port_name(p_port_id) == text)
+ return;
+ } else {
+ if (node->get_output_port_name(p_port_id) == text)
+ return;
+ }
+
+ List<String> input_names;
+ List<String> output_names;
+
+ for (int i = 0; i < node->get_input_port_count(); i++) {
+ if (!p_output && i == p_port_id) continue;
+ input_names.push_back(node->get_input_port_name(i));
+ }
+ for (int i = 0; i < node->get_output_port_count(); i++) {
+ if (p_output && i == p_port_id) continue;
+ output_names.push_back(node->get_output_port_name(i));
+ }
+
+ String validated_name = visual_shader->validate_port_name(text, input_names, output_names);
+ if (validated_name == "") {
+ if (!p_output) {
+ Object::cast_to<LineEdit>(line_edit)->set_text(node->get_input_port_name(p_port_id));
+ } else {
+ Object::cast_to<LineEdit>(line_edit)->set_text(node->get_output_port_name(p_port_id));
+ }
+ return;
+ }
+
+ if (!p_output) {
+ _change_input_port_name(validated_name, line_edit, p_node_id, p_port_id);
+ } else {
+ _change_output_port_name(validated_name, line_edit, p_node_id, p_port_id);
+ }
+}
+
void VisualShaderEditor::_port_edited() {
VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
@@ -650,6 +1139,13 @@ void VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instance(add_options[p_idx].type));
ERR_FAIL_COND(!vsn);
+ VisualShaderNodeScalarConstant *constant = Object::cast_to<VisualShaderNodeScalarConstant>(vsn);
+
+ if (constant) {
+ if ((int)add_options[p_idx].value != -1)
+ constant->set_constant(add_options[p_idx].value);
+ }
+
if (p_op_idx != -1) {
VisualShaderNodeInput *input = Object::cast_to<VisualShaderNodeInput>(vsn);
@@ -740,6 +1236,12 @@ void VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
undo_redo->create_action(TTR("Add Node to Visual Shader"));
undo_redo->add_do_method(visual_shader.ptr(), "add_node", type, vsnode, position, id_to_use);
undo_redo->add_undo_method(visual_shader.ptr(), "remove_node", type, id_to_use);
+
+ VisualShaderNodeExpression *expr = Object::cast_to<VisualShaderNodeExpression>(vsnode.ptr());
+ if (expr) {
+ undo_redo->add_do_method(expr, "set_size", Size2(250 * EDSCALE, 150 * EDSCALE));
+ }
+
undo_redo->add_do_method(this, "_update_graph");
undo_redo->add_undo_method(this, "_update_graph");
undo_redo->commit_action();
@@ -814,10 +1316,25 @@ void VisualShaderEditor::_connection_to_empty(const String &p_from, int p_from_s
void VisualShaderEditor::_delete_request(int which) {
VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
+ Ref<VisualShaderNode> node = Ref<VisualShaderNode>(visual_shader->get_node(type, which));
undo_redo->create_action(TTR("Delete Node"));
undo_redo->add_do_method(visual_shader.ptr(), "remove_node", type, which);
- undo_redo->add_undo_method(visual_shader.ptr(), "add_node", type, visual_shader->get_node(type, which), visual_shader->get_node_position(type, which), which);
+ undo_redo->add_undo_method(visual_shader.ptr(), "add_node", type, node, visual_shader->get_node_position(type, which), which);
+
+ // restore size, inputs and outputs if node is group
+ VisualShaderNodeGroupBase *group = Object::cast_to<VisualShaderNodeGroupBase>(node.ptr());
+ if (group) {
+ undo_redo->add_undo_method(group, "set_size", group->get_size());
+ undo_redo->add_undo_method(group, "set_inputs", group->get_inputs());
+ undo_redo->add_undo_method(group, "set_outputs", group->get_outputs());
+ }
+
+ // restore expression text if node is expression
+ VisualShaderNodeExpression *expression = Object::cast_to<VisualShaderNodeExpression>(node.ptr());
+ if (expression) {
+ undo_redo->add_undo_method(expression, "set_expression", expression->get_expression());
+ }
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
@@ -1005,6 +1522,19 @@ void VisualShaderEditor::_duplicate_nodes() {
undo_redo->add_do_method(visual_shader.ptr(), "add_node", type, dupli, visual_shader->get_node_position(type, E->get()) + Vector2(10, 10) * EDSCALE, id_from);
undo_redo->add_undo_method(visual_shader.ptr(), "remove_node", type, id_from);
+ // duplicate size, inputs and outputs if node is group
+ Ref<VisualShaderNodeGroupBase> group = Object::cast_to<VisualShaderNodeGroupBase>(node.ptr());
+ if (!group.is_null()) {
+ undo_redo->add_do_method(dupli.ptr(), "set_size", group->get_size());
+ undo_redo->add_do_method(dupli.ptr(), "set_inputs", group->get_inputs());
+ undo_redo->add_do_method(dupli.ptr(), "set_outputs", group->get_outputs());
+ }
+ // duplicate expression text if node is expression
+ Ref<VisualShaderNodeExpression> expression = Object::cast_to<VisualShaderNodeExpression>(node.ptr());
+ if (!expression.is_null()) {
+ undo_redo->add_do_method(dupli.ptr(), "set_expression", expression->get_expression());
+ }
+
id_from++;
}
@@ -1013,7 +1543,7 @@ void VisualShaderEditor::_duplicate_nodes() {
for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
if (connection_remap.has(E->get().from_node) && connection_remap.has(E->get().to_node)) {
- undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, connection_remap[E->get().from_node], E->get().from_port, connection_remap[E->get().to_node], E->get().to_port);
+ undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes_forced", type, connection_remap[E->get().from_node], E->get().from_port, connection_remap[E->get().to_node], E->get().to_port);
}
}
@@ -1056,8 +1586,25 @@ void VisualShaderEditor::_on_nodes_delete() {
undo_redo->create_action(TTR("Delete Nodes"));
for (List<int>::Element *F = to_erase.front(); F; F = F->next()) {
+
+ Ref<VisualShaderNode> node = visual_shader->get_node(type, F->get());
+
undo_redo->add_do_method(visual_shader.ptr(), "remove_node", type, F->get());
- undo_redo->add_undo_method(visual_shader.ptr(), "add_node", type, visual_shader->get_node(type, F->get()), visual_shader->get_node_position(type, F->get()), F->get());
+ undo_redo->add_undo_method(visual_shader.ptr(), "add_node", type, node, visual_shader->get_node_position(type, F->get()), F->get());
+
+ // restore size, inputs and outputs if node is group
+ VisualShaderNodeGroupBase *group = Object::cast_to<VisualShaderNodeGroupBase>(node.ptr());
+ if (group) {
+ undo_redo->add_undo_method(group, "set_size", group->get_size());
+ undo_redo->add_undo_method(group, "set_inputs", group->get_inputs());
+ undo_redo->add_undo_method(group, "set_outputs", group->get_outputs());
+ }
+
+ // restore expression text if node is expression
+ VisualShaderNodeExpression *expression = Object::cast_to<VisualShaderNodeExpression>(node.ptr());
+ if (expression) {
+ undo_redo->add_undo_method(expression, "set_expression", expression->get_expression());
+ }
}
List<VisualShader::Connection> conns;
@@ -1250,8 +1797,10 @@ void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
}
void VisualShaderEditor::_bind_methods() {
-
+ ClassDB::bind_method("_rebuild", &VisualShaderEditor::_rebuild);
ClassDB::bind_method("_update_graph", &VisualShaderEditor::_update_graph);
+ ClassDB::bind_method("_update_options_menu", &VisualShaderEditor::_update_options_menu);
+ ClassDB::bind_method("_expression_focus_out", &VisualShaderEditor::_expression_focus_out);
ClassDB::bind_method("_add_node", &VisualShaderEditor::_add_node);
ClassDB::bind_method("_node_dragged", &VisualShaderEditor::_node_dragged);
ClassDB::bind_method("_connection_request", &VisualShaderEditor::_connection_request);
@@ -1266,11 +1815,22 @@ void VisualShaderEditor::_bind_methods() {
ClassDB::bind_method("_connection_to_empty", &VisualShaderEditor::_connection_to_empty);
ClassDB::bind_method("_line_edit_focus_out", &VisualShaderEditor::_line_edit_focus_out);
ClassDB::bind_method("_line_edit_changed", &VisualShaderEditor::_line_edit_changed);
+ ClassDB::bind_method("_port_name_focus_out", &VisualShaderEditor::_port_name_focus_out);
ClassDB::bind_method("_duplicate_nodes", &VisualShaderEditor::_duplicate_nodes);
ClassDB::bind_method("_mode_selected", &VisualShaderEditor::_mode_selected);
ClassDB::bind_method("_input_select_item", &VisualShaderEditor::_input_select_item);
ClassDB::bind_method("_preview_select_port", &VisualShaderEditor::_preview_select_port);
ClassDB::bind_method("_graph_gui_input", &VisualShaderEditor::_graph_gui_input);
+ ClassDB::bind_method("_add_input_port", &VisualShaderEditor::_add_input_port);
+ ClassDB::bind_method("_change_input_port_type", &VisualShaderEditor::_change_input_port_type);
+ ClassDB::bind_method("_change_input_port_name", &VisualShaderEditor::_change_input_port_name);
+ ClassDB::bind_method("_remove_input_port", &VisualShaderEditor::_remove_input_port);
+ ClassDB::bind_method("_add_output_port", &VisualShaderEditor::_add_output_port);
+ ClassDB::bind_method("_change_output_port_type", &VisualShaderEditor::_change_output_port_type);
+ ClassDB::bind_method("_change_output_port_name", &VisualShaderEditor::_change_output_port_name);
+ ClassDB::bind_method("_remove_output_port", &VisualShaderEditor::_remove_output_port);
+ ClassDB::bind_method("_node_resized", &VisualShaderEditor::_node_resized);
+ ClassDB::bind_method("_set_node_size", &VisualShaderEditor::_set_node_size);
ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &VisualShaderEditor::get_drag_data_fw);
ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &VisualShaderEditor::can_drop_data_fw);
@@ -1294,6 +1854,7 @@ VisualShaderEditor::VisualShaderEditor() {
updating = false;
saved_node_pos_dirty = false;
saved_node_pos = Point2(0, 0);
+ ShaderLanguage::get_keyword_list(&keyword_list);
graph = memnew(GraphEdit);
add_child(graph);
@@ -1434,6 +1995,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("ColorUniform", "Color", "Variables", "VisualShaderNodeColorUniform", TTR("Color uniform."), -1, VisualShaderNode::PORT_TYPE_COLOR));
// BOOLEAN
+
add_options.push_back(AddOption("If", "Conditional", "Functions", "VisualShaderNodeIf", TTR("Returns an associated vector if the provided scalars are equal, greater or less."), -1, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("Switch", "Conditional", "Functions", "VisualShaderNodeSwitch", TTR("Returns an associated vector if the provided boolean value is true or false."), -1, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("BooleanConstant", "Conditional", "Variables", "VisualShaderNodeBooleanConstant", TTR("Boolean constant."), -1, VisualShaderNode::PORT_TYPE_BOOLEAN));
@@ -1441,56 +2003,125 @@ VisualShaderEditor::VisualShaderEditor() {
// INPUT
- add_options.push_back(AddOption("Camera", "Input", "All", "VisualShaderNodeInput", TTR("'camera' input parameter for all shader modes."), "camera", VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("InvCamera", "Input", "All", "VisualShaderNodeInput", TTR("'inv_camera' input parameter for all shader modes."), "inv_camera", VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("InvProjection", "Input", "All", "VisualShaderNodeInput", TTR("'inv_projection' input parameter for all shader modes."), "inv_projection", VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("Normal", "Input", "All", "VisualShaderNodeInput", TTR("'normal' input parameter for all shader modes."), "normal", VisualShaderNode::PORT_TYPE_VECTOR));
- add_options.push_back(AddOption("Projection", "Input", "All", "VisualShaderNodeInput", TTR("'projection' input parameter for all shader modes."), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", TTR("'time' input parameter for all shader modes."), "time", VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("ViewportSize", "Input", "All", "VisualShaderNodeInput", TTR("'viewport_size' input parameter for all shader modes."), "viewport_size", VisualShaderNode::PORT_TYPE_VECTOR));
- add_options.push_back(AddOption("World", "Input", "All", "VisualShaderNodeInput", TTR("'world' input parameter for all shader modes."), "world", VisualShaderNode::PORT_TYPE_TRANSFORM));
+ // SPATIAL-FOR-ALL
+
+ add_options.push_back(AddOption("Camera", "Input", "All", "VisualShaderNodeInput", TTR("'camera' input parameter for all shader modes."), "camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("InvCamera", "Input", "All", "VisualShaderNodeInput", TTR("'inv_camera' input parameter for all shader modes."), "inv_camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("InvProjection", "Input", "All", "VisualShaderNodeInput", TTR("'inv_projection' input parameter for all shader modes."), "inv_projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Normal", "Input", "All", "VisualShaderNodeInput", TTR("'normal' input parameter for all shader modes."), "normal", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Projection", "Input", "All", "VisualShaderNodeInput", TTR("'projection' input parameter for all shader modes."), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", TTR("'time' input parameter for all shader modes."), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("ViewportSize", "Input", "All", "VisualShaderNodeInput", TTR("'viewport_size' input parameter for all shader modes."), "viewport_size", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("World", "Input", "All", "VisualShaderNodeInput", TTR("'world' input parameter for all shader modes."), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+
+ // CANVASITEM-FOR-ALL
+
+ add_options.push_back(AddOption("Alpha", "Input", "All", "VisualShaderNodeInput", TTR("'alpha' input parameter for all shader modes."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Color", "Input", "All", "VisualShaderNodeInput", TTR("'color' input parameter for all shader modes."), "color", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("TexturePixelSize", "Input", "All", "VisualShaderNodeInput", TTR("'texture_pixel_size' input parameter for all shader modes."), "texture_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", TTR("'time' input parameter for all shader modes."), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("UV", "Input", "All", "VisualShaderNodeInput", TTR("'uv' input parameter for all shader modes."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
+
+ /////////////////
add_options.push_back(AddOption("Input", "Input", "Common", "VisualShaderNodeInput", TTR("Input parameter.")));
- add_options.push_back(AddOption("Alpha", "Input", "Fragment", "VisualShaderNodeInput", TTR("'alpha' input parameter for fragment shader mode."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("Binormal", "Input", "Fragment", "VisualShaderNodeInput", TTR("'binormal' input parameter for fragment shader mode."), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("Color", "Input", "Fragment", "VisualShaderNodeInput", TTR("'color' input parameter for fragment shader mode."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment shader mode."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment shader mode."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment shader mode."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("Side", "Input", "Fragment", "VisualShaderNodeInput", TTR("'side' input parameter for fragment shader mode."), "side", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("Tangent", "Input", "Fragment", "VisualShaderNodeInput", TTR("'tangent' input parameter for fragment shader mode."), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("UV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'uv' input parameter for fragment shader mode."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("UV2", "Input", "Fragment", "VisualShaderNodeInput", TTR("'uv2' input parameter for fragment shader mode."), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("Vertex", "Input", "Fragment", "VisualShaderNodeInput", TTR("'vertex' input parameter for fragment shader mode."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
- add_options.push_back(AddOption("View", "Input", "Fragment", "VisualShaderNodeInput", TTR("'view' input parameter for fragment shader mode."), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT));
-
- add_options.push_back(AddOption("Albedo", "Input", "Light", "VisualShaderNodeInput", TTR("'albedo' input parameter for light shader mode."), "albedo", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("Attenuation", "Input", "Light", "VisualShaderNodeInput", TTR("'attenuation' input parameter for light shader mode."), "attenuation", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("Diffuse", "Input", "Light", "VisualShaderNodeInput", TTR("'diffuse' input parameter for light shader mode."), "diffuse", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for light shader mode."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("Light", "Input", "Light", "VisualShaderNodeInput", TTR("'light' input parameter for light shader mode."), "light", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", TTR("'light_color' input parameter for light shader mode."), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("Roughness", "Input", "Light", "VisualShaderNodeInput", TTR("'roughness' input parameter for light shader mode."), "roughness", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("Specular", "Input", "Light", "VisualShaderNodeInput", TTR("'specular' input parameter for light shader mode."), "specular", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("Transmission", "Input", "Light", "VisualShaderNodeInput", TTR("'transmission' input parameter for light shader mode."), "transmission", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
- add_options.push_back(AddOption("View", "Input", "Light", "VisualShaderNodeInput", TTR("'view' input parameter for light shader mode."), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT));
-
- add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex shader mode."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("Binormal", "Input", "Vertex", "VisualShaderNodeInput", TTR("'binormal' input parameter for vertex shader mode."), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", TTR("'color' input parameter for vertex shader mode."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("ModelView", "Input", "Vertex", "VisualShaderNodeInput", TTR("'modelview' input parameter for vertex shader mode."), "modelview", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", TTR("'point_size' input parameter for vertex shader mode."), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("Tangent", "Input", "Vertex", "VisualShaderNodeInput", TTR("'tangent' input parameter for vertex shader mode."), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("UV", "Input", "Vertex", "VisualShaderNodeInput", TTR("'uv' input parameter for vertex shader mode."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("UV2", "Input", "Vertex", "VisualShaderNodeInput", TTR("'uv2' input parameter for vertex shader mode."), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX));
- add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex shader mode."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX));
+ // SPATIAL INPUTS
+
+ add_options.push_back(AddOption("Alpha", "Input", "Fragment", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex and fragment shader modes."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Binormal", "Input", "Fragment", "VisualShaderNodeInput", TTR("'binormal' input parameter for vertex and fragment shader modes."), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Color", "Input", "Fragment", "VisualShaderNodeInput", TTR("'color' input parameter for vertex and fragment shader modes."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment shader mode."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment shader mode."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Side", "Input", "Fragment", "VisualShaderNodeInput", TTR("'side' input parameter for fragment shader mode."), "side", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Tangent", "Input", "Fragment", "VisualShaderNodeInput", TTR("'tangent' input parameter for vertex and fragment shader modes."), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'uv' input parameter for vertex and fragment shader modes."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV2", "Input", "Fragment", "VisualShaderNodeInput", TTR("'uv2' input parameter for vertex and fragment shader modes."), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Vertex", "Input", "Fragment", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex and fragment shader modes."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("View", "Input", "Fragment", "VisualShaderNodeInput", TTR("'view' input parameter for fragment and light shader modes."), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+
+ add_options.push_back(AddOption("Albedo", "Input", "Light", "VisualShaderNodeInput", TTR("'albedo' input parameter for light shader mode."), "albedo", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Attenuation", "Input", "Light", "VisualShaderNodeInput", TTR("'attenuation' input parameter for light shader mode."), "attenuation", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Diffuse", "Input", "Light", "VisualShaderNodeInput", TTR("'diffuse' input parameter for light shader mode."), "diffuse", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Light", "Input", "Light", "VisualShaderNodeInput", TTR("'light' input parameter for light shader mode."), "light", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", TTR("'light_color' input parameter for light shader mode."), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Roughness", "Input", "Light", "VisualShaderNodeInput", TTR("'roughness' input parameter for light shader mode."), "roughness", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Specular", "Input", "Light", "VisualShaderNodeInput", TTR("'specular' input parameter for light shader mode."), "specular", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Transmission", "Input", "Light", "VisualShaderNodeInput", TTR("'transmission' input parameter for light shader mode."), "transmission", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("View", "Input", "Light", "VisualShaderNodeInput", TTR("'view' input parameter for fragment and light shader modes."), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+
+ add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex and fragment shader modes."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Binormal", "Input", "Vertex", "VisualShaderNodeInput", TTR("'binormal' input parameter for vertex and fragment shader modes."), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", TTR("'color' input parameter for vertex and fragment shader modes."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("ModelView", "Input", "Vertex", "VisualShaderNodeInput", TTR("'modelview' input parameter for vertex shader mode."), "modelview", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", TTR("'point_size' input parameter for vertex shader mode."), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Tangent", "Input", "Vertex", "VisualShaderNodeInput", TTR("'tangent' input parameter for vertex and fragment shader mode."), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV", "Input", "Vertex", "VisualShaderNodeInput", TTR("'uv' input parameter for vertex and fragment shader modes."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV2", "Input", "Vertex", "VisualShaderNodeInput", TTR("'uv2' input parameter for vertex and fragment shader modes."), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex and fragment shader modes."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+
+ // CANVASITEM INPUTS
+
+ add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightPass", "Input", "Fragment", "VisualShaderNodeInput", TTR("'light_pass' input parameter for vertex and fragment shader modes."), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment and light shader modes."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ScreenPixelSize", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_pixel_size' input parameter for fragment shader mode."), "screen_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment and light shader modes."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+
+ add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightAlpha", "Input", "Light", "VisualShaderNodeInput", TTR("'light_alpha' input parameter for light shader mode."), "light_alpha", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", TTR("'light_color' input parameter for light shader mode."), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightHeight", "Input", "Light", "VisualShaderNodeInput", TTR("'light_height' input parameter for light shader mode."), "light_height", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightUV", "Input", "Light", "VisualShaderNodeInput", TTR("'light_uv' input parameter for light shader mode."), "light_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightVector", "Input", "Light", "VisualShaderNodeInput", TTR("'light_vec' input parameter for light shader mode."), "light_vec", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Normal", "Input", "Light", "VisualShaderNodeInput", TTR("'normal' input parameter for light shader mode."), "normal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("PointCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment and light shader modes."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Light", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment and light shader modes."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ShadowColor", "Input", "Light", "VisualShaderNodeInput", TTR("'shadow_color' input parameter for light shader mode."), "shadow_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+
+ add_options.push_back(AddOption("Extra", "Input", "Vertex", "VisualShaderNodeInput", TTR("'extra' input parameter for vertex shader mode."), "extra", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightPass", "Input", "Vertex", "VisualShaderNodeInput", TTR("'light_pass' input parameter for vertex and fragment shader modes."), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", TTR("'point_size' input parameter for vertex shader mode."), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Projection", "Input", "Vertex", "VisualShaderNodeInput", TTR("'projection' input parameter for vertex shader mode."), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex shader mode."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("World", "Input", "Vertex", "VisualShaderNodeInput", TTR("'world' input parameter for vertex shader mode."), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+
+ // PARTICLES INPUTS
+
+ add_options.push_back(AddOption("Active", "Input", "Vertex", "VisualShaderNodeInput", TTR("'active' input parameter for vertex shader mode."), "active", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex shader mode."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", TTR("'color' input parameter for vertex shader mode."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Custom", "Input", "Vertex", "VisualShaderNodeInput", TTR("'custom' input parameter for vertex shader mode."), "custom", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("CustomAlpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'custom_alpha' input parameter for vertex shader mode."), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Delta", "Input", "Vertex", "VisualShaderNodeInput", TTR("'delta' input parameter for vertex shader mode."), "delta", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("EmissionTransform", "Input", "Vertex", "VisualShaderNodeInput", TTR("'emission_transform' input parameter for vertex shader mode."), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Index", "Input", "Vertex", "VisualShaderNodeInput", TTR("'index' input parameter for vertex shader mode."), "index", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("LifeTime", "Input", "Vertex", "VisualShaderNodeInput", TTR("'lifetime' input parameter for vertex shader mode."), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Restart", "Input", "Vertex", "VisualShaderNodeInput", TTR("'restart' input parameter for vertex shader mode."), "restart", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Time", "Input", "Vertex", "VisualShaderNodeInput", TTR("'time' input parameter for vertex shader mode."), "time", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Transform", "Input", "Vertex", "VisualShaderNodeInput", TTR("'transform' input parameter for vertex shader mode."), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Velocity", "Input", "Vertex", "VisualShaderNodeInput", TTR("'velocity' input parameter for vertex shader mode."), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
// SCALAR
add_options.push_back(AddOption("ScalarFunc", "Scalar", "Common", "VisualShaderNodeScalarFunc", TTR("Scalar function."), -1, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("ScalarOp", "Scalar", "Common", "VisualShaderNodeScalarOp", TTR("Scalar operator."), -1, VisualShaderNode::PORT_TYPE_SCALAR));
+ //CONSTANTS
+
+ add_options.push_back(AddOption("E", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("E constant (2.718282). Represents the base of the natural logarithm."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, Math_E));
+ add_options.push_back(AddOption("Epsilon", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Epsilon constant (0.00001). Smallest possible scalar number."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, CMP_EPSILON));
+ add_options.push_back(AddOption("Phi", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Phi constant (1.618034). Golden ratio."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, 1.618034f));
+ add_options.push_back(AddOption("Pi/4", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Pi/4 constant (0.785398) or 45 degrees."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, Math_PI / 4));
+ add_options.push_back(AddOption("Pi/2", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Pi/2 constant (1.570796) or 90 degrees."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, Math_PI / 2));
+ add_options.push_back(AddOption("Pi", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Pi constant (3.141593) or 180 degrees."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, Math_PI));
+ add_options.push_back(AddOption("Tau", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Tau constant (6.283185) or 360 degrees."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, Math_TAU));
+ add_options.push_back(AddOption("Sqrt2", "Scalar", "Constants", "VisualShaderNodeScalarConstant", TTR("Sqrt2 constant (1.414214). Square root of 2."), -1, VisualShaderNode::PORT_TYPE_SCALAR, -1, -1, Math_SQRT2));
+
+ // FUNCTIONS
+
add_options.push_back(AddOption("Abs", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("Returns the absolute value of the parameter."), VisualShaderNodeScalarFunc::FUNC_ABS, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("ACos", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("Returns the arc-cosine of the parameter."), VisualShaderNodeScalarFunc::FUNC_ACOS, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("ACosH", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("(GLES3 only) Returns the inverse hyperbolic cosine of the parameter."), VisualShaderNodeScalarFunc::FUNC_ACOSH, VisualShaderNode::PORT_TYPE_SCALAR));
@@ -1515,6 +2146,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Min", "Scalar", "Functions", "VisualShaderNodeScalarOp", TTR("Returns the lesser of two values."), VisualShaderNodeScalarOp::OP_MIN, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Mix", "Scalar", "Functions", "VisualShaderNodeScalarInterp", TTR("Linear interpolation between two scalars."), -1, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Negate", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("Returns the opposite value of the parameter."), VisualShaderNodeScalarFunc::FUNC_NEGATE, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("OneMinus", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("1.0 - scalar"), VisualShaderNodeScalarFunc::FUNC_ONEMINUS, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Pow", "Scalar", "Functions", "VisualShaderNodeScalarOp", TTR("Returns the value of the first parameter raised to the power of the second."), VisualShaderNodeScalarOp::OP_POW, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Radians", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("Converts a quantity in degrees to radians."), VisualShaderNodeScalarFunc::FUNC_RADIANS, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Reciprocal", "Scalar", "Functions", "VisualShaderNodeScalarFunc", TTR("1.0 / scalar"), VisualShaderNodeScalarFunc::FUNC_RECIPROCAL, VisualShaderNode::PORT_TYPE_SCALAR));
@@ -1604,6 +2236,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Mix", "Vector", "Functions", "VisualShaderNodeVectorInterp", TTR("Linear interpolation between two vectors."), -1, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("Negate", "Vector", "Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("Normalize", "Vector", "Functions", "VisualShaderNodeVectorFunc", TTR("Calculates the normalize product of vector."), VisualShaderNodeVectorFunc::FUNC_NORMALIZE, VisualShaderNode::PORT_TYPE_VECTOR));
+ add_options.push_back(AddOption("OneMinus", "Vector", "Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("Pow", "Vector", "Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), VisualShaderNodeVectorOp::OP_POW, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("Radians", "Vector", "Functions", "VisualShaderNodeVectorFunc", TTR("Converts a quantity in degrees to radians."), VisualShaderNodeVectorFunc::FUNC_RADIANS, VisualShaderNode::PORT_TYPE_VECTOR));
add_options.push_back(AddOption("Reciprocal", "Vector", "Functions", "VisualShaderNodeVectorFunc", TTR("1.0 / vector"), VisualShaderNodeVectorFunc::FUNC_RECIPROCAL, VisualShaderNode::PORT_TYPE_VECTOR));
@@ -1635,6 +2268,9 @@ VisualShaderEditor::VisualShaderEditor() {
// SPECIAL
+ add_options.push_back(AddOption("Expression", "Special", "", "VisualShaderNodeExpression", TTR("Custom Godot Shader Language expression, with custom amount of input and output ports. This is a direct injection of code into the vertex/fragment/light function, do not use it to write the function declarations inside.")));
+ add_options.push_back(AddOption("Fresnel", "Special", "", "VisualShaderNodeFresnel", TTR("Returns falloff based on the dot product of surface normal and view direction of camera (pass associated inputs to it)."), -1, VisualShaderNode::PORT_TYPE_SCALAR));
+
add_options.push_back(AddOption("ScalarDerivativeFunc", "Special", "Common", "VisualShaderNodeScalarDerivativeFunc", TTR("(GLES3 only) (Fragment/Light mode only) Scalar derivative function."), -1, VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT | VisualShader::TYPE_LIGHT));
add_options.push_back(AddOption("VectorDerivativeFunc", "Special", "Common", "VisualShaderNodeVectorDerivativeFunc", TTR("(GLES3 only) (Fragment/Light mode only) Vector derivative function."), -1, VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT | VisualShader::TYPE_LIGHT));
@@ -1933,6 +2569,9 @@ void EditorPropertyShaderMode::_option_selected(int p_which) {
}
}
+ undo_redo->add_do_method(VisualShaderEditor::get_singleton(), "_update_options_menu");
+ undo_redo->add_undo_method(VisualShaderEditor::get_singleton(), "_update_options_menu");
+
//update graph
undo_redo->add_do_method(VisualShaderEditor::get_singleton(), "_update_graph");
undo_redo->add_undo_method(VisualShaderEditor::get_singleton(), "_update_graph");
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 35041da2bd..1b009b61d5 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -100,8 +100,10 @@ class VisualShaderEditor : public VBoxContainer {
Ref<Script> script;
int mode;
int return_type;
+ int func;
+ float value;
- AddOption(const String &p_name = String(), const String &p_category = String(), const String &p_sub_category = String(), const String &p_type = String(), const String &p_description = String(), int p_sub_func = -1, int p_return_type = -1, int p_mode = -1) {
+ AddOption(const String &p_name = String(), const String &p_category = String(), const String &p_sub_category = String(), const String &p_type = String(), const String &p_description = String(), int p_sub_func = -1, int p_return_type = -1, int p_mode = -1, int p_func = -1, float p_value = -1) {
name = p_name;
type = p_type;
category = p_category;
@@ -110,9 +112,11 @@ class VisualShaderEditor : public VBoxContainer {
sub_func = p_sub_func;
return_type = p_return_type;
mode = p_mode;
+ func = p_func;
+ value = p_value;
}
- AddOption(const String &p_name, const String &p_category, const String &p_sub_category, const String &p_type, const String &p_description, const String &p_sub_func, int p_return_type = -1, int p_mode = -1) {
+ AddOption(const String &p_name, const String &p_category, const String &p_sub_category, const String &p_type, const String &p_description, const String &p_sub_func, int p_return_type = -1, int p_mode = -1, int p_func = -1, float p_value = -1) {
name = p_name;
type = p_type;
category = p_category;
@@ -121,10 +125,13 @@ class VisualShaderEditor : public VBoxContainer {
sub_func_str = p_sub_func;
return_type = p_return_type;
mode = p_mode;
+ func = p_func;
+ value = p_value;
}
};
Vector<AddOption> add_options;
+ List<String> keyword_list;
void _draw_color_over_button(Object *obj, Color p_color);
@@ -157,14 +164,32 @@ class VisualShaderEditor : public VBoxContainer {
void _line_edit_changed(const String &p_text, Object *line_edit, int p_node_id);
void _line_edit_focus_out(Object *line_edit, int p_node_id);
+ void _port_name_focus_out(Object *line_edit, int p_node_id, int p_port_id, bool p_output);
+
void _duplicate_nodes();
Vector<Ref<VisualShaderNodePlugin> > plugins;
void _mode_selected(int p_id);
+ void _rebuild();
void _input_select_item(Ref<VisualShaderNodeInput> input, String name);
+ void _add_input_port(int p_node, int p_port, int p_type, const String &p_name);
+ void _remove_input_port(int p_node, int p_port);
+ void _change_input_port_type(int p_type, int p_node, int p_port);
+ void _change_input_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
+
+ void _add_output_port(int p_node, int p_port, int p_type, const String &p_name);
+ void _remove_output_port(int p_node, int p_port);
+ void _change_output_port_type(int p_type, int p_node, int p_port);
+ void _change_output_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
+
+ void _expression_focus_out(Object *text_edit, int p_node);
+
+ void _set_node_size(int p_type, int p_node, const Size2 &p_size);
+ void _node_resized(const Vector2 &p_new_size, int p_type, int p_node);
+
void _preview_select_port(int p_node, int p_port);
void _graph_gui_input(const Ref<InputEvent> p_event);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index d56d4e6cf1..ee78b240a4 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -564,9 +564,8 @@ void ProjectExportDialog::_duplicate_preset() {
Ref<EditorExportPreset> preset = current->get_platform()->create_preset();
ERR_FAIL_COND(!preset.is_valid());
- String name = current->get_name() + "" + itos(1);
+ String name = current->get_name() + " (copy)";
bool make_runnable = true;
- int attempt = 2;
while (true) {
bool valid = true;
@@ -585,8 +584,7 @@ void ProjectExportDialog::_duplicate_preset() {
if (valid)
break;
- attempt++;
- name = current->get_name() + " " + itos(attempt);
+ name += " (copy)";
}
preset->set_name(name);
@@ -965,7 +963,7 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
current->set_export_path(p_path);
Error err = platform->export_project(current, export_debug->is_pressed(), p_path, 0);
- if (err != OK) {
+ if (err != OK && err != ERR_SKIP) {
if (err == ERR_FILE_NOT_FOUND) {
error_dialog->set_text(vformat(TTR("Failed to export the project for platform '%s'.\nExport templates seem to be missing or invalid."), platform->get_name()));
} else { // Assume misconfiguration. FIXME: Improve error handling and preset config validation.
@@ -994,7 +992,7 @@ void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
void ProjectExportDialog::_export_all(bool p_debug) {
String mode = p_debug ? TTR("Debug") : TTR("Release");
- EditorProgress ep("exportall", TTR("Exporting All") + " " + mode, EditorExport::get_singleton()->get_export_preset_count());
+ EditorProgress ep("exportall", TTR("Exporting All") + " " + mode, EditorExport::get_singleton()->get_export_preset_count(), true);
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
@@ -1005,7 +1003,7 @@ void ProjectExportDialog::_export_all(bool p_debug) {
ep.step(preset->get_name(), i);
Error err = platform->export_project(preset, p_debug, preset->get_export_path(), 0);
- if (err != OK) {
+ if (err != OK && err != ERR_SKIP) {
if (err == ERR_FILE_BAD_PATH) {
error_dialog->set_text(TTR("The given export path doesn't exist:") + "\n" + preset->get_export_path().get_base_dir());
} else {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 095ec891cd..b0baf954d2 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -765,7 +765,7 @@ public:
set_title(TTR("Install Project:") + " " + zip_title);
get_ok()->set_text(TTR("Install & Edit"));
- name_container->hide();
+ name_container->show();
install_path_container->hide();
rasterizer_container->hide();
project_path->grab_focus();
@@ -798,7 +798,7 @@ public:
create_dir = memnew(Button);
pnhb->add_child(create_dir);
- create_dir->set_text(TTR("Create folder"));
+ create_dir->set_text(TTR("Create Folder"));
create_dir->connect("pressed", this, "_create_folder");
path_container = memnew(VBoxContainer);
@@ -987,6 +987,24 @@ void ProjectManager::_update_project_buttons() {
open_btn->set_disabled(empty_selection);
rename_btn->set_disabled(empty_selection);
run_btn->set_disabled(empty_selection);
+
+ bool missing_projects = false;
+ Map<String, String> list_all_projects;
+ for (int i = 0; i < scroll_children->get_child_count(); i++) {
+ HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_children->get_child(i));
+ if (hb) {
+ list_all_projects.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
+ }
+ }
+ for (Map<String, String>::Element *E = list_all_projects.front(); E; E = E->next()) {
+ String project_name = E->key().replace(":::", ":/").replace("::", "/") + "/project.godot";
+ if (!FileAccess::exists(project_name)) {
+ missing_projects = true;
+ break;
+ }
+ }
+
+ erase_missing_btn->set_visible(missing_projects);
}
void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
@@ -1530,13 +1548,13 @@ void ProjectManager::_open_selected_projects_ask() {
// Check if the config_version property was empty or 0
if (config_version == 0) {
- ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You will not be able to open the project with previous versions of the engine anymore."), conf));
+ ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf));
ask_update_settings->popup_centered_minsize();
return;
}
// Check if we need to convert project settings from an earlier engine version
if (config_version < ProjectSettings::CONFIG_VERSION) {
- ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You will not be able to open the project with previous versions of the engine anymore."), conf));
+ ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf));
ask_update_settings->popup_centered_minsize();
return;
}
@@ -1557,7 +1575,7 @@ void ProjectManager::_run_project_confirm() {
const String &selected_main = E->get();
if (selected_main == "") {
- run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in \"Project Settings\" under the \"Application\" category."));
+ run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in the Project Settings under the \"Application\" category."));
run_error_diag->popup_centered();
return;
}
@@ -1597,7 +1615,7 @@ void ProjectManager::_run_project() {
}
if (selected_list.size() > 1) {
- multi_run_ask->set_text(TTR("Are you sure to run more than one project?"));
+ multi_run_ask->set_text(vformat(TTR("Are you sure to run %d projects at once?"), selected_list.size()));
multi_run_ask->popup_centered_minsize();
} else {
_run_project_confirm();
@@ -1609,40 +1627,28 @@ void ProjectManager::_show_project(const String &p_path) {
OS::get_singleton()->shell_open(String("file://") + p_path);
}
-void ProjectManager::_scan_dir(DirAccess *da, float pos, float total, List<String> *r_projects) {
-
- List<String> subdirs;
+void ProjectManager::_scan_dir(const String &path, List<String> *r_projects) {
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ da->change_dir(path);
da->list_dir_begin();
String n = da->get_next();
while (n != String()) {
if (da->current_is_dir() && !n.begins_with(".")) {
- subdirs.push_front(n);
+ _scan_dir(da->get_current_dir().plus_file(n), r_projects);
} else if (n == "project.godot") {
r_projects->push_back(da->get_current_dir());
}
n = da->get_next();
}
da->list_dir_end();
- int m = 0;
- for (List<String>::Element *E = subdirs.front(); E; E = E->next()) {
-
- da->change_dir(E->get());
-
- float slice = total / subdirs.size();
- _scan_dir(da, pos + slice * m, slice, r_projects);
- da->change_dir("..");
- m++;
- }
+ memdelete(da);
}
void ProjectManager::_scan_begin(const String &p_base) {
print_line("Scanning projects at: " + p_base);
List<String> projects;
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->change_dir(p_base);
- _scan_dir(da, 0, 1, &projects);
- memdelete(da);
+ _scan_dir(p_base, &projects);
print_line("Found " + itos(projects.size()) + " projects.");
for (List<String>::Element *E = projects.front(); E; E = E->next()) {
@@ -1700,15 +1706,61 @@ void ProjectManager::_erase_project_confirm() {
_load_recent_projects();
}
+void ProjectManager::_erase_missing_projects_confirm() {
+
+ Map<String, String> list_all_projects;
+ for (int i = 0; i < scroll_children->get_child_count(); i++) {
+ HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_children->get_child(i));
+ if (hb) {
+ list_all_projects.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
+ }
+ }
+
+ if (list_all_projects.size() == 0) {
+ return;
+ }
+
+ int deleted_projects = 0;
+ int remaining_projects = 0;
+ for (Map<String, String>::Element *E = list_all_projects.front(); E; E = E->next()) {
+ String project_name = E->key().replace(":::", ":/").replace("::", "/") + "/project.godot";
+ if (!FileAccess::exists(project_name)) {
+ deleted_projects++;
+ EditorSettings::get_singleton()->erase("projects/" + E->key());
+ EditorSettings::get_singleton()->erase("favorite_projects/" + E->key());
+ } else {
+ remaining_projects++;
+ }
+ }
+ print_line("Deleted " + itos(deleted_projects) + " projects, remaining " + itos(remaining_projects) + " projects");
+ EditorSettings::get_singleton()->save();
+ selected_list.clear();
+ last_clicked = "";
+ _load_recent_projects();
+}
+
void ProjectManager::_erase_project() {
if (selected_list.size() == 0)
return;
- erase_ask->set_text(TTR("Remove project from the list? (Folder contents will not be modified)"));
+ String confirm_message;
+ if (selected_list.size() >= 2) {
+ confirm_message = vformat(TTR("Remove %d projects from the list?\nThe project folders' contents won't be modified."), selected_list.size());
+ } else {
+ confirm_message = TTR("Remove this project from the list?\nThe project folder's contents won't be modified.");
+ }
+
+ erase_ask->set_text(confirm_message);
erase_ask->popup_centered_minsize();
}
+void ProjectManager::_erase_missing_projects() {
+
+ erase_missing_ask->set_text(TTR("Remove all missing projects from the list? (Folders contents will not be modified)"));
+ erase_missing_ask->popup_centered_minsize();
+}
+
void ProjectManager::_language_selected(int p_id) {
String lang = language_btn->get_item_metadata(p_id);
@@ -1716,7 +1768,7 @@ void ProjectManager::_language_selected(int p_id) {
language_btn->set_text(lang);
language_btn->set_icon(get_icon("Environment", "EditorIcons"));
- language_restart_ask->set_text(TTR("Language changed.\nThe UI will update next time the editor or project manager starts."));
+ language_restart_ask->set_text(TTR("Language changed.\nThe interface will update after restarting the editor or project manager."));
language_restart_ask->popup_centered();
}
@@ -1777,7 +1829,8 @@ void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) {
if (confirm) {
multi_scan_ask->get_ok()->disconnect("pressed", this, "_scan_multiple_folders");
multi_scan_ask->get_ok()->connect("pressed", this, "_scan_multiple_folders", varray(folders));
- multi_scan_ask->set_text(vformat(TTR("You are about the scan %s folders for existing Godot projects. Do you confirm?"), folders.size()));
+ multi_scan_ask->set_text(
+ vformat(TTR("Are you sure to scan %s folders for existing Godot projects?\nThis could take a while."), folders.size()));
multi_scan_ask->popup_centered_minsize();
} else {
_scan_multiple_folders(folders);
@@ -1804,7 +1857,9 @@ void ProjectManager::_bind_methods() {
ClassDB::bind_method("_new_project", &ProjectManager::_new_project);
ClassDB::bind_method("_rename_project", &ProjectManager::_rename_project);
ClassDB::bind_method("_erase_project", &ProjectManager::_erase_project);
+ ClassDB::bind_method("_erase_missing_projects", &ProjectManager::_erase_missing_projects);
ClassDB::bind_method("_erase_project_confirm", &ProjectManager::_erase_project_confirm);
+ ClassDB::bind_method("_erase_missing_projects_confirm", &ProjectManager::_erase_missing_projects_confirm);
ClassDB::bind_method("_language_selected", &ProjectManager::_language_selected);
ClassDB::bind_method("_restart_confirm", &ProjectManager::_restart_confirm);
ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog);
@@ -2042,6 +2097,12 @@ ProjectManager::ProjectManager() {
erase->connect("pressed", this, "_erase_project");
erase_btn = erase;
+ Button *erase_missing = memnew(Button);
+ erase_missing->set_text(TTR("Remove Missing"));
+ tree_vb->add_child(erase_missing);
+ erase_missing->connect("pressed", this, "_erase_missing_projects");
+ erase_missing_btn = erase_missing;
+
tree_vb->add_spacer();
if (StreamPeerSSL::is_available()) {
@@ -2093,6 +2154,19 @@ ProjectManager::ProjectManager() {
Button *cancel = memnew(Button);
cancel->set_text(TTR("Exit"));
cancel->set_custom_minimum_size(Size2(100, 1) * EDSCALE);
+
+#ifndef OSX_ENABLED
+ // Pressing Command + Q quits the Project Manager
+ // This is handled by the platform implementation on macOS,
+ // so only define the shortcut on other platforms
+ InputEventKey *quit_key = memnew(InputEventKey);
+ quit_key->set_command(true);
+ quit_key->set_scancode(KEY_Q);
+ ShortCut *quit_shortcut = memnew(ShortCut);
+ quit_shortcut->set_shortcut(quit_key);
+ cancel->set_shortcut(quit_shortcut);
+#endif
+
cc->add_child(cancel);
cancel->connect("pressed", this, "_exit_dialog");
vb->add_child(cc);
@@ -2105,6 +2179,11 @@ ProjectManager::ProjectManager() {
language_restart_ask->get_cancel()->set_text(TTR("Continue"));
gui_base->add_child(language_restart_ask);
+ erase_missing_ask = memnew(ConfirmationDialog);
+ erase_missing_ask->get_ok()->set_text(TTR("Remove All"));
+ erase_missing_ask->get_ok()->connect("pressed", this, "_erase_missing_projects_confirm");
+ gui_base->add_child(erase_missing_ask);
+
erase_ask = memnew(ConfirmationDialog);
erase_ask->get_ok()->set_text(TTR("Remove"));
erase_ask->get_ok()->connect("pressed", this, "_erase_project_confirm");
@@ -2153,7 +2232,7 @@ ProjectManager::ProjectManager() {
gui_base->add_child(dialog_error);
open_templates = memnew(ConfirmationDialog);
- open_templates->set_text(TTR("You don't currently have any projects.\nWould you like to explore the official example projects in the Asset Library?"));
+ open_templates->set_text(TTR("You currently don't have any projects.\nWould you like to explore official example projects in the Asset Library?"));
open_templates->get_ok()->set_text(TTR("Open Asset Library"));
open_templates->connect("confirmed", this, "_open_asset_library");
add_child(open_templates);
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 1fdd7dbe06..fa878e75a6 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -45,6 +45,7 @@ class ProjectManager : public Control {
GDCLASS(ProjectManager, Control);
Button *erase_btn;
+ Button *erase_missing_btn;
Button *open_btn;
Button *rename_btn;
Button *run_btn;
@@ -57,6 +58,7 @@ class ProjectManager : public Control {
FileDialog *scan_dir;
ConfirmationDialog *language_restart_ask;
ConfirmationDialog *erase_ask;
+ ConfirmationDialog *erase_missing_ask;
ConfirmationDialog *multi_open_ask;
ConfirmationDialog *multi_run_ask;
ConfirmationDialog *multi_scan_ask;
@@ -89,7 +91,9 @@ class ProjectManager : public Control {
void _new_project();
void _rename_project();
void _erase_project();
+ void _erase_missing_projects();
void _erase_project_confirm();
+ void _erase_missing_projects_confirm();
void _update_project_buttons();
void _language_selected(int p_id);
void _restart_confirm();
@@ -102,7 +106,7 @@ class ProjectManager : public Control {
void _on_project_created(const String &dir);
void _on_projects_updated();
void _update_scroll_position(const String &dir);
- void _scan_dir(DirAccess *da, float pos, float total, List<String> *r_projects);
+ void _scan_dir(const String &path, List<String> *r_projects);
void _install_project(const String &p_zip_path, const String &p_title);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 0dd9807fbf..872f8fcd2c 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -181,7 +181,7 @@ void ProjectSettingsEditor::_action_edited() {
ti->set_text(0, old_name);
add_at = "input/" + old_name;
- message->set_text(vformat(TTR("Action '%s' already exists!"), new_name));
+ message->set_text(vformat(TTR("An action with the name '%s' already exists."), new_name));
message->popup_centered(Size2(300, 100) * EDSCALE);
return;
}
@@ -921,7 +921,7 @@ void ProjectSettingsEditor::_action_check(String p_action) {
}
if (ProjectSettings::get_singleton()->has_setting("input/" + p_action)) {
- action_add_error->set_text(TTR("Already existing"));
+ action_add_error->set_text(vformat(TTR("An action with the name '%s' already exists."), p_action));
action_add_error->show();
action_add->set_disabled(true);
return;
@@ -1586,6 +1586,7 @@ void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) {
search_box->select_all();
} else {
+ search_box->clear();
search_bar->hide();
add_prop_bar->show();
}
@@ -1779,7 +1780,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
restart_hb->add_child(restart_icon);
restart_label = memnew(Label);
- restart_label->set_text(TTR("Editor must be restarted for changes to take effect"));
+ restart_label->set_text(TTR("The editor must be restarted for changes to take effect."));
restart_hb->add_child(restart_label);
restart_hb->add_spacer();
Button *restart_button = memnew(Button);
@@ -1997,8 +1998,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tvb->add_child(tmc);
translation_locale_filter_mode = memnew(OptionButton);
- translation_locale_filter_mode->add_item(TTR("Show all locales"), SHOW_ALL_LOCALES);
- translation_locale_filter_mode->add_item(TTR("Show only selected locales"), SHOW_ONLY_SELECTED_LOCALES);
+ translation_locale_filter_mode->add_item(TTR("Show All Locales"), SHOW_ALL_LOCALES);
+ translation_locale_filter_mode->add_item(TTR("Show Selected Locales Only"), SHOW_ONLY_SELECTED_LOCALES);
translation_locale_filter_mode->select(0);
tmc->add_margin_child(TTR("Filter mode:"), translation_locale_filter_mode);
translation_locale_filter_mode->connect("item_selected", this, "_translation_filter_mode_changed");
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index c197248c35..dc2f098333 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -255,14 +255,19 @@ void EditorQuickOpen::_confirmed() {
void EditorQuickOpen::_notification(int p_what) {
- if (p_what == NOTIFICATION_ENTER_TREE) {
+ switch (p_what) {
- connect("confirmed", this, "_confirmed");
+ case NOTIFICATION_ENTER_TREE: {
- search_box->set_right_icon(get_icon("Search", "EditorIcons"));
- search_box->set_clear_button_enabled(true);
- } else if (p_what == NOTIFICATION_EXIT_TREE) {
- disconnect("confirmed", this, "_confirmed");
+ connect("confirmed", this, "_confirmed");
+
+ search_box->set_right_icon(get_icon("Search", "EditorIcons"));
+ search_box->set_clear_button_enabled(true);
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+
+ disconnect("confirmed", this, "_confirmed");
+ } break;
}
}
@@ -297,6 +302,7 @@ EditorQuickOpen::EditorQuickOpen() {
set_hide_on_ok(false);
search_options->connect("item_activated", this, "_confirmed");
search_options->set_hide_root(true);
+ search_options->add_constant_override("draw_guides", 1);
ei = "EditorIcons";
ot = "Object";
add_directories = false;
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index ed1eec95dc..858b14a733 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -113,7 +113,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
collapse_theme->set_icon("unchecked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
CheckBox *chk_collapse_features = memnew(CheckBox);
- chk_collapse_features->set_text(TTR("Advanced options"));
+ chk_collapse_features->set_text(TTR("Advanced Options"));
chk_collapse_features->set_theme(collapse_theme);
chk_collapse_features->set_focus_mode(FOCUS_NONE);
vbc->add_child(chk_collapse_features);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 4bb18f3ed9..8b060eae30 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1602,6 +1602,8 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
Ref<Script> existing = E->get()->get_script();
editor_data->get_undo_redo().add_do_method(E->get(), "set_script", p_script.get_ref_ptr());
editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing);
+ editor_data->get_undo_redo().add_do_method(this, "_update_script_button");
+ editor_data->get_undo_redo().add_undo_method(this, "_update_script_button");
}
editor_data->get_undo_redo().commit_action();
@@ -2619,6 +2621,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
add_child(rename_dialog);
script_create_dialog = memnew(ScriptCreateDialog);
+ script_create_dialog->set_inheritance_base_type("Node");
add_child(script_create_dialog);
script_create_dialog->connect("script_created", this, "_script_created");
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 62845bfb9b..5ca3448693 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -49,7 +49,7 @@ Node *SceneTreeEditor::get_scene_node() {
void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_id) {
if (connect_to_script_mode) {
- return; //dont do anything in this mode
+ return; //don't do anything in this mode
}
TreeItem *item = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!item);
@@ -379,6 +379,12 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
}
if (!keep) {
+ if (editor_selection) {
+ Node *n = get_node(item->get_metadata(0));
+ if (n) {
+ editor_selection->remove_node(n);
+ }
+ }
memdelete(item);
return false;
} else {
@@ -471,6 +477,17 @@ void SceneTreeEditor::_node_removed(Node *p_node) {
emit_signal("node_selected");
}
}
+
+void SceneTreeEditor::_node_renamed(Node *p_node) {
+
+ emit_signal("node_renamed");
+
+ if (!tree_dirty) {
+ MessageQueue::get_singleton()->push_call(this, "_update_tree");
+ tree_dirty = true;
+ }
+}
+
void SceneTreeEditor::_update_tree() {
if (!is_inside_tree()) {
@@ -594,6 +611,7 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree()->connect("tree_changed", this, "_tree_changed");
get_tree()->connect("node_removed", this, "_node_removed");
+ get_tree()->connect("node_renamed", this, "_node_renamed");
get_tree()->connect("node_configuration_warning_changed", this, "_warning_changed");
tree->connect("item_collapsed", this, "_cell_collapsed");
@@ -604,6 +622,7 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree()->disconnect("tree_changed", this, "_tree_changed");
get_tree()->disconnect("node_removed", this, "_node_removed");
+ get_tree()->disconnect("node_renamed", this, "_node_renamed");
tree->disconnect("item_collapsed", this, "_cell_collapsed");
get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
} break;
@@ -685,12 +704,6 @@ void SceneTreeEditor::_rename_node(ObjectID p_node, const String &p_name) {
n->set_name(p_name);
item->set_metadata(0, n->get_path());
item->set_text(0, p_name);
- emit_signal("node_renamed");
-
- if (!tree_dirty) {
- MessageQueue::get_singleton()->push_call(this, "_update_tree");
- tree_dirty = true;
- }
}
void SceneTreeEditor::_renamed() {
@@ -1025,6 +1038,7 @@ void SceneTreeEditor::_bind_methods() {
ClassDB::bind_method("_tree_changed", &SceneTreeEditor::_tree_changed);
ClassDB::bind_method("_update_tree", &SceneTreeEditor::_update_tree);
ClassDB::bind_method("_node_removed", &SceneTreeEditor::_node_removed);
+ ClassDB::bind_method("_node_renamed", &SceneTreeEditor::_node_renamed);
ClassDB::bind_method("_selected_changed", &SceneTreeEditor::_selected_changed);
ClassDB::bind_method("_deselect_items", &SceneTreeEditor::_deselect_items);
ClassDB::bind_method("_renamed", &SceneTreeEditor::_renamed);
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 9158c4aa48..1c14da0d3a 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -78,6 +78,7 @@ class SceneTreeEditor : public Control {
void _update_tree();
void _tree_changed();
void _node_removed(Node *p_node);
+ void _node_renamed(Node *p_node);
TreeItem *_find(TreeItem *p_node, const NodePath &p_path);
void _notification(int p_what);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 5ab0efaee3..751ae4fcf7 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -34,6 +34,7 @@
#include "core/os/file_access.h"
#include "core/project_settings.h"
#include "core/script_language.h"
+#include "editor/create_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor_file_system.h"
@@ -45,11 +46,28 @@ void ScriptCreateDialog::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
path_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
+ parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));
status_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
} break;
}
}
+void ScriptCreateDialog::_path_hbox_sorted() {
+ if (is_visible()) {
+ int filename_start_pos = initial_bp.find_last("/") + 1;
+ int filename_end_pos = initial_bp.length();
+
+ file_path->select(filename_start_pos, filename_end_pos);
+
+ // First set cursor to the end of line to scroll LineEdit view
+ // to the right and then set the actual cursor position.
+ file_path->set_cursor_position(file_path->get_text().length());
+ file_path->set_cursor_position(filename_start_pos);
+
+ file_path->grab_focus();
+ }
+}
+
bool ScriptCreateDialog::_can_be_built_in() {
return (supports_built_in && built_in_enabled);
}
@@ -77,13 +95,22 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_
_path_changed(file_path->get_text());
}
+void ScriptCreateDialog::set_inheritance_base_type(const String &p_base) {
+
+ base_type = p_base;
+}
+
bool ScriptCreateDialog::_validate(const String &p_string) {
if (p_string.length() == 0)
return false;
- String path_chars = "\"res://";
- bool is_val_path = ScriptServer::get_language(language_menu->get_selected())->can_inherit_from_file();
+ if (ScriptServer::get_language(language_menu->get_selected())->can_inherit_from_file() && p_string.is_quoted()) {
+ String p = p_string.substr(1, p_string.length() - 2);
+ if (_validate_path(p, true) == "")
+ return true;
+ }
+
for (int i = 0; i < p_string.length(); i++) {
if (i == 0) {
@@ -91,17 +118,7 @@ bool ScriptCreateDialog::_validate(const String &p_string) {
return false; // no start with number plz
}
- if (i == p_string.length() - 1 && is_val_path)
- return p_string[i] == '\"';
-
- if (is_val_path && i < path_chars.length()) {
- if (p_string[i] != path_chars[i])
- is_val_path = false;
- else
- continue;
- }
-
- bool valid_char = (p_string[i] >= '0' && p_string[i] <= '9') || (p_string[i] >= 'a' && p_string[i] <= 'z') || (p_string[i] >= 'A' && p_string[i] <= 'Z') || p_string[i] == '_' || p_string[i] == '-' || (is_val_path && (p_string[i] == '/' || p_string[i] == '.'));
+ bool valid_char = (p_string[i] >= '0' && p_string[i] <= '9') || (p_string[i] >= 'a' && p_string[i] <= 'z') || (p_string[i] >= 'A' && p_string[i] <= 'Z') || p_string[i] == '_' || p_string[i] == '-';
if (!valid_char)
return false;
@@ -110,6 +127,70 @@ bool ScriptCreateDialog::_validate(const String &p_string) {
return true;
}
+String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must_exist) {
+
+ String p = p_path.strip_edges();
+
+ if (p == "") return TTR("Path is empty.");
+ if (p.get_file().get_basename() == "") return TTR("Filename is empty.");
+
+ p = ProjectSettings::get_singleton()->localize_path(p);
+ if (!p.begins_with("res://")) return TTR("Path is not local.");
+
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (d->change_dir(p.get_base_dir()) != OK) {
+ memdelete(d);
+ return TTR("Invalid base path.");
+ }
+ memdelete(d);
+
+ /* Does file already exist */
+ DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (f->dir_exists(p)) {
+ memdelete(f);
+ return TTR("A directory with the same name exists.");
+ } else if (p_file_must_exist && !f->file_exists(p)) {
+ memdelete(f);
+ return TTR("File does not exist.");
+ }
+ memdelete(f);
+
+ /* Check file extension */
+ String extension = p.get_extension();
+ List<String> extensions;
+
+ // get all possible extensions for script
+ for (int l = 0; l < language_menu->get_item_count(); l++) {
+ ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
+ }
+
+ bool found = false;
+ bool match = false;
+ int index = 0;
+ for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
+ if (E->get().nocasecmp_to(extension) == 0) {
+ //FIXME (?) - changing language this way doesn't update controls, needs rework
+ //language_menu->select(index); // change Language option by extension
+ found = true;
+ if (E->get() == ScriptServer::get_language(language_menu->get_selected())->get_extension()) {
+ match = true;
+ }
+ break;
+ }
+ index++;
+ }
+
+ if (!found) return TTR("Invalid extension.");
+ if (!match) return TTR("Wrong extension chosen.");
+
+ /* Let ScriptLanguage do custom validation */
+ String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
+ if (path_error != "") return path_error;
+
+ /* All checks passed */
+ return "";
+}
+
void ScriptCreateDialog::_class_name_changed(const String &p_name) {
if (_validate(class_name->get_text())) {
@@ -322,7 +403,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) {
if (p_save) {
file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- file_browse->set_title(TTR("Open Script/Choose Location"));
+ file_browse->set_title(TTR("Open Script / Choose Location"));
file_browse->get_ok()->set_text(TTR("Open"));
} else {
file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
@@ -362,101 +443,37 @@ void ScriptCreateDialog::_file_selected(const String &p_file) {
}
}
-void ScriptCreateDialog::_path_changed(const String &p_path) {
+void ScriptCreateDialog::_create() {
- is_path_valid = false;
- is_new_script_created = true;
- String p = p_path.strip_edges();
+ parent_name->set_text(select_class->get_selected_type());
+}
- if (p == "") {
- _msg_path_valid(false, TTR("Path is empty"));
- _update_dialog();
- return;
- }
+void ScriptCreateDialog::_browse_class_in_tree() {
- if (p.get_file().get_basename() == "") {
- _msg_path_valid(false, TTR("Filename is empty"));
- _update_dialog();
- return;
- }
+ select_class->set_base_type(base_type);
+ select_class->popup_create(true);
+}
- p = ProjectSettings::get_singleton()->localize_path(p);
- if (!p.begins_with("res://")) {
- _msg_path_valid(false, TTR("Path is not local"));
- _update_dialog();
- return;
- }
+void ScriptCreateDialog::_path_changed(const String &p_path) {
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (d->change_dir(p.get_base_dir()) != OK) {
- _msg_path_valid(false, TTR("Invalid base path"));
- memdelete(d);
+ is_path_valid = false;
+ is_new_script_created = true;
+
+ String path_error = _validate_path(p_path, false);
+ if (path_error != "") {
+ _msg_path_valid(false, path_error);
_update_dialog();
return;
}
- memdelete(d);
/* Does file already exist */
-
DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (f->dir_exists(p)) {
- is_new_script_created = false;
- is_path_valid = false;
- _msg_path_valid(false, TTR("Directory of the same name exists"));
- } else if (f->file_exists(p)) {
+ String p = ProjectSettings::get_singleton()->localize_path(p_path.strip_edges());
+ if (f->file_exists(p)) {
is_new_script_created = false;
- is_path_valid = true;
- _msg_path_valid(true, TTR("File exists, will be reused"));
+ _msg_path_valid(true, TTR("File exists, it will be reused."));
}
memdelete(f);
- _update_dialog();
-
- /* Check file extension */
-
- String extension = p.get_extension();
- List<String> extensions;
-
- // get all possible extensions for script
- for (int l = 0; l < language_menu->get_item_count(); l++) {
- ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
- }
-
- bool found = false;
- bool match = false;
- int index = 0;
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- if (E->get().nocasecmp_to(extension) == 0) {
- //FIXME (?) - changing language this way doesn't update controls, needs rework
- //language_menu->select(index); // change Language option by extension
- found = true;
- if (E->get() == ScriptServer::get_language(language_menu->get_selected())->get_extension()) {
- match = true;
- }
- break;
- }
- index++;
- }
-
- if (!found) {
- _msg_path_valid(false, TTR("Invalid extension"));
- _update_dialog();
- return;
- }
-
- if (!match) {
- _msg_path_valid(false, TTR("Wrong extension chosen"));
- _update_dialog();
- return;
- }
-
- String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
- if (path_error != "") {
- _msg_path_valid(false, path_error);
- _update_dialog();
- return;
- }
-
- /* All checks passed */
is_path_valid = true;
_update_dialog();
@@ -494,22 +511,20 @@ void ScriptCreateDialog::_update_dialog() {
// Is Script Valid (order from top to bottom)
get_ok()->set_disabled(true);
- if (!is_built_in) {
- if (!is_path_valid) {
- _msg_script_valid(false, TTR("Invalid Path"));
- script_ok = false;
- }
+ if (!is_built_in && !is_path_valid) {
+ _msg_script_valid(false, TTR("Invalid path."));
+ script_ok = false;
}
if (has_named_classes && (is_new_script_created && !is_class_name_valid)) {
- _msg_script_valid(false, TTR("Invalid class name"));
+ _msg_script_valid(false, TTR("Invalid class name."));
script_ok = false;
}
- if (!is_parent_name_valid) {
- _msg_script_valid(false, TTR("Invalid inherited parent name or path"));
+ if (!is_parent_name_valid && is_new_script_created) {
+ _msg_script_valid(false, TTR("Invalid inherited parent name or path."));
script_ok = false;
}
if (script_ok) {
- _msg_script_valid(true, TTR("Script valid"));
+ _msg_script_valid(true, TTR("Script is valid."));
get_ok()->set_disabled(false);
}
@@ -552,25 +567,24 @@ void ScriptCreateDialog::_update_dialog() {
}
}
- if (!_can_be_built_in())
- internal->set_pressed(false);
-
/* Is Script created or loaded from existing file */
if (is_built_in) {
get_ok()->set_text(TTR("Create"));
parent_name->set_editable(true);
parent_browse_button->set_disabled(false);
- internal->set_disabled(!_can_be_built_in());
- _msg_path_valid(true, TTR("Built-in script (into scene file)"));
+ internal->set_visible(_can_be_built_in());
+ internal_label->set_visible(_can_be_built_in());
+ _msg_path_valid(true, TTR("Built-in script (into scene file)."));
} else if (is_new_script_created) {
// New Script Created
get_ok()->set_text(TTR("Create"));
parent_name->set_editable(true);
parent_browse_button->set_disabled(false);
- internal->set_disabled(!_can_be_built_in());
+ internal->set_visible(_can_be_built_in());
+ internal_label->set_visible(_can_be_built_in());
if (is_path_valid) {
- _msg_path_valid(true, TTR("Create new script file"));
+ _msg_path_valid(true, TTR("Will create a new script file."));
}
} else {
// Script Loaded
@@ -579,13 +593,14 @@ void ScriptCreateDialog::_update_dialog() {
parent_browse_button->set_disabled(true);
internal->set_disabled(!_can_be_built_in());
if (is_path_valid) {
- _msg_path_valid(true, TTR("Load existing script file"));
+ _msg_path_valid(true, TTR("Will load an existing script file."));
}
}
}
void ScriptCreateDialog::_bind_methods() {
+ ClassDB::bind_method("_path_hbox_sorted", &ScriptCreateDialog::_path_hbox_sorted);
ClassDB::bind_method("_class_name_changed", &ScriptCreateDialog::_class_name_changed);
ClassDB::bind_method("_parent_name_changed", &ScriptCreateDialog::_parent_name_changed);
ClassDB::bind_method("_lang_changed", &ScriptCreateDialog::_lang_changed);
@@ -595,6 +610,8 @@ void ScriptCreateDialog::_bind_methods() {
ClassDB::bind_method("_path_changed", &ScriptCreateDialog::_path_changed);
ClassDB::bind_method("_path_entered", &ScriptCreateDialog::_path_entered);
ClassDB::bind_method("_template_changed", &ScriptCreateDialog::_template_changed);
+ ClassDB::bind_method("_create", &ScriptCreateDialog::_create);
+ ClassDB::bind_method("_browse_class_in_tree", &ScriptCreateDialog::_browse_class_in_tree);
ClassDB::bind_method(D_METHOD("config", "inherits", "path", "built_in_enabled"), &ScriptCreateDialog::config, DEFVAL(true));
@@ -639,32 +656,17 @@ ScriptCreateDialog::ScriptCreateDialog() {
status_panel->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
status_panel->add_child(vb);
- /* Margins */
+ /* Spacing */
- Control *empty_h = memnew(Control);
- empty_h->set_name("empty_h"); //duplicate() doesn't like nodes without a name
- empty_h->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- empty_h->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- empty_h->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
- Control *empty_v = memnew(Control);
- empty_v->set_name("empty_v");
- empty_v->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- empty_v->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- empty_v->set_custom_minimum_size(Size2(10, 0 * EDSCALE));
+ Control *spacing = memnew(Control);
+ spacing->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
vb = memnew(VBoxContainer);
- vb->add_child(empty_h->duplicate());
vb->add_child(gc);
- vb->add_child(empty_h->duplicate());
+ vb->add_child(spacing);
vb->add_child(status_panel);
- vb->add_child(empty_h->duplicate());
hb = memnew(HBoxContainer);
- hb->add_child(empty_v->duplicate());
hb->add_child(vb);
- hb->add_child(empty_v->duplicate());
-
- memdelete(empty_h);
- memdelete(empty_v);
add_child(hb);
@@ -673,8 +675,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
language_menu = memnew(OptionButton);
language_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE);
language_menu->set_h_size_flags(SIZE_EXPAND_FILL);
- l = memnew(Label);
- l->set_text(TTR("Language"));
+ l = memnew(Label(TTR("Language")));
l->set_align(Label::ALIGN_RIGHT);
gc->add_child(l);
gc->add_child(language_menu);
@@ -707,18 +708,23 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Inherits */
+ base_type = "Object";
+
hb = memnew(HBoxContainer);
hb->set_h_size_flags(SIZE_EXPAND_FILL);
parent_name = memnew(LineEdit);
parent_name->connect("text_changed", this, "_parent_name_changed");
parent_name->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(parent_name);
+ parent_search_button = memnew(Button);
+ parent_search_button->set_flat(true);
+ parent_search_button->connect("pressed", this, "_browse_class_in_tree");
+ hb->add_child(parent_search_button);
parent_browse_button = memnew(Button);
parent_browse_button->set_flat(true);
parent_browse_button->connect("pressed", this, "_browse_path", varray(true, false));
hb->add_child(parent_browse_button);
- l = memnew(Label);
- l->set_text(TTR("Inherits"));
+ l = memnew(Label(TTR("Inherits")));
l->set_align(Label::ALIGN_RIGHT);
gc->add_child(l);
gc->add_child(hb);
@@ -729,8 +735,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
class_name = memnew(LineEdit);
class_name->connect("text_changed", this, "_class_name_changed");
class_name->set_h_size_flags(SIZE_EXPAND_FILL);
- l = memnew(Label);
- l->set_text(TTR("Class Name"));
+ l = memnew(Label(TTR("Class Name")));
l->set_align(Label::ALIGN_RIGHT);
gc->add_child(l);
gc->add_child(class_name);
@@ -738,8 +743,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Templates */
template_menu = memnew(OptionButton);
- l = memnew(Label);
- l->set_text(TTR("Template"));
+ l = memnew(Label(TTR("Template")));
l->set_align(Label::ALIGN_RIGHT);
gc->add_child(l);
gc->add_child(template_menu);
@@ -748,18 +752,18 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Built-in Script */
internal = memnew(CheckButton);
+ internal->set_h_size_flags(0);
internal->connect("pressed", this, "_built_in_pressed");
- hb = memnew(HBoxContainer);
- hb->add_child(internal);
- l = memnew(Label);
- l->set_text(TTR("Built-in Script"));
- l->set_align(Label::ALIGN_RIGHT);
- gc->add_child(l);
- gc->add_child(hb);
+ internal_label = memnew(Label(TTR("Built-in Script")));
+ internal_label->set_text(TTR("Built-in Script"));
+ internal_label->set_align(Label::ALIGN_RIGHT);
+ gc->add_child(internal_label);
+ gc->add_child(internal);
/* Path */
hb = memnew(HBoxContainer);
+ hb->connect("sort_children", this, "_path_hbox_sorted");
file_path = memnew(LineEdit);
file_path->connect("text_changed", this, "_path_changed");
file_path->connect("text_entered", this, "_path_entered");
@@ -769,14 +773,17 @@ ScriptCreateDialog::ScriptCreateDialog() {
path_button->set_flat(true);
path_button->connect("pressed", this, "_browse_path", varray(false, true));
hb->add_child(path_button);
- l = memnew(Label);
- l->set_text(TTR("Path"));
+ l = memnew(Label(TTR("Path")));
l->set_align(Label::ALIGN_RIGHT);
gc->add_child(l);
gc->add_child(hb);
/* Dialog Setup */
+ select_class = memnew(CreateDialog);
+ select_class->connect("create", this, "_create");
+ add_child(select_class);
+
file_browse = memnew(EditorFileDialog);
file_browse->connect("file_selected", this, "_file_selected");
file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 15e838d69f..c6dba78f56 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -40,6 +40,8 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
+class CreateDialog;
+
class ScriptCreateDialog : public ConfirmationDialog {
GDCLASS(ScriptCreateDialog, ConfirmationDialog);
@@ -49,14 +51,17 @@ class ScriptCreateDialog : public ConfirmationDialog {
PanelContainer *status_panel;
LineEdit *parent_name;
Button *parent_browse_button;
+ Button *parent_search_button;
OptionButton *language_menu;
OptionButton *template_menu;
LineEdit *file_path;
Button *path_button;
EditorFileDialog *file_browse;
CheckButton *internal;
+ Label *internal_label;
VBoxContainer *path_vb;
AcceptDialog *alert;
+ CreateDialog *select_class;
bool path_valid;
bool create_new;
bool is_browsing_parent;
@@ -74,18 +79,23 @@ class ScriptCreateDialog : public ConfirmationDialog {
bool re_check_path;
String script_template;
Vector<String> template_list;
+ String base_type;
+ void _path_hbox_sorted();
bool _can_be_built_in();
void _path_changed(const String &p_path = String());
void _path_entered(const String &p_path = String());
void _lang_changed(int l = 0);
void _built_in_pressed();
bool _validate(const String &p_string);
+ String _validate_path(const String &p_path, bool p_file_must_exist);
void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent);
void _template_changed(int p_template = 0);
void _browse_path(bool browse_parent, bool p_save);
void _file_selected(const String &p_file);
+ void _create();
+ void _browse_class_in_tree();
virtual void ok_pressed();
void _create_new();
void _load_exist();
@@ -99,6 +109,7 @@ protected:
public:
void config(const String &p_base_name, const String &p_base_path, bool p_built_in_enabled = true);
+ void set_inheritance_base_type(const String &p_base);
ScriptCreateDialog();
};
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 1da8bf874c..a661c2cfc3 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -299,6 +299,7 @@ void ScriptEditorDebugger::_scene_tree_rmb_selected(const Vector2 &p_position) {
item_menu->clear();
item_menu->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE);
+ item_menu->add_icon_item(get_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH);
item_menu->set_global_position(get_global_mouse_position());
item_menu->popup();
}
@@ -396,6 +397,7 @@ Size2 ScriptEditorDebugger::get_minimum_size() const {
ms.y = MAX(ms.y, 250 * EDSCALE);
return ms;
}
+
void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_data) {
if (p_msg == "debug_enter") {
@@ -1930,6 +1932,24 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
file_dialog->popup_centered_ratio();
} break;
+ case ITEM_MENU_COPY_NODE_PATH: {
+
+ TreeItem *ti = inspect_scene_tree->get_selected();
+ String text = ti->get_text(0);
+
+ if (ti->get_parent() == NULL) {
+ text = ".";
+ } else if (ti->get_parent()->get_parent() == NULL) {
+ text = ".";
+ } else {
+ while (ti->get_parent()->get_parent() != inspect_scene_tree->get_root()) {
+ ti = ti->get_parent();
+ text = ti->get_text(0) + "/" + text;
+ }
+ }
+
+ OS::get_singleton()->set_clipboard(text);
+ } break;
}
}
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index f7afe6bf72..05dcab0f80 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -66,6 +66,7 @@ class ScriptEditorDebugger : public Control {
enum ItemMenu {
ITEM_MENU_COPY_ERROR,
ITEM_MENU_SAVE_REMOTE_NODE,
+ ITEM_MENU_COPY_NODE_PATH,
};
AcceptDialog *msgdialog;
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 6b1e53aa2e..b4643231d7 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -442,7 +442,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
restart_hb->add_child(restart_icon);
restart_label = memnew(Label);
- restart_label->set_text(TTR("Editor must be restarted for changes to take effect"));
+ restart_label->set_text(TTR("The editor must be restarted for changes to take effect."));
restart_hb->add_child(restart_label);
restart_hb->add_spacer();
Button *restart_button = memnew(Button);
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index f540b386aa..104bac190e 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -571,9 +571,11 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
Transform orig_camera_transform = p_camera->get_camera_transform();
- if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01) {
+ if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01 &&
+ ABS(orig_camera_transform.basis.get_axis(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) {
p_camera->look_at(t.origin, Vector3(0, 1, 0));
}
+
Vector3 c0 = t.xform(Vector3(selectable_icon_size, selectable_icon_size, 0) * scale);
Vector3 c1 = t.xform(Vector3(-selectable_icon_size, -selectable_icon_size, 0) * scale);
@@ -582,7 +584,7 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
p_camera->set_global_transform(orig_camera_transform);
- Rect2 rect(p0, p1 - p0);
+ Rect2 rect(p0, (p1 - p0).abs());
rect.set_position(center - rect.get_size() / 2.0);
diff --git a/editor/translations/af.po b/editor/translations/af.po
index 795044c0cd..5bc804cfcd 100644
--- a/editor/translations/af.po
+++ b/editor/translations/af.po
@@ -163,16 +163,21 @@ msgstr ""
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Anim Voeg Baan By"
+msgid "Animation length (frames)"
+msgstr "Animasie lengte (in sekondes)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Animasie lengte (in sekondes)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Anim Voeg Baan By"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Animasie Zoem."
diff --git a/editor/translations/ar.po b/editor/translations/ar.po
index 50efabd7f5..1c5fb54fdf 100644
--- a/editor/translations/ar.po
+++ b/editor/translations/ar.po
@@ -24,12 +24,13 @@
# Mohammad Fares <mhdchehade@gmail.com>, 2018.
# NewFriskFan26 <newfriskfan26@gmail.com>, 2019.
# spiderx0x <legendofdarks@gmail.com>, 2019.
+# Ibraheem Tawfik <tawfikibraheem@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-17 10:02+0000\n"
-"Last-Translator: Omar Aglan <omar.aglan91@yahoo.com>\n"
+"PO-Revision-Date: 2019-04-29 08:48+0000\n"
+"Last-Translator: Ibraheem Tawfik <tawfikibraheem@gmail.com>\n"
"Language-Team: Arabic <https://hosted.weblate.org/projects/godot-engine/"
"godot/ar/>\n"
"Language: ar\n"
@@ -38,7 +39,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.6.1\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -174,14 +175,20 @@ msgid "Animation Playback Track"
msgstr "شريط ضبط الحركة"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "إضاÙØ© مسار"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "مدة الحركة (بالثواني)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "مدة الحركة (بالثواني)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "إضاÙØ© مسار"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "تكرار الحركة"
@@ -358,8 +365,9 @@ msgstr ""
"-الصوت الجاري للأعب ثلاثي الأبعاد"
#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation tracks can only point to AnimationPlayer nodes."
-msgstr ""
+msgstr "مسارات الحركة يمكنها Ùقط أن تشير إلى عقدة مشغّل الحركة AnimationPlayer"
#: editor/animation_track_editor.cpp
msgid "An animation player can't animate itself, only other players."
@@ -442,11 +450,11 @@ msgstr "قيمة خطوة الحركة."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "ثواني"
#: editor/animation_track_editor.cpp
msgid "FPS"
-msgstr ""
+msgstr "إطار خلال ثانية"
#: editor/animation_track_editor.cpp editor/editor_properties.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -1417,7 +1425,7 @@ msgstr "مل٠النموذج غير موجود:"
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
msgid "Custom release template not found."
-msgstr ""
+msgstr "قالب الإصدار المخصص ليس موجود"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
msgid "Template file not found:"
@@ -1531,14 +1539,13 @@ msgid "Move Favorite Down"
msgstr "حرك المÙÙضلة للأسÙÙ„"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Previous Folder"
-msgstr "التبويب السابق"
+msgstr "المجلد السابق"
#: editor/editor_file_dialog.cpp
#, fuzzy
msgid "Next Folder"
-msgstr "أنشئ مجلد"
+msgstr "المجلد اللاحق"
#: editor/editor_file_dialog.cpp
msgid "Go to parent folder"
@@ -1610,7 +1617,7 @@ msgstr "خصائص"
#: editor/editor_help.cpp
msgid "Properties:"
-msgstr ""
+msgstr "خصائص:"
#: editor/editor_help.cpp
msgid "Methods"
@@ -1624,7 +1631,7 @@ msgstr "قائمة الطرق"
#: editor/editor_help.cpp
#, fuzzy
msgid "Theme Properties"
-msgstr "خصائص"
+msgstr "خصائص النمط"
#: editor/editor_help.cpp
#, fuzzy
@@ -1656,14 +1663,12 @@ msgid "Constants:"
msgstr "الثوابت:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Class Description"
-msgstr "الوصÙ"
+msgstr "وص٠الصÙ"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Class Description:"
-msgstr "الوصÙ:"
+msgstr "وص٠الصÙ:"
#: editor/editor_help.cpp
msgid "Online Tutorials:"
@@ -1721,34 +1726,28 @@ msgid "Search Help"
msgstr "إبحث ÙÙŠ المساعدة"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Display All"
-msgstr "إستبدال الكل"
+msgstr "إظهار الكل"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Classes Only"
-msgstr "الÙئات"
+msgstr "الصÙÙˆÙ Ùقط"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Methods Only"
-msgstr "قائمة الطرق"
+msgstr "الطرق Ùقط"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Signals Only"
-msgstr "إشارات"
+msgstr "إشارات Ùقط"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Constants Only"
-msgstr "الثوابت"
+msgstr "ثوابت Ùقط"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Properties Only"
-msgstr "خصائص"
+msgstr "خصائص Ùقط"
#: editor/editor_help_search.cpp
#, fuzzy
@@ -1756,9 +1755,8 @@ msgid "Theme Properties Only"
msgstr "خصائص"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Member Type"
-msgstr "الأعضاء"
+msgstr "نوع العضو"
#: editor/editor_help_search.cpp
#, fuzzy
@@ -1767,11 +1765,11 @@ msgstr "صنÙ:"
#: editor/editor_inspector.cpp editor/project_settings_editor.cpp
msgid "Property:"
-msgstr ""
+msgstr "خصيصة:"
#: editor/editor_inspector.cpp
msgid "Set"
-msgstr ""
+msgstr "مجموعة"
#: editor/editor_inspector.cpp
msgid "Set Multiple:"
@@ -1806,7 +1804,7 @@ msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
#: scene/gui/dialogs.cpp
msgid "OK"
-msgstr ""
+msgstr "حسنا"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
diff --git a/editor/translations/bg.po b/editor/translations/bg.po
index fb81a1793a..e62de9bb28 100644
--- a/editor/translations/bg.po
+++ b/editor/translations/bg.po
@@ -165,12 +165,18 @@ msgstr ""
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "ДобавÑне на нови пътечки."
+msgid "Animation length (frames)"
+msgstr "Ðово Име на ÐнимациÑ:"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
-msgstr ""
+#, fuzzy
+msgid "Animation length (seconds)"
+msgstr "Промени Името на ÐнимациÑта:"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "ДобавÑне на нови пътечки."
#: editor/animation_track_editor.cpp
#, fuzzy
diff --git a/editor/translations/bn.po b/editor/translations/bn.po
index 4b7dd76be6..3ff5ddaf1c 100644
--- a/editor/translations/bn.po
+++ b/editor/translations/bn.po
@@ -172,16 +172,21 @@ msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à§‡à¦° চালনা বনà§à¦§ কর
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨ (Anim) টà§à¦°à§à¦¯à¦¾à¦• যোগ করà§à¦¨"
+msgid "Animation length (frames)"
+msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à§‡à¦° (Animation) দৈরà§à¦˜à§à¦¯ (সময় সেকেনà§à¦¡à§‡)।"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à§‡à¦° (Animation) দৈরà§à¦˜à§à¦¯ (সময় সেকেনà§à¦¡à§‡)।"
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨ (Anim) টà§à¦°à§à¦¯à¦¾à¦• যোগ করà§à¦¨"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨ (Animation) জà§à¦® (zoom) করà§à¦¨à¥¤"
diff --git a/editor/translations/ca.po b/editor/translations/ca.po
index cd87bb8a46..20d9da2ae1 100644
--- a/editor/translations/ca.po
+++ b/editor/translations/ca.po
@@ -7,11 +7,12 @@
# Roger Blanco Ribera <roger.blancoribera@gmail.com>, 2016-2018.
# Rubén Moreno <ruben.moreno.romero@gmail.com>, 2018.
# roger <616steam@gmail.com>, 2019.
+# Roger BR <drai_kin@hotmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-19 16:33+0000\n"
+"PO-Revision-Date: 2019-05-19 07:48+0000\n"
"Last-Translator: roger <616steam@gmail.com>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/godot-engine/"
"godot/ca/>\n"
@@ -20,7 +21,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -91,9 +92,8 @@ msgid "Add Bezier Point"
msgstr "Afegir punt Bezier"
#: editor/animation_bezier_editor.cpp
-#, fuzzy
msgid "Move Bezier Points"
-msgstr "Mou el Punt"
+msgstr "Moure Punts Bezier"
#: editor/animation_bezier_editor.cpp editor/animation_track_editor.cpp
msgid "Anim Duplicate Keys"
@@ -121,12 +121,11 @@ msgstr "Modifica el valor de la clau"
#: editor/animation_track_editor.cpp
msgid "Anim Change Call"
-msgstr "Modifica la Crida"
+msgstr "Canviar crida d'animació"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Animation Length"
-msgstr "Modifica el bucle d'Animació"
+msgstr "Canviar la durada de l'Animació"
#: editor/animation_track_editor.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
@@ -158,14 +157,20 @@ msgid "Animation Playback Track"
msgstr "Pista de reproducció d'Animacions"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Afegeix una Pista"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Durada de l'Animació (en segons)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Durada de l'Animació (en segons)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Afegeix una Pista"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Bucle de l'Animació"
@@ -183,9 +188,8 @@ msgid "Anim Clips:"
msgstr "Talls d'Animació:"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Track Path"
-msgstr "Modifica el Valor de la Taula"
+msgstr "Canviar el camí de la pista"
#: editor/animation_track_editor.cpp
msgid "Toggle this track on/off."
@@ -212,9 +216,8 @@ msgid "Time (s): "
msgstr "Temps (s): "
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Toggle Track Enabled"
-msgstr "Activa Doppler"
+msgstr "Pista de commutació activada"
#: editor/animation_track_editor.cpp
msgid "Continuous"
@@ -267,19 +270,16 @@ msgid "Delete Key(s)"
msgstr "Elimina les Claus"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Animation Update Mode"
-msgstr "Modifica el Nom de l'Animació:"
+msgstr "Canviar el Mode d'Actualització de l'Animació"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Animation Interpolation Mode"
-msgstr "Mode d'Interpolació"
+msgstr "Canviar Mode d'Interpolació de l'Animació"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Animation Loop Mode"
-msgstr "Modifica el bucle d'Animació"
+msgstr "Canviar Mode de bucle d'Animació"
#: editor/animation_track_editor.cpp
msgid "Remove Anim Track"
@@ -364,9 +364,8 @@ msgid "Not possible to add a new track without a root"
msgstr "No es pot afegir una nova pista sense cap arrel"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Add Bezier Track"
-msgstr "Afegeix una Pista"
+msgstr "Afegir Pista Bezier"
#: editor/animation_track_editor.cpp
msgid "Track path is invalid, so can't add a key."
@@ -377,9 +376,8 @@ msgid "Track is not of type Spatial, can't insert key"
msgstr "No s'hi pot inserir cap Clau. La pista no és del tipus \"Spatial\""
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Add Transform Track Key"
-msgstr "Pista de Transformació 3D"
+msgstr "Afegir Clau de Pista de Transformació"
#: editor/animation_track_editor.cpp
msgid "Add Track Key"
@@ -439,7 +437,7 @@ msgstr "Valor del pas d'Animació."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Segons"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -483,14 +481,12 @@ msgid "Delete Selection"
msgstr "Elimina la Selecció"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Go to Next Step"
-msgstr "Vés al Pas Següent"
+msgstr "Anar al Pas Següent"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Go to Previous Step"
-msgstr "Vés al Pas Anterior"
+msgstr "Anar al Pas Anterior"
#: editor/animation_track_editor.cpp
msgid "Optimize Animation"
@@ -565,17 +561,16 @@ msgid "Copy"
msgstr "Copia"
#: editor/animation_track_editor_plugins.cpp
-#, fuzzy
msgid "Add Audio Track Clip"
-msgstr "Talls d'Àudio:"
+msgstr "Afegir Clip de Pista d'Àudio"
#: editor/animation_track_editor_plugins.cpp
msgid "Change Audio Track Clip Start Offset"
-msgstr ""
+msgstr "Canviar Desplaçament d'Inici de Clip de Pista d'Àudio"
#: editor/animation_track_editor_plugins.cpp
msgid "Change Audio Track Clip End Offset"
-msgstr ""
+msgstr "Canviar Desplaçament de Fi del Clip de Pista d'Àudio"
#: editor/array_property_edit.cpp
msgid "Resize Array"
@@ -647,7 +642,7 @@ msgstr "Avisos"
#: editor/code_editor.cpp
msgid "Line and column numbers."
-msgstr ""
+msgstr "Números de línia i columna."
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
@@ -752,9 +747,9 @@ msgid "Edit Connection: "
msgstr "Edita la Connexió: "
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Are you sure you want to remove all connections from the \"%s\" signal?"
-msgstr "Esteu segur que voleu eliminar totes les connexions d'aquest senyal?"
+msgstr ""
+"Esteu segurs de que voleu eliminar totes les connexions del senyal \"%s\"?"
#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
msgid "Signals"
@@ -908,9 +903,8 @@ msgid "Error loading:"
msgstr "Error en carregar:"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Load failed due to missing dependencies:"
-msgstr "No es pot carregar l'escena. Manquen dependències:"
+msgstr "Càrrega fallida perquè falten les següents dependències:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Open Anyway"
@@ -1061,9 +1055,8 @@ msgid "Uncompressing Assets"
msgstr "Descomprimint Recursos"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
-#, fuzzy
msgid "Package installed successfully!"
-msgstr "Paquet instal·lat correctament!"
+msgstr "Paquet instal·lat amb èxit!"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -1209,9 +1202,8 @@ msgid "Add Bus"
msgstr "Afegeix Bus"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Add a new Audio Bus to this layout."
-msgstr "Anomena i Desa el Disseny del Bus d'Àudio..."
+msgstr "Afegir un nou Bus d'Àudio a aquesta configuració."
#: editor/editor_audio_buses.cpp editor/editor_properties.cpp
#: editor/plugins/animation_player_editor_plugin.cpp editor/property_editor.cpp
@@ -1397,12 +1389,16 @@ msgid ""
"Target platform requires 'ETC' texture compression for GLES2. Enable 'Import "
"Etc' in Project Settings."
msgstr ""
+"La plataforma de destí requereix compressió de textures 'ETC' per a GLES2. "
+"Activa 'Import Etc' en la Configuració del Projecte."
#: editor/editor_export.cpp
msgid ""
"Target platform requires 'ETC2' texture compression for GLES3. Enable "
"'Import Etc 2' in Project Settings."
msgstr ""
+"La plataforma de destí requereix compressió de textures 'ETC' per a GLES2. "
+"Activa 'Import Etc 2' en la Configuració del Projecte."
#: editor/editor_export.cpp
msgid ""
@@ -1421,9 +1417,8 @@ msgstr "No s'ha trobat cap plantilla de depuració personalitzada."
#: editor/editor_export.cpp platform/android/export/export.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
-#, fuzzy
msgid "Custom release template not found."
-msgstr "No s'ha trobat cap paquet de llançament personalitzat."
+msgstr "No s'ha trobat cap plantilla de publicació personalitzada."
#: editor/editor_export.cpp platform/javascript/export/export.cpp
msgid "Template file not found:"
@@ -1438,24 +1433,21 @@ msgid "File Exists, Overwrite?"
msgstr "Fitxer Existent, Voleu sobreescriure'l?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select This Folder"
-msgstr "Selecciona aquest Directori"
+msgstr "Seleccionar aquest Directori"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
msgstr "Copia Camí"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-#, fuzzy
msgid "Open in File Manager"
-msgstr "Mostra en el Gestor de Fitxers"
+msgstr "Obrir en el Gestor de Fitxers"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
#: editor/project_manager.cpp
-#, fuzzy
msgid "Show in File Manager"
-msgstr "Mostra en el Gestor de Fitxers"
+msgstr "Mostrar en el Gestor de Fitxers"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "New Folder..."
@@ -1549,9 +1541,8 @@ msgid "Go to parent folder"
msgstr "Vés al directori principal"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "(Un)favorite current folder."
-msgstr "No s'ha pogut crear el directori."
+msgstr "Eliminar carpeta actual de preferits."
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "View items as a grid of thumbnails."
@@ -1677,14 +1668,12 @@ msgstr ""
"$url2]sol·licitant-lo[/url][/color]."
#: editor/editor_help.cpp
-#, fuzzy
msgid "Property Descriptions"
-msgstr "Descripció de la Propietat:"
+msgstr "Descripcions de la Propietat"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Property Descriptions:"
-msgstr "Descripció de la Propietat:"
+msgstr "Descripcions de la Propietat:"
#: editor/editor_help.cpp
msgid ""
@@ -1695,14 +1684,12 @@ msgstr ""
"$color][url=$url] totaportant-ne una[/url][/color]!"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Method Descriptions"
-msgstr "Descripció del mètode:"
+msgstr "Descripcions del Mètode"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Method Descriptions:"
-msgstr "Descripció del mètode:"
+msgstr "Descripcions del Mètode:"
#: editor/editor_help.cpp
msgid ""
@@ -1718,9 +1705,8 @@ msgid "Search Help"
msgstr "Cerca Ajuda"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Display All"
-msgstr "Mostra les Normals"
+msgstr "Mostra-ho tot"
#: editor/editor_help_search.cpp
msgid "Classes Only"
@@ -1747,9 +1733,8 @@ msgid "Theme Properties Only"
msgstr "Només Propietats del Tema"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Member Type"
-msgstr "Membres"
+msgstr "Tipus de Membre"
#: editor/editor_help_search.cpp
msgid "Class"
@@ -1876,7 +1861,7 @@ msgstr ""
#: editor/editor_node.cpp editor/scene_tree_dock.cpp
msgid "Can't overwrite scene that is still open!"
-msgstr ""
+msgstr "No es pot sobreescriure la escena si encara està oberta!"
#: editor/editor_node.cpp
msgid "Can't load MeshLibrary for merging!"
@@ -2205,9 +2190,8 @@ msgstr "Predeterminat"
#: editor/editor_node.cpp editor/editor_properties.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_editor.cpp
-#, fuzzy
msgid "Show in FileSystem"
-msgstr "Mostra'l en el Sistema de Fitxers"
+msgstr "Mostrar en el Sistema de Fitxers"
#: editor/editor_node.cpp
msgid "Play This Scene"
@@ -2290,9 +2274,8 @@ msgid "Save Scene"
msgstr "Desa Escena"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save All Scenes"
-msgstr "Desa Totes les Escenes"
+msgstr "Desar Totes les Escenes"
#: editor/editor_node.cpp
msgid "Close Scene"
@@ -2563,9 +2546,8 @@ msgid "Save & Restart"
msgstr "Desa i Reinicia"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Spins when the editor window redraws."
-msgstr "Gira i Gira mentre l'editor es repinta!"
+msgstr "Gira quan la finestra de l'editor es redibuixa."
#: editor/editor_node.cpp
msgid "Update Always"
@@ -2776,9 +2758,8 @@ msgid "Assign..."
msgstr "Assigna..."
#: editor/editor_properties.cpp
-#, fuzzy
msgid "Invalid RID"
-msgstr "Camí no vàlid"
+msgstr "RID no vàlid"
#: editor/editor_properties.cpp
msgid ""
@@ -3224,12 +3205,10 @@ msgid "New Resource..."
msgstr "Recurs Nou..."
#: editor/filesystem_dock.cpp editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Expand All"
msgstr "Expandir tot"
#: editor/filesystem_dock.cpp editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Collapse All"
msgstr "Col·lapsar tot"
@@ -3253,9 +3232,8 @@ msgid "Re-Scan Filesystem"
msgstr "ReAnalitza Sistema de Fitxers"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Toggle split mode"
-msgstr "Commuta Mode"
+msgstr "Commutar mode dividit"
#: editor/filesystem_dock.cpp
msgid "Search files"
@@ -3284,18 +3262,16 @@ msgid "Create Script"
msgstr "Crea un Script"
#: editor/find_in_files.cpp
-#, fuzzy
msgid "Find in Files"
-msgstr "Cerca en els fitxers"
+msgstr "Cercar en els Fitxers"
#: editor/find_in_files.cpp
-#, fuzzy
msgid "Find:"
-msgstr "Cerca: "
+msgstr "Cercar:"
#: editor/find_in_files.cpp
msgid "Folder:"
-msgstr "Directori: "
+msgstr "Directori:"
#: editor/find_in_files.cpp
msgid "Filters:"
@@ -3474,7 +3450,7 @@ msgstr "ReImportar"
#: editor/import_dock.cpp
msgid "Save scenes, re-import and restart"
-msgstr ""
+msgstr "Guardar escenes, reimportar i reiniciar"
#: editor/import_dock.cpp
msgid "Changing the type of an imported file requires editor restart."
@@ -3643,14 +3619,12 @@ msgid "Insert Point"
msgstr "Insereix un Punt"
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Edit Polygon (Remove Point)"
-msgstr "Edita el Polígon (Elimina un Punt)"
+msgstr "Editar Polígon (Eliminar Punt)"
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Remove Polygon And Point"
-msgstr "Elimina el Polígon i el Punt"
+msgstr "Eliminar Polígon i Punt"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3664,25 +3638,21 @@ msgstr "Afegeix una Animació"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Load..."
-msgstr "Carrega..."
+msgstr "Carregar..."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Move Node Point"
-msgstr "Mou el Punt"
+msgstr "Moure Punt de Node"
#: editor/plugins/animation_blend_space_1d_editor.cpp
-#, fuzzy
msgid "Change BlendSpace1D Limits"
-msgstr "Modifica el Temps de Mescla"
+msgstr "Canviar Límits de BlendSpace1D"
#: editor/plugins/animation_blend_space_1d_editor.cpp
-#, fuzzy
msgid "Change BlendSpace1D Labels"
-msgstr "Modifica el Temps de Mescla"
+msgstr "Canviar Etiquetes de BlendSpace1D"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3694,24 +3664,21 @@ msgstr ""
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Add Node Point"
-msgstr "Afegeix un Node"
+msgstr "Afegir Punt de Node"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Add Animation Point"
-msgstr "Afegeix una Animació"
+msgstr "Afegir Punt d'Animació"
#: editor/plugins/animation_blend_space_1d_editor.cpp
-#, fuzzy
msgid "Remove BlendSpace1D Point"
-msgstr "Elimina un Punt del Camí"
+msgstr "Eliminar Punt BlendSpace1D"
#: editor/plugins/animation_blend_space_1d_editor.cpp
msgid "Move BlendSpace1D Node Point"
-msgstr ""
+msgstr "Moure Punt BlendSpace1D"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3760,24 +3727,20 @@ msgid "Add Triangle"
msgstr "Afegir Triangle"
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Change BlendSpace2D Limits"
-msgstr "Modifica el Temps de Mescla"
+msgstr "Canviar Límits BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Change BlendSpace2D Labels"
-msgstr "Modifica el Temps de Mescla"
+msgstr "Canviar Etiquetes BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Remove BlendSpace2D Point"
-msgstr "Elimina un Punt del Camí"
+msgstr "Eliminar Punt BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Remove BlendSpace2D Triangle"
-msgstr "Elimina la Variable"
+msgstr "Eliminar Triangle BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "BlendSpace2D does not belong to an AnimationTree node."
@@ -3839,7 +3802,6 @@ msgstr "No es pot connectar. El port és en ús o la connexió no és vàlida."
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Nodes Connected"
msgstr "Nodes Connectats"
@@ -3849,9 +3811,8 @@ msgid "Nodes Disconnected"
msgstr "Nodes Desconnectats"
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
-#, fuzzy
msgid "Set Animation"
-msgstr "Animació"
+msgstr "Establir Animació"
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/visual_shader_editor_plugin.cpp
@@ -3897,20 +3858,17 @@ msgstr "Nom del node:"
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Add Node..."
-msgstr "Afegeix un Node"
+msgstr "Afegir Node..."
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/root_motion_editor_plugin.cpp
-#, fuzzy
msgid "Edit Filtered Tracks:"
-msgstr "Edita Filtres"
+msgstr "Editar Pistes Filtrades:"
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
-#, fuzzy
msgid "Enable filtering"
-msgstr "Fills Editables"
+msgstr "Habilitar filtració"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Toggle Autoplay"
@@ -3938,14 +3896,12 @@ msgid "Remove Animation"
msgstr "Eliminar l'Animació"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Invalid animation name!"
-msgstr "ERROR: El Nom de l'Animació no és vàlid!"
+msgstr "El Nom de l'Animació no és vàlid!"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Animation name already exists!"
-msgstr "ERROR: Ja existeix aquest nom d'Animació!"
+msgstr "El nom d'animació ja existeix!"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
@@ -3969,14 +3925,12 @@ msgid "Duplicate Animation"
msgstr "Duplica l'Animació"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "No animation to copy!"
-msgstr "ERROR: Cap animació per copiar!"
+msgstr "No hi ha animacions per copiar!"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "No animation resource on clipboard!"
-msgstr "ERROR: Cap recurs d'animació al porta-retalls!"
+msgstr "No hi ha recursos d'animació al porta-retalls!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Pasted Animation"
@@ -3987,9 +3941,8 @@ msgid "Paste Animation"
msgstr "Enganxa l'Animació"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "No animation to edit!"
-msgstr "ERROR: Cap animació per editar!"
+msgstr "Cap animació per editar!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from current pos. (A)"
@@ -4034,14 +3987,12 @@ msgid "New"
msgstr "Nou"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Edit Transitions..."
-msgstr "Transicions"
+msgstr "Editar Transicions..."
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Open in Inspector"
-msgstr "Obre en l'Editor"
+msgstr "Obre en l'Inspector"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Display list of animations in player."
@@ -4133,14 +4084,12 @@ msgid "Cross-Animation Blend Times"
msgstr "Temps de mescla entre Animacions"
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Move Node"
-msgstr "Mode de moviment"
+msgstr "Moure Node"
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Add Transition"
-msgstr "Afegeix una Traducció"
+msgstr "Afegir una Transició"
#: editor/plugins/animation_state_machine_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -4148,9 +4097,8 @@ msgid "Add Node"
msgstr "Afegeix un Node"
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "End"
-msgstr "Final/s"
+msgstr "Final"
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Immediate"
@@ -4162,7 +4110,7 @@ msgstr "Sincronitzar"
#: editor/plugins/animation_state_machine_editor.cpp
msgid "At End"
-msgstr ""
+msgstr "Al Final"
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Travel"
@@ -4173,45 +4121,44 @@ msgid "Start and end nodes are needed for a sub-transition."
msgstr ""
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "No playback resource set at path: %s."
-msgstr "Fora del camí dels recursos."
+msgstr "Cap recurs de reproducció assignat en el camí: %s."
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Node Removed"
-msgstr "Eliminat:"
+msgstr "Node Eliminat"
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Transition Removed"
-msgstr "Node de Transició"
+msgstr "Transició Eliminada"
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Set Start Node (Autoplay)"
-msgstr ""
+msgstr "Establir node d'inici (Reproducció Automàtica)"
#: editor/plugins/animation_state_machine_editor.cpp
+#, fuzzy
msgid ""
"Select and move nodes.\n"
"RMB to add new nodes.\n"
"Shift+LMB to create connections."
msgstr ""
+"Seleccionar i moure nodes.\n"
+"Clic dret per afegir nous nodes.\n"
+"Shift + clic esquerra per a crear connexions."
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Create new nodes."
-msgstr "Crea Nou %s"
+msgstr "Crear nous nodes."
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Connect nodes."
-msgstr "Connecta els Nodes"
+msgstr "Connectar nodes."
#: editor/plugins/animation_state_machine_editor.cpp
#, fuzzy
msgid "Remove selected node or transition."
-msgstr "Treu la pista seleccionada."
+msgstr "Eliminar el node o transició seleccionats."
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Toggle autoplay this animation on start, restart or seek to zero."
@@ -4224,7 +4171,7 @@ msgstr ""
#: editor/plugins/animation_state_machine_editor.cpp
#, fuzzy
msgid "Transition: "
-msgstr "Transició"
+msgstr "Transició: "
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/animation_tree_player_editor_plugin.cpp
@@ -4418,14 +4365,12 @@ msgid "Asset Download Error:"
msgstr "Error en la baixada de l'Actiu:"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Downloading (%s / %s)..."
-msgstr "S'esta descarrengant"
+msgstr "Descarregant (%s / %s)..."
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Downloading..."
-msgstr "S'esta descarrengant"
+msgstr "Descarregant..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Resolving..."
@@ -4798,9 +4743,8 @@ msgid "Restores the object's children's ability to be selected."
msgstr "Permet la selecció de nodes fills."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Skeleton Options"
-msgstr "Singleton"
+msgstr "Opcions d'esquelet"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Bones"
@@ -4855,7 +4799,7 @@ msgstr "Mostra el Viewport"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Group And Lock Icons"
-msgstr ""
+msgstr "Mostrar Grup i Bloquejar Icones"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
@@ -4871,15 +4815,15 @@ msgstr "Desar Disseny"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Mascara de translació per a inserir claus."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Mascara de rotació per a inserir claus."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Mascara d'escala per a inserir claus."
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
@@ -5100,7 +5044,7 @@ msgstr "Precalcula la Sonda d'IG"
#: editor/plugins/gradient_editor_plugin.cpp
msgid "Gradient Edited"
-msgstr ""
+msgstr "Degradat Editat"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item %d"
@@ -5451,9 +5395,8 @@ msgid "Add Point to Curve"
msgstr "Afegeix un Punt a la Corba"
#: editor/plugins/path_2d_editor_plugin.cpp
-#, fuzzy
msgid "Split Curve"
-msgstr "Tanca la Corba"
+msgstr "Partir Corba"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Point in Curve"
@@ -5483,9 +5426,8 @@ msgid "Click: Add Point"
msgstr "Clic: Afegeix un Punt"
#: editor/plugins/path_2d_editor_plugin.cpp
-#, fuzzy
msgid "Left Click: Split Segment (in curve)"
-msgstr "Parteix el Segment (de la Corba)"
+msgstr "Clic Esquerra: Partir Segment (en la Corba)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
@@ -5571,7 +5513,7 @@ msgstr "Mou el Punt"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid ""
"The skeleton property of the Polygon2D does not point to a Skeleton2D node"
-msgstr ""
+msgstr "La propietat esquelet del Polygon2D no apunta a un node Skeleton2D"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#, fuzzy
@@ -5579,10 +5521,13 @@ msgid "Sync Bones"
msgstr "Mostra els Ossos"
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid ""
"No texture in this polygon.\n"
"Set a texture to be able to edit UV."
msgstr ""
+"No hi ha textura en aquest polígon.\n"
+"Assigneu una textura per a poder editar el UV."
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Create UV Map"
@@ -5610,13 +5555,13 @@ msgid "Remove Internal Vertex"
msgstr "Elimina el Punt In-Control"
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid "Invalid Polygon (need 3 different vertices)"
-msgstr ""
+msgstr "Polígon no vàlid (es necessiten 3 vèrtex diferents)"
#: editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Add Custom Polygon"
-msgstr "Edita Polígon"
+msgstr "Afegir Polígon Personalitzat"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#, fuzzy
@@ -5633,8 +5578,9 @@ msgid "Transform Polygon"
msgstr "Tipus de Transformació"
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid "Paint Bone Weights"
-msgstr ""
+msgstr "Pintar Pes dels Ossos"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#, fuzzy
@@ -5694,22 +5640,30 @@ msgid "Scale Polygon"
msgstr "Escala el Polígon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid "Create a custom polygon. Enables custom polygon rendering."
msgstr ""
+"Crear polígon personalitzat. Habilita el renderitzat de polígons "
+"personalitzats."
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid ""
"Remove a custom polygon. If none remain, custom polygon rendering is "
"disabled."
msgstr ""
+"Eliminar un polígon personalitzat. Si no en queda cap, el renderitzat de "
+"polígons personalitzats es deshabilita."
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid "Paint weights with specified intensity."
-msgstr ""
+msgstr "Pinta el pes amb la intensitat especificada."
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid "Unpaint weights with specified intensity."
-msgstr ""
+msgstr "Despinta el pes amb la intensitat especificada."
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Radius:"
@@ -5728,9 +5682,8 @@ msgid "Clear UV"
msgstr "Esborra UVs"
#: editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Grid Settings"
-msgstr "Configuració del GridMap"
+msgstr "Configuració de la Quadrícula"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5743,7 +5696,7 @@ msgstr "Activa l'Alineament"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid"
-msgstr "Graella"
+msgstr "Quadrícula"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#, fuzzy
@@ -5948,9 +5901,8 @@ msgid "File"
msgstr "Fitxer"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Open..."
-msgstr "Obre"
+msgstr "Obrir..."
#: editor/plugins/script_editor_plugin.cpp
msgid "Save All"
@@ -6091,9 +6043,8 @@ msgid "Debugger"
msgstr "Depurador"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Search Results"
-msgstr "Cerca Ajuda"
+msgstr "Resultats de cerca"
#: editor/plugins/script_text_editor.cpp
msgid "Line"
@@ -6142,7 +6093,7 @@ msgstr "Converteix a Majúscules"
#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
msgid "Syntax Highlighter"
-msgstr ""
+msgstr "Ressaltador de sintaxi"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
@@ -6231,9 +6182,8 @@ msgid "Find Previous"
msgstr "Cerca l'Anterior"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Find in Files..."
-msgstr "Filtrat de Fitxers..."
+msgstr "Cercar en Fitxers..."
#: editor/plugins/script_text_editor.cpp
#, fuzzy
@@ -6285,9 +6235,8 @@ msgid "Create physical bones"
msgstr "Crea un malla de Navegació"
#: editor/plugins/skeleton_editor_plugin.cpp
-#, fuzzy
msgid "Skeleton"
-msgstr "Singleton"
+msgstr "Esquelet"
#: editor/plugins/skeleton_editor_plugin.cpp
#, fuzzy
@@ -6438,9 +6387,8 @@ msgid "This operation requires a single selected node."
msgstr "Aquesta operació requereix un únic node seleccionat."
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Lock View Rotation"
-msgstr "Mostra la Informació"
+msgstr "Bloquejar Rotació de la Vista"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Normal"
@@ -6487,9 +6435,8 @@ msgid "Doppler Enable"
msgstr "Activa Doppler"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Cinematic Preview"
-msgstr "Creant Previsualitzacions de Malles"
+msgstr "Previsualització Cinemàtica"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
@@ -6526,9 +6473,8 @@ msgid ""
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View Rotation Locked"
-msgstr "Mostra la Informació"
+msgstr "Rotació de la Vista Bloquejada"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "XForm Dialog"
@@ -6838,9 +6784,8 @@ msgid "Grow (Pixels): "
msgstr ""
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Update Preview"
-msgstr "Previsualització"
+msgstr "Actualitzar Previsualització"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Settings:"
@@ -6929,9 +6874,8 @@ msgstr "Mode Imant:"
#: editor/plugins/texture_region_editor_plugin.cpp
#: scene/resources/visual_shader.cpp
-#, fuzzy
msgid "None"
-msgstr "<Cap>"
+msgstr "Cap"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Pixel Snap"
@@ -7096,9 +7040,8 @@ msgid "Fix Invalid Tiles"
msgstr "Nom no vàlid."
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Cut Selection"
-msgstr "Centra la Selecció"
+msgstr "Tallar Selecció"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint TileMap"
@@ -7146,9 +7089,8 @@ msgid "Pick Tile"
msgstr "Tria un Tessel·la"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Copy Selection"
-msgstr "Treu la Selecció"
+msgstr "Copiar Selecció"
#: editor/plugins/tile_map_editor_plugin.cpp
#, fuzzy
@@ -7192,18 +7134,16 @@ msgid "Merge from Scene"
msgstr "Combina-ho a partir de l'Escena"
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Next Coordinate"
-msgstr "Planta Següent"
+msgstr "Coordenada Següent"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select the next shape, subtile, or Tile."
msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Previous Coordinate"
-msgstr "Planta Anterior"
+msgstr "Coordenada Anterior"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select the previous shape, subtile, or Tile."
@@ -7225,12 +7165,11 @@ msgstr "Elimina un Punt."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create a new rectangle."
-msgstr "Crear un Nou Rectangle."
+msgstr "Crear un nou rectangle."
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Create a new polygon."
-msgstr "Crea un nou Polígon del no-res."
+msgstr "Crear un nou polígon."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Keep polygon inside region Rect."
@@ -7262,9 +7201,8 @@ msgid "Merge from scene?"
msgstr "Combinar-ho a partir de l'escena?"
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Remove Texture"
-msgstr "Elimina la Plantilla"
+msgstr "Eliminar Textura"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "%s file(s) were not added because was already on the list."
@@ -7289,9 +7227,8 @@ msgid ""
msgstr "Selecciona la sub-tessel·la en edició."
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Delete polygon."
-msgstr "Elimina els Punts"
+msgstr "Eliminar Polígon."
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
@@ -7437,23 +7374,20 @@ msgid "Add Node to Visual Shader"
msgstr "Ombreig"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Duplicate Nodes"
-msgstr "Duplica els Nodes"
+msgstr "Duplicar Nodes"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Eliminar Node"
+msgstr "Eliminar Nodes"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
msgstr ""
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Vertex"
-msgstr "Vèrtexs"
+msgstr "Vèrtex"
#: editor/plugins/visual_shader_editor_plugin.cpp
#, fuzzy
@@ -7461,9 +7395,8 @@ msgid "Fragment"
msgstr "Arguments:"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Light"
-msgstr "Dreta"
+msgstr "Llum"
#: editor/plugins/visual_shader_editor_plugin.cpp
#, fuzzy
@@ -7471,9 +7404,8 @@ msgid "VisualShader"
msgstr "Ombreig"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Edit Visual Property"
-msgstr "Edita Filtres"
+msgstr "Editar Propietat Visual"
#: editor/plugins/visual_shader_editor_plugin.cpp
#, fuzzy
@@ -7493,10 +7425,13 @@ msgid "Delete preset '%s'?"
msgstr "Esborrar la configuració '%s' ?"
#: editor/project_export.cpp
+#, fuzzy
msgid ""
"Failed to export the project for platform '%s'.\n"
"Export templates seem to be missing or invalid."
msgstr ""
+"No s'ha pogut exportar el projecte per la plataforma '%s'.\n"
+"Les plantilles d'exportació semblen absents o son invalides."
#: editor/project_export.cpp
msgid ""
@@ -7518,7 +7453,7 @@ msgstr "Exportació per a %s"
#: editor/project_export.cpp
#, fuzzy
msgid "The given export path doesn't exist:"
-msgstr "El camí no existeix."
+msgstr "El camí triat per la exportació no existeix:"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing/corrupted:"
@@ -7533,9 +7468,8 @@ msgid "Add..."
msgstr "Afegeix..."
#: editor/project_export.cpp
-#, fuzzy
msgid "Export Path"
-msgstr "Exporta Projecte"
+msgstr "Camí d'exportació"
#: editor/project_export.cpp
msgid "Resources"
@@ -7630,14 +7564,12 @@ msgid "Export PCK/Zip"
msgstr "Exporta PCK/Zip"
#: editor/project_export.cpp
-#, fuzzy
msgid "Export mode?"
-msgstr "Mode d'Exportació:"
+msgstr "Mode d'Exportació?"
#: editor/project_export.cpp
-#, fuzzy
msgid "Export All"
-msgstr "Exporta"
+msgstr "Exportar Tot"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing:"
@@ -7652,10 +7584,8 @@ msgid "The path does not exist."
msgstr "El camí no existeix."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Invalid '.zip' project file, does not contain a 'project.godot' file."
-msgstr ""
-"Seleccioneu un directori que no contingui ja un fitxer 'project.godot'."
+msgstr "Fitxer de projecte '.zip' invalid, no conte un fitxer 'project.godot'."
#: editor/project_manager.cpp
msgid "Please choose an empty folder."
@@ -7664,7 +7594,7 @@ msgstr "Selecciona un directori buit."
#: editor/project_manager.cpp
#, fuzzy
msgid "Please choose a 'project.godot' or '.zip' file."
-msgstr "Selecciona un fitxer 'projecte.godot'."
+msgstr "Si us plau seleccioneu un fitxer 'projecte.godot' o '.zip'."
#: editor/project_manager.cpp
msgid "Directory already contains a Godot project."
@@ -7759,9 +7689,8 @@ msgid "Project Path:"
msgstr "Camí del Projecte:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Project Installation Path:"
-msgstr "Camí del Projecte:"
+msgstr "Camí d'instal·lació del Projecte:"
#: editor/project_manager.cpp
msgid "Browse"
@@ -7972,9 +7901,8 @@ msgid "Add Input Action Event"
msgstr "Afegeix un Incidència d'Acció de Entrada"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "All Devices"
-msgstr "Dispositiu"
+msgstr "Tots els Dispositius"
#: editor/project_settings_editor.cpp
msgid "Device"
@@ -8362,14 +8290,12 @@ msgid "Node's parent name, if available"
msgstr ""
#: editor/rename_dialog.cpp
-#, fuzzy
msgid "Node type"
-msgstr "Troba el Tipus de Node"
+msgstr "Tipus de node"
#: editor/rename_dialog.cpp
-#, fuzzy
msgid "Current scene name"
-msgstr "Escena Actual"
+msgstr "Nom de l'escena actual"
#: editor/rename_dialog.cpp
#, fuzzy
@@ -8414,9 +8340,8 @@ msgid ""
msgstr ""
#: editor/rename_dialog.cpp
-#, fuzzy
msgid "Regular Expressions"
-msgstr "Modifica l'Expressió"
+msgstr "Expressions Regulars"
#: editor/rename_dialog.cpp
#, fuzzy
@@ -8440,19 +8365,17 @@ msgid "Case"
msgstr ""
#: editor/rename_dialog.cpp
-#, fuzzy
msgid "To Lowercase"
-msgstr "Minúscula"
+msgstr "A Minúscules"
#: editor/rename_dialog.cpp
-#, fuzzy
msgid "To Uppercase"
-msgstr "Majúscules"
+msgstr "A Majúscules"
#: editor/rename_dialog.cpp
#, fuzzy
msgid "Reset"
-msgstr "Reinicia el Zoom"
+msgstr "Resetejar"
#: editor/rename_dialog.cpp
msgid "Error"
@@ -8591,24 +8514,20 @@ msgid "Make Local"
msgstr "Local"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "New Scene Root"
-msgstr "Entesos!"
+msgstr "Nova Arrel d'Escena"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Create Root Node:"
-msgstr "Crea un Node"
+msgstr "Crear Node Arrel:"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "2D Scene"
-msgstr "Escena"
+msgstr "Escena 2D"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "3D Scene"
-msgstr "Escena"
+msgstr "Escena 3D"
#: editor/scene_tree_dock.cpp
#, fuzzy
@@ -8835,18 +8754,16 @@ msgid "N/A"
msgstr "No Disponible"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Open Script/Choose Location"
-msgstr "Editor d'Scripts"
+msgstr "Obrir Script/Escollir Localització"
#: editor/script_create_dialog.cpp
msgid "Path is empty"
msgstr "El camí és Buit"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Filename is empty"
-msgstr "El camí per desar és buit!"
+msgstr "El nom del fitxer és buit"
#: editor/script_create_dialog.cpp
msgid "Path is not local"
@@ -9034,9 +8951,8 @@ msgid "Set From Tree"
msgstr "Estableix des de l'Arbre"
#: editor/settings_config_dialog.cpp
-#, fuzzy
msgid "Erase Shortcut"
-msgstr "Sortida Lenta"
+msgstr "Eliminar Drecera"
#: editor/settings_config_dialog.cpp
#, fuzzy
@@ -9044,9 +8960,8 @@ msgid "Restore Shortcut"
msgstr "Dreceres"
#: editor/settings_config_dialog.cpp
-#, fuzzy
msgid "Change Shortcut"
-msgstr "Modifica Ancoratges"
+msgstr "Canviar Drecera"
#: editor/settings_config_dialog.cpp
msgid "Shortcuts"
@@ -9347,9 +9262,8 @@ msgid "Clear Selection"
msgstr "Esborra la Selecció"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Fill Selection"
-msgstr "Tota la Selecció"
+msgstr "Omplir la Selecció"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "GridMap Settings"
@@ -9571,7 +9485,7 @@ msgstr "Afegeix un Senyal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Expression"
-msgstr "Modifica l'Expressió"
+msgstr "Canviar Expressió"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove VisualScript Nodes"
@@ -9856,13 +9770,13 @@ msgid "Invalid public key for APK expansion."
msgstr ""
#: platform/android/export/export.cpp
-#, fuzzy
msgid "Invalid package name:"
-msgstr "El Nom de Classe no és vàlid"
+msgstr "El nom del paquet no és vàlid:"
#: platform/iphone/export/export.cpp
+#, fuzzy
msgid "Identifier is missing."
-msgstr ""
+msgstr "Falta l'identificador."
#: platform/iphone/export/export.cpp
msgid "Identifier segments must be of non-zero length."
@@ -9891,9 +9805,8 @@ msgid "App Store Team ID not specified - cannot configure the project."
msgstr ""
#: platform/iphone/export/export.cpp
-#, fuzzy
msgid "Invalid Identifier:"
-msgstr "El nom no és un identificador vàlid:"
+msgstr "Identificador no vàlid:"
#: platform/iphone/export/export.cpp
msgid "Required icon is not specified in the preset."
@@ -10256,9 +10169,8 @@ msgid ""
msgstr ""
#: scene/3d/cpu_particles.cpp
-#, fuzzy
msgid "Nothing is visible because no mesh has been assigned."
-msgstr "Res és visible perquè no s'ha assignat cap Malla a cap pas de Dibuix."
+msgstr "Res és visible perquè no s'ha assignat cap malla."
#: scene/3d/cpu_particles.cpp
msgid ""
diff --git a/editor/translations/cs.po b/editor/translations/cs.po
index 63d5bea503..d8017edec7 100644
--- a/editor/translations/cs.po
+++ b/editor/translations/cs.po
@@ -164,14 +164,20 @@ msgid "Animation Playback Track"
msgstr "Stopa přehrávání animace"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Přidat stopu"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Délka animace (v sekundách)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Délka animace (v sekundách)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Přidat stopu"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Opakování animace"
diff --git a/editor/translations/da.po b/editor/translations/da.po
index ee8b415fe3..67c856fed2 100644
--- a/editor/translations/da.po
+++ b/editor/translations/da.po
@@ -164,14 +164,20 @@ msgid "Animation Playback Track"
msgstr "Animation-afspilningsspor"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Tilføj Spor"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Animations længde (i sekunder)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Animations længde (i sekunder)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Tilføj Spor"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Animationsløkke"
diff --git a/editor/translations/de.po b/editor/translations/de.po
index a9f174e98e..302f96dfa0 100644
--- a/editor/translations/de.po
+++ b/editor/translations/de.po
@@ -39,11 +39,12 @@
# Martin <martinreininger@gmx.net>, 2019.
# Andreas During <anduring@web.de>, 2019.
# Arthur S. Muszynski <artism90@gmail.com>, 2019.
+# Andreas Binczyk <andreas.binczyk@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-03-30 20:04+0000\n"
+"PO-Revision-Date: 2019-04-29 08:48+0000\n"
"Last-Translator: So Wieso <sowieso@dukun.de>\n"
"Language-Team: German <https://hosted.weblate.org/projects/godot-engine/"
"godot/de/>\n"
@@ -52,7 +53,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.6.1\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -190,14 +191,20 @@ msgid "Animation Playback Track"
msgstr "Animationsspielerspur"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Spur hinzufügen"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Animationsdauer (in Sekunden)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Animationsdauer (in Sekunden)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Spur hinzufügen"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Animationswiederholung"
@@ -452,9 +459,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Spuren nach Node gruppieren oder nacheinander anzeigen."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Einrasten"
+msgstr "Einrasten:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -462,7 +468,7 @@ msgstr "Animationsschrittwert."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Sekunden"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -3962,7 +3968,7 @@ msgstr "Animation umbenennen"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Next Changed"
-msgstr "Überblende nächste Bearbeitung"
+msgstr "Überblende nächste Änderung"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Blend Time"
@@ -4856,20 +4862,19 @@ msgstr "Layout"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Verschiebungsmaske für Schlüsselbildeingabe."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Rotationsmaske für Schlüsselbildeingabe."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Skalierungsmaske für Schlüsselbildeingabe."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Schlüsselbilder einfügen (Einfg)"
+msgstr "Schlüsselbilder einfügen (basierend auf Maske)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4878,11 +4883,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Füge automatisiert Schlüsselbilder ein wenn Objekte verschoben, rotiert oder "
+"skaliert werden (basierend auf Maske).\n"
+"Schlüsselbilder werden nur in existierende Spuren eingefügt, es werden keine "
+"neuen Spuren angelegt.\n"
+"Das erste mal müssen Schlüsselbilder manuell eingefügt werden."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Schlüsselbild einfügen"
+msgstr "Schlüsselbild automatisch einfügen"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5874,9 +5883,8 @@ msgid "Save Theme As..."
msgstr "Motiv speichern als..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " Klassenreferenz"
+msgstr "%s Klassenreferenz"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6703,24 +6711,20 @@ msgid "Nameless gizmo"
msgstr "Namenloser Anfasser"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "2D-Mesh erzeugen"
+msgstr "Mesh2D erzeugen"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Polygon3D erstellen"
+msgstr "Polygon2D erzeugen"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Kollisionspolygon erzeugen"
+msgstr "CollisionPolygon2D erzeugen"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Occluder-Polygon erzeugen"
+msgstr "LightOccluder2D erzeugen"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6737,43 +6741,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Ungültige Geometrie, Mesh kann nicht ersetzt werden."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Ungültige Geometrie, Mesh kann nicht ersetzt werden."
+msgstr "Ungültige Geometrie, Polygon kann nicht erzeugt werden."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Ungültige Geometrie, Mesh kann nicht ersetzt werden."
+msgstr "Ungültige Geometrie, Kollisionspolygon kann nicht erzeugt werden."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Ungültige Geometrie, Mesh kann nicht ersetzt werden."
+msgstr "Ungültige Geometrie, Light-Occluder kann nicht erzeugt werden."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Zu 2D-Mesh umwandeln"
+msgstr "Zu Mesh2D umwandeln"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Polygon verschieben"
+msgstr "Zu Polygon2D umwandeln"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Kollisionspolygon erzeugen"
+msgstr "CollisionPolygon2D-Nachbarn erzeugen"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Occluder-Polygon erzeugen"
+msgstr "LightOccluder2D erzeugen"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7361,9 +7358,8 @@ msgid "Duplicate Nodes"
msgstr "Nodes duplizieren"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Node löschen"
+msgstr "Nodes löschen"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/de_CH.po b/editor/translations/de_CH.po
index cf2e88000d..9be73f30db 100644
--- a/editor/translations/de_CH.po
+++ b/editor/translations/de_CH.po
@@ -162,11 +162,17 @@ msgid "Animation Playback Track"
msgstr "Stoppe Animations-Wiedergabe. (S)"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr ""
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Animations-Node"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
+msgstr "Animations-Node"
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot
index f9408cfbbc..d38ce1af81 100644
--- a/editor/translations/editor.pot
+++ b/editor/translations/editor.pot
@@ -146,11 +146,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
@@ -9860,7 +9864,7 @@ msgstr ""
msgid ""
"Container by itself serves no purpose unless a script configures it's "
"children placement behavior.\n"
-"If you dont't intend to add a script, then please use a plain 'Control' node "
+"If you don't intend to add a script, then please use a plain 'Control' node "
"instead."
msgstr ""
diff --git a/editor/translations/el.po b/editor/translations/el.po
index b6cf0f79dc..0910fbd089 100644
--- a/editor/translations/el.po
+++ b/editor/translations/el.po
@@ -157,14 +157,20 @@ msgid "Animation Playback Track"
msgstr "Κομμάτι αναπαÏαγωγής κίνησης"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "ΠÏοσθήκη κομματιοÏ"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Μήκος κίνησης (δευτεÏόλεπτα)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Μήκος κίνησης (δευτεÏόλεπτα)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "ΠÏοσθήκη κομματιοÏ"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Επανάληψη κίνησης"
diff --git a/editor/translations/eo.po b/editor/translations/eo.po
new file mode 100644
index 0000000000..2fe387b131
--- /dev/null
+++ b/editor/translations/eo.po
@@ -0,0 +1,9952 @@
+# Esperanto translation of the Godot Engine editor
+# Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur.
+# Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)
+# This file is distributed under the same license as the Godot source code.
+msgid ""
+msgstr ""
+"Project-Id-Version: Godot Engine editor\n"
+"Language-Team: Esperanto <https://hosted.weblate.org/projects/godot-engine/"
+"godot/eo/>\n"
+"Language: eo\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8-bit\n"
+
+#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
+#: modules/visual_script/visual_script_builtin_funcs.cpp
+msgid "Invalid type argument to convert(), use TYPE_* constants."
+msgstr ""
+
+#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
+#: modules/mono/glue/gd_glue.cpp
+#: modules/visual_script/visual_script_builtin_funcs.cpp
+msgid "Not enough bytes for decoding bytes, or invalid format."
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "Invalid input %i (not passed) in expression"
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "self can't be used because instance is null (not passed)"
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "Invalid operands to operator %s, %s and %s."
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "Invalid index of type %s for base type %s"
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "Invalid named index '%s' for base type %s"
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "Invalid arguments to construct '%s'"
+msgstr ""
+
+#: core/math/expression.cpp
+msgid "On call to '%s':"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Free"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Balanced"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Mirror"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Insert Key Here"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Duplicate Selected Key(s)"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Delete Selected Key(s)"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Add Bezier Point"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp
+msgid "Move Bezier Points"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp editor/animation_track_editor.cpp
+msgid "Anim Duplicate Keys"
+msgstr ""
+
+#: editor/animation_bezier_editor.cpp editor/animation_track_editor.cpp
+msgid "Anim Delete Keys"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Change Keyframe Time"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Change Transition"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Change Transform"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Change Keyframe Value"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Change Call"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Change Animation Length"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Change Animation Loop"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Property Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "3D Transform Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Call Method Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Bezier Curve Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Audio Playback Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation Playback Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation length (frames)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation Looping"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Functions:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Audio Clips:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Clips:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Change Track Path"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Toggle this track on/off."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Update Mode (How this property is set)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Interpolation Mode"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Loop Wrap Mode (Interpolate end with beginning on loop)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Remove this track."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Time (s): "
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Toggle Track Enabled"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Continuous"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Discrete"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Trigger"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Capture"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Nearest"
+msgstr ""
+
+#: editor/animation_track_editor.cpp editor/plugins/curve_editor_plugin.cpp
+#: editor/property_editor.cpp
+msgid "Linear"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Cubic"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Clamp Loop Interp"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Wrap Loop Interp"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Duplicate Key(s)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Delete Key(s)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Change Animation Update Mode"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Change Animation Interpolation Mode"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Change Animation Loop Mode"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Remove Anim Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Create NEW track for %s and insert key?"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Create %d NEW tracks and insert keys?"
+msgstr ""
+
+#: editor/animation_track_editor.cpp editor/create_dialog.cpp
+#: editor/editor_audio_buses.cpp editor/editor_plugin_settings.cpp
+#: editor/plugin_config_dialog.cpp
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp editor/script_create_dialog.cpp
+msgid "Create"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Insert"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "AnimationPlayer can't animate itself, only other players."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Create & Insert"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Insert Track & Key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Insert Key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Change Animation Step"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Rearrange Tracks"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Transform tracks only apply to Spatial-based nodes."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid ""
+"Audio tracks can only point to nodes of type:\n"
+"-AudioStreamPlayer\n"
+"-AudioStreamPlayer2D\n"
+"-AudioStreamPlayer3D"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation tracks can only point to AnimationPlayer nodes."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "An animation player can't animate itself, only other players."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Not possible to add a new track without a root"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Bezier Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Track path is invalid, so can't add a key."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Track is not of type Spatial, can't insert key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Transform Track Key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track Key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Track path is invalid, so can't add a method key."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Method Track Key"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Method not found in object: "
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Move Keys"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Clipboard is empty"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Paste Tracks"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim Scale Keys"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid ""
+"This option does not work for Bezier editing, as it's only a single track."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Only show tracks from nodes selected in tree."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Group tracks by node or display them as plain list."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Snap:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation step value."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Seconds"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "FPS"
+msgstr ""
+
+#: editor/animation_track_editor.cpp editor/editor_properties.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/shader_editor_plugin.cpp editor/plugins/text_editor.cpp
+#: editor/project_manager.cpp editor/project_settings_editor.cpp
+#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Edit"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Animation properties."
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Copy Tracks"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Scale Selection"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Scale From Cursor"
+msgstr ""
+
+#: editor/animation_track_editor.cpp modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Duplicate Selection"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Duplicate Transposed"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Delete Selection"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Go to Next Step"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Go to Previous Step"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Optimize Animation"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Clean-Up Animation"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Pick the node that will be animated:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Use Bezier Curves"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Anim. Optimizer"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Max. Linear Error:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Max. Angular Error:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Max Optimizable Angle:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Optimize"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Remove invalid keys"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Remove unresolved and empty tracks"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Clean-up all animations"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Clean-Up Animation(s) (NO UNDO!)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Clean-Up"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Scale Ratio:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Select tracks to copy:"
+msgstr ""
+
+#: editor/animation_track_editor.cpp editor/editor_properties.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Copy"
+msgstr ""
+
+#: editor/animation_track_editor_plugins.cpp
+msgid "Add Audio Track Clip"
+msgstr ""
+
+#: editor/animation_track_editor_plugins.cpp
+msgid "Change Audio Track Clip Start Offset"
+msgstr ""
+
+#: editor/animation_track_editor_plugins.cpp
+msgid "Change Audio Track Clip End Offset"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Resize Array"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Change Array Value Type"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Change Array Value"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Go to Line"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Line Number:"
+msgstr ""
+
+#: editor/code_editor.cpp editor/editor_help.cpp
+msgid "No Matches"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replaced %d occurrence(s)."
+msgstr ""
+
+#: editor/code_editor.cpp editor/find_in_files.cpp
+msgid "Match Case"
+msgstr ""
+
+#: editor/code_editor.cpp editor/find_in_files.cpp
+msgid "Whole Words"
+msgstr ""
+
+#: editor/code_editor.cpp editor/rename_dialog.cpp
+msgid "Replace"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replace All"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Selection Only"
+msgstr ""
+
+#: editor/code_editor.cpp editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp scene/gui/graph_edit.cpp
+msgid "Zoom In"
+msgstr ""
+
+#: editor/code_editor.cpp editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp scene/gui/graph_edit.cpp
+msgid "Zoom Out"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Reset Zoom"
+msgstr ""
+
+#: editor/code_editor.cpp modules/mono/editor/mono_bottom_panel.cpp
+msgid "Warnings"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Line and column numbers."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Method in target Node must be specified!"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid ""
+"Target method not found! Specify a valid method or attach a script to target "
+"Node."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect To Node:"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
+#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
+msgid "Add"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/dependency_editor.cpp
+#: editor/groups_editor.cpp editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_manager.cpp
+#: editor/project_settings_editor.cpp
+msgid "Remove"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Add Extra Call Argument:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Extra Call Arguments:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Path to Node:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Make Function"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Deferred"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Oneshot"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/dependency_editor.cpp
+#: editor/export_template_manager.cpp editor/groups_editor.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/project_export.cpp
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+#: editor/run_settings_dialog.cpp editor/settings_config_dialog.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Close"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect '%s' to '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Disconnect '%s' from '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Disconnect all from signal: '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect..."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Disconnect"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect Signal: "
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Edit Connection: "
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Are you sure you want to remove all connections from the \"%s\" signal?"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
+msgid "Signals"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Are you sure you want to remove all connections from this signal?"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Disconnect All"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Edit..."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Go To Method"
+msgstr ""
+
+#: editor/create_dialog.cpp
+msgid "Change %s Type"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/project_settings_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change"
+msgstr ""
+
+#: editor/create_dialog.cpp
+msgid "Create New %s"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp
+msgid "Favorites:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
+msgid "Recent:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+#: editor/property_selector.cpp editor/quick_open.cpp
+#: modules/visual_script/visual_script_property_selector.cpp
+msgid "Search:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/plugins/script_editor_plugin.cpp
+#: editor/property_selector.cpp editor/quick_open.cpp
+#: modules/visual_script/visual_script_property_selector.cpp
+msgid "Matches:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/plugin_config_dialog.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp editor/property_selector.cpp
+#: modules/visual_script/visual_script_property_selector.cpp
+msgid "Description:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Search Replacement For:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependencies For:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"Scene '%s' is currently being edited.\n"
+"Changes will not take effect unless reloaded."
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"Resource '%s' is in use.\n"
+"Changes will take effect when reloaded."
+msgstr ""
+
+#: editor/dependency_editor.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Dependencies"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Resource"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
+#: editor/project_settings_editor.cpp editor/script_create_dialog.cpp
+msgid "Path"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependencies:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Fix Broken"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependency Editor"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Search Replacement Resource:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_file_dialog.cpp
+#: editor/editor_help_search.cpp editor/editor_node.cpp
+#: editor/filesystem_dock.cpp editor/plugins/script_editor_plugin.cpp
+#: editor/property_selector.cpp editor/quick_open.cpp
+#: editor/script_create_dialog.cpp
+#: modules/visual_script/visual_script_property_selector.cpp
+#: scene/gui/file_dialog.cpp
+msgid "Open"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Owners Of:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Remove selected files from the project? (no undo)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"The files being removed are required by other resources in order for them to "
+"work.\n"
+"Remove them anyway? (no undo)"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/export_template_manager.cpp
+msgid "Cannot remove:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Error loading:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Load failed due to missing dependencies:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_node.cpp
+msgid "Open Anyway"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Which action should be taken?"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Fix Dependencies"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Errors loading!"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Permanently delete %d item(s)? (No undo!)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Owns"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Resources Without Explicit Ownership:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_node.cpp
+msgid "Orphan Resource Explorer"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Delete selected files?"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_audio_buses.cpp
+#: editor/editor_file_dialog.cpp editor/editor_node.cpp
+#: editor/filesystem_dock.cpp editor/plugins/item_list_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/project_export.cpp
+#: editor/project_settings_editor.cpp editor/scene_tree_dock.cpp
+msgid "Delete"
+msgstr ""
+
+#: editor/dictionary_property_edit.cpp
+msgid "Change Dictionary Key"
+msgstr ""
+
+#: editor/dictionary_property_edit.cpp
+msgid "Change Dictionary Value"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thanks from the Godot community!"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Godot Engine contributors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Project Founders"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Lead Developer"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Project Manager "
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Developers"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Authors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Platinum Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Gold Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Mini Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Gold Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Silver Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Bronze Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "License"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thirdparty License"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid ""
+"Godot Engine relies on a number of thirdparty free and open source "
+"libraries, all compatible with the terms of its MIT license. The following "
+"is an exhaustive list of all such thirdparty components with their "
+"respective copyright statements and license terms."
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "All Components"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Components"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Licenses"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp editor/project_manager.cpp
+msgid "Error opening package file, not in zip format."
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+msgid "Uncompressing Assets"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp editor/project_manager.cpp
+msgid "Package installed successfully!"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Success!"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Install"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+msgid "Package Installer"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Speakers"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Rename Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Change Audio Bus Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Solo"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Mute"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Bypass Effects"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Select Audio Bus Send"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Audio Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Move Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Audio Bus, Drag and Drop to rearrange."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Solo"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Mute"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Bypass"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Bus options"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/filesystem_dock.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Duplicate"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Reset Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Audio"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Master bus can't be deleted!"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Duplicate Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Reset Bus Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Move Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save Audio Bus Layout As..."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Location for New Layout..."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Open Audio Bus Layout"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "There is no 'res://default_bus_layout.tres' file."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Invalid file, not an audio bus layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add a new Audio Bus to this layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/editor_properties.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp editor/property_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Load"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Load an existing Bus Layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save As"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save this Bus Layout to a file."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/import_dock.cpp
+msgid "Load Default"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Load the default Bus Layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Create a new Bus Layout."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Valid characters:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing engine class name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing buit-in type name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing global constant name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Autoload '%s' already exists!"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Rename Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Toggle AutoLoad Globals"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Move Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Remove Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Enable"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Rearrange Autoloads"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid Path."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "File does not exist."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Not in resource path."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Add AutoLoad"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
+#: editor/plugins/animation_tree_editor_plugin.cpp scene/gui/file_dialog.cpp
+msgid "Path:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Node Name:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp editor/editor_help_search.cpp
+#: editor/editor_profiler.cpp editor/settings_config_dialog.cpp
+msgid "Name"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Singleton"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Updating Scene"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Storing local changes..."
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Updating scene..."
+msgstr ""
+
+#: editor/editor_data.cpp editor/editor_properties.cpp
+msgid "[empty]"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "[unsaved]"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Please select a base directory first"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Choose a Directory"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
+msgid "Create Folder"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
+#: scene/gui/file_dialog.cpp
+msgid "Name:"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
+msgid "Could not create folder."
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Choose"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "Storing File:"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "No export template found at the expected path:"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "Packing"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid ""
+"Target platform requires 'ETC' texture compression for GLES2. Enable 'Import "
+"Etc' in Project Settings."
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid ""
+"Target platform requires 'ETC2' texture compression for GLES3. Enable "
+"'Import Etc 2' in Project Settings."
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid ""
+"Target platform requires 'ETC' texture compression for the driver fallback "
+"to GLES2.\n"
+"Enable 'Import Etc' in Project Settings, or disable 'Driver Fallback "
+"Enabled'."
+msgstr ""
+
+#: editor/editor_export.cpp platform/android/export/export.cpp
+#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
+#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
+msgid "Custom debug template not found."
+msgstr ""
+
+#: editor/editor_export.cpp platform/android/export/export.cpp
+#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
+#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
+msgid "Custom release template not found."
+msgstr ""
+
+#: editor/editor_export.cpp platform/javascript/export/export.cpp
+msgid "Template file not found:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Select Current Folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "File Exists, Overwrite?"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Select This Folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "Copy Path"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "Open in File Manager"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+#: editor/project_manager.cpp
+msgid "Show in File Manager"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "New Folder..."
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Refresh"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "All Recognized"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "All Files (*)"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a File"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open File(s)"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a Directory"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a File or Directory"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/editor_node.cpp
+#: editor/editor_properties.cpp editor/inspector_dock.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp scene/gui/file_dialog.cpp
+msgid "Save"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Save a File"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Back"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Forward"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Up"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Hidden Files"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Favorite"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Mode"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Focus Path"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Move Favorite Up"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Move Favorite Down"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Previous Folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Next Folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go to parent folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "(Un)favorite current folder."
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "View items as a grid of thumbnails."
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "View items as a list."
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Directories & Files:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/plugins/sprite_editor_plugin.cpp
+#: editor/plugins/style_box_editor_plugin.cpp
+msgid "Preview:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "File:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Must use a valid extension."
+msgstr ""
+
+#: editor/editor_file_system.cpp
+msgid "ScanSources"
+msgstr ""
+
+#: editor/editor_file_system.cpp
+msgid "(Re)Importing Assets"
+msgstr ""
+
+#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
+msgid "Top"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Class:"
+msgstr ""
+
+#: editor/editor_help.cpp editor/scene_tree_editor.cpp
+msgid "Inherits:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Inherited by:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Brief Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Properties"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Properties:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Methods"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Methods:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Theme Properties"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Theme Properties:"
+msgstr ""
+
+#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Signals:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Enumerations"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Enumerations:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "enum "
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Constants"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Constants:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Class Description"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Class Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Online Tutorials:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There are currently no tutorials for this class, you can [color=$color][url="
+"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
+"url][/color]."
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Property Descriptions"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Property Descriptions:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There is currently no description for this property. Please help us by "
+"[color=$color][url=$url]contributing one[/url][/color]!"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Method Descriptions"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Method Descriptions:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There is currently no description for this method. Please help us by [color="
+"$color][url=$url]contributing one[/url][/color]!"
+msgstr ""
+
+#: editor/editor_help_search.cpp editor/editor_node.cpp
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search Help"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Display All"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Classes Only"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Methods Only"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Signals Only"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Constants Only"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Properties Only"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Theme Properties Only"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Member Type"
+msgstr ""
+
+#: editor/editor_help_search.cpp
+msgid "Class"
+msgstr ""
+
+#: editor/editor_inspector.cpp editor/project_settings_editor.cpp
+msgid "Property:"
+msgstr ""
+
+#: editor/editor_inspector.cpp
+msgid "Set"
+msgstr ""
+
+#: editor/editor_inspector.cpp
+msgid "Set Multiple:"
+msgstr ""
+
+#: editor/editor_log.cpp
+msgid "Output:"
+msgstr ""
+
+#: editor/editor_log.cpp editor/editor_profiler.cpp
+#: editor/editor_properties.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+#: editor/property_editor.cpp editor/scene_tree_dock.cpp
+#: editor/script_editor_debugger.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Clear"
+msgstr ""
+
+#: editor/editor_log.cpp
+msgid "Clear Output"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Imported resources can't be saved."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+#: scene/gui/dialogs.cpp
+msgid "OK"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Error saving resource!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource can't be saved because it does not belong to the edited scene. "
+"Make it unique first."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save Resource As..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't open file for writing:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Requested file format unknown:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while saving."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Can't open '%s'. The file could have been moved or deleted."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while parsing '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unexpected end of file '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Missing '%s' or its dependencies."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while loading '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Saving Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Analyzing"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Creating Thumbnail"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a tree root."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This scene can't be saved because there is a cyclic instancing inclusion.\n"
+"Please resolve it and then attempt to save again."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
+"be satisfied."
+msgstr ""
+
+#: editor/editor_node.cpp editor/scene_tree_dock.cpp
+msgid "Can't overwrite scene that is still open!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't load MeshLibrary for merging!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error saving MeshLibrary!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't load TileSet for merging!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error saving TileSet!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error trying to save layout!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Default editor layout overridden."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Layout name not found!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Restored default layout to base settings."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource belongs to a scene that was imported, so it's not editable.\n"
+"Please read the documentation relevant to importing scenes to better "
+"understand this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource belongs to a scene that was instanced or inherited.\n"
+"Changes to it will not be kept when saving the current scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource was imported, so it's not editable. Change its settings in the "
+"import panel and then re-import."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This scene was imported, so changes to it will not be kept.\n"
+"Instancing it or inheriting will allow making changes to it.\n"
+"Please read the documentation relevant to importing scenes to better "
+"understand this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This is a remote object so changes to it will not be kept.\n"
+"Please read the documentation relevant to debugging to better understand "
+"this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "There is no defined scene to run."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"No main scene has ever been defined, select one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Selected scene '%s' does not exist, select a valid one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Selected scene '%s' is not a scene file, select a valid one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Current scene was never saved, please save it prior to running."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Could not start subprocess!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Base Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Open Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Open Script..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save & Close"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes to '%s' before closing?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Saved %s modified resource(s)."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "A root node is required to save the scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Scene As..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "No"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Yes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This scene has never been saved. Save before running?"
+msgstr ""
+
+#: editor/editor_node.cpp editor/scene_tree_dock.cpp
+msgid "This operation can't be done without a scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Mesh Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a root node."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Tile Set"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a selected node."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Current scene not saved. Open anyway?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't reload a scene that was never saved."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Revert"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This action cannot be undone. Revert anyway?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Run Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quit"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Exit the editor?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Project Manager?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save & Quit"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes to the following scene(s) before quitting?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes the following scene(s) before opening Project Manager?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This option is deprecated. Situations where refresh must be forced are now "
+"considered a bug. Please report."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pick a Main Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to load addon script from path: '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Unable to load addon script from path: '%s' There seems to be an error in "
+"the code, please check the syntax."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Unable to load addon script from path: '%s' Base type is not EditorPlugin."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Scene '%s' was automatically imported, so it can't be modified.\n"
+"To make changes to it, a new inherited scene can be created."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Error loading scene, it must be inside the project path. Use 'Import' to "
+"open the scene, then save it inside the project path."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Scene '%s' has broken dependencies:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Clear Recent Scenes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Layout"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Delete Layout"
+msgstr ""
+
+#: editor/editor_node.cpp editor/import_dock.cpp
+#: editor/script_create_dialog.cpp
+msgid "Default"
+msgstr ""
+
+#: editor/editor_node.cpp editor/editor_properties.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_editor.cpp
+msgid "Show in FileSystem"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play This Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Close Tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Switch Scene Tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more files or folders"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more folders"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more files"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Dock Position"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Distraction Free Mode"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Toggle distraction-free mode."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Add a new scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to previously opened scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Next tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Previous tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Filter Files..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Operations with scene files."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Inherited Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save All Scenes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Close Scene"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Open Recent"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Convert To..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "MeshLibrary..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "TileSet..."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Undo"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Redo"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Revert Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Miscellaneous project or scene-wide tools."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project Settings"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Export"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/tile_set_editor_plugin.cpp
+msgid "Tools"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Project Data Folder"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quit to Project List"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+#: editor/project_export.cpp
+msgid "Debug"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Deploy with Remote Debug"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When exporting or deploying, the resulting executable will attempt to "
+"connect to the IP of this computer in order to be debugged."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Small Deploy with Network FS"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is enabled, export or deploy will produce a minimal "
+"executable.\n"
+"The filesystem will be provided from the project by the editor over the "
+"network.\n"
+"On Android, deploy will use the USB cable for faster performance. This "
+"option speeds up testing for games with a large footprint."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Visible Collision Shapes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
+"running game if this option is turned on."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Visible Navigation"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Navigation meshes and polygons will be visible on the running game if this "
+"option is turned on."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Sync Scene Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is turned on, any changes made to the scene in the editor "
+"will be replicated in the running game.\n"
+"When used remotely on a device, this is more efficient with network "
+"filesystem."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Sync Script Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is turned on, any script that is saved will be reloaded on "
+"the running game.\n"
+"When used remotely on a device, this is more efficient with network "
+"filesystem."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Editor"
+msgstr ""
+
+#: editor/editor_node.cpp editor/settings_config_dialog.cpp
+msgid "Editor Settings"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Editor Layout"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Toggle Fullscreen"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Editor Data/Settings Folder"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Editor Data Folder"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Editor Settings Folder"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Manage Export Templates"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Help"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/shader_editor_plugin.cpp editor/plugins/text_editor.cpp
+#: editor/project_settings_editor.cpp editor/rename_dialog.cpp
+msgid "Search"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Online Docs"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Q&A"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Issue Tracker"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+msgid "Community"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "About"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play the project."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pause the scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pause Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Stop the scene."
+msgstr ""
+
+#: editor/editor_node.cpp editor/editor_profiler.cpp
+msgid "Stop"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play the edited scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play custom scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play Custom Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Changing the video driver requires restarting the editor."
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_settings_editor.cpp
+#: editor/settings_config_dialog.cpp
+msgid "Save & Restart"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Spins when the editor window redraws."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Update Always"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Update Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Disable Update Spinner"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_manager.cpp
+msgid "Import"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "FileSystem"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Inspector"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Node"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Expand Bottom Panel"
+msgstr ""
+
+#: editor/editor_node.cpp scene/resources/visual_shader.cpp
+msgid "Output"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Don't Save"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Import Templates From ZIP File"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Export Project"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Merge With Existing"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Password:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open & Run a Script"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Inherited"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Load Errors"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
+msgid "Select"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open 2D Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open 3D Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Script Editor"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_manager.cpp
+msgid "Open Asset Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open the next Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open the previous Editor"
+msgstr ""
+
+#: editor/editor_plugin.cpp
+msgid "Creating Mesh Previews"
+msgstr ""
+
+#: editor/editor_plugin.cpp
+msgid "Thumbnail..."
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Edit Plugin"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Installed Plugins:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp editor/plugin_config_dialog.cpp
+msgid "Update"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp editor/plugin_config_dialog.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Version:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp editor/plugin_config_dialog.cpp
+msgid "Author:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Status:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Edit:"
+msgstr ""
+
+#: editor/editor_profiler.cpp editor/plugins/animation_state_machine_editor.cpp
+#: editor/rename_dialog.cpp
+msgid "Start"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Measure:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame Time (sec)"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Average Time (sec)"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame %"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Physics Frame %"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Time:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Inclusive"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Self"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame #:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Time"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Calls"
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid "On"
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid "Layer"
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid "Bit %d, value %d"
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid "[Empty]"
+msgstr ""
+
+#: editor/editor_properties.cpp editor/plugins/root_motion_editor_plugin.cpp
+msgid "Assign..."
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid "Invalid RID"
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid ""
+"The selected resource (%s) does not match any type expected for this "
+"property (%s)."
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid ""
+"Can't create a ViewportTexture on resources saved as a file.\n"
+"Resource needs to belong to a scene."
+msgstr ""
+
+#: editor/editor_properties.cpp
+msgid ""
+"Can't create a ViewportTexture on this resource because it's not set as "
+"local to scene.\n"
+"Please switch on the 'local to scene' property on it (and all resources "
+"containing it up to a node)."
+msgstr ""
+
+#: editor/editor_properties.cpp editor/property_editor.cpp
+msgid "Pick a Viewport"
+msgstr ""
+
+#: editor/editor_properties.cpp editor/property_editor.cpp
+msgid "New Script"
+msgstr ""
+
+#: editor/editor_properties.cpp editor/property_editor.cpp
+msgid "New %s"
+msgstr ""
+
+#: editor/editor_properties.cpp editor/property_editor.cpp
+msgid "Make Unique"
+msgstr ""
+
+#: editor/editor_properties.cpp
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+#: editor/plugins/tile_map_editor_plugin.cpp editor/property_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Paste"
+msgstr ""
+
+#: editor/editor_properties.cpp editor/property_editor.cpp
+msgid "Convert To %s"
+msgstr ""
+
+#: editor/editor_properties.cpp
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Open Editor"
+msgstr ""
+
+#: editor/editor_properties.cpp editor/property_editor.cpp
+msgid "Selected node is not a Viewport!"
+msgstr ""
+
+#: editor/editor_properties_array_dict.cpp
+msgid "Size: "
+msgstr ""
+
+#: editor/editor_properties_array_dict.cpp
+msgid "Page: "
+msgstr ""
+
+#: editor/editor_properties_array_dict.cpp
+msgid "New Key:"
+msgstr ""
+
+#: editor/editor_properties_array_dict.cpp
+msgid "New Value:"
+msgstr ""
+
+#: editor/editor_properties_array_dict.cpp
+msgid "Add Key/Value Pair"
+msgstr ""
+
+#: editor/editor_properties_array_dict.cpp
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove Item"
+msgstr ""
+
+#: editor/editor_run_native.cpp
+msgid "Select device from the list"
+msgstr ""
+
+#: editor/editor_run_native.cpp
+msgid ""
+"No runnable export preset found for this platform.\n"
+"Please add a runnable preset in the export menu."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Write your logic in the _run() method."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "There is an edited scene already."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Couldn't instance script:"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Did you forget the 'tool' keyword?"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Couldn't run script:"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Did you forget the '_run' method?"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Select Node(s) to Import"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Scene Path:"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Import From Node:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Re-Download"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Uninstall"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Installed)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Missing)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Current)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Retrieving mirrors, please wait..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Remove template version '%s'?"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't open export templates zip."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Invalid version.txt format inside templates: %s."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "No version.txt found inside templates."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Error creating path for templates:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Extracting Export Templates"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Importing:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid ""
+"No download links found for this version. Direct download is only available "
+"for official releases."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't resolve."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't connect."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "No response."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request Failed."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Redirect Loop."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Failed:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download Complete."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid ""
+"Templates installation failed. The problematic templates archives can be "
+"found at '%s'."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Error requesting url: "
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connecting to Mirror..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Disconnected"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Resolving"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't Resolve"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Connecting..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't Connect"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connected"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Requesting..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Downloading"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connection Error"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "SSL Handshake Error"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Current Version:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Installed Versions:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Install From File"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Remove Template"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Select template file"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Export Template Manager"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download Templates"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Select mirror from list: (Shift+Click: Open in Browser)"
+msgstr ""
+
+#: editor/file_type_cache.cpp
+msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Favorites"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot navigate to '%s' as it has not been found in the file system!"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Status: Import of file failed. Please fix file and reimport manually."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot move/rename resources root."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot move a folder into itself."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Error moving:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Error duplicating:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Unable to update dependencies:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/scene_tree_editor.cpp
+msgid "No name provided."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Provided name contains invalid characters"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Name contains invalid characters."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "A file or folder with this name already exists."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Renaming file:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Renaming folder:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicating file:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicating folder:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Open Scene(s)"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Instance"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Add to favorites"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Remove from favorites"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Edit Dependencies..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View Owners..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Rename..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicate..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Move To..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/plugins/script_editor_plugin.cpp
+msgid "New Script..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "New Resource..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/script_editor_debugger.cpp
+msgid "Expand All"
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/script_editor_debugger.cpp
+msgid "Collapse All"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+#: editor/project_manager.cpp editor/rename_dialog.cpp
+#: editor/scene_tree_dock.cpp
+msgid "Rename"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Previous Directory"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Next Directory"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Re-Scan Filesystem"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Toggle split mode"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Search files"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid ""
+"Scanning Files,\n"
+"Please Wait..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Move"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "There is already file or folder with the same name in this location."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Overwrite"
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Create Script"
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Find in Files"
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Find:"
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Folder:"
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Filters:"
+msgstr ""
+
+#: editor/find_in_files.cpp editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+msgid "Find..."
+msgstr ""
+
+#: editor/find_in_files.cpp editor/plugins/script_text_editor.cpp
+msgid "Replace..."
+msgstr ""
+
+#: editor/find_in_files.cpp editor/progress_dialog.cpp scene/gui/dialogs.cpp
+msgid "Cancel"
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Find: "
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Replace: "
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Replace all (no undo)"
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Searching..."
+msgstr ""
+
+#: editor/find_in_files.cpp
+msgid "Search complete"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Group name already exists."
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Invalid group name."
+msgstr ""
+
+#: editor/groups_editor.cpp editor/node_dock.cpp
+msgid "Groups"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Nodes not in Group"
+msgstr ""
+
+#: editor/groups_editor.cpp editor/scene_tree_dock.cpp
+msgid "Filter nodes"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Nodes in Group"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Add to Group"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Remove from Group"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Manage Groups"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Single Scene"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Materials+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Materials+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Multiple Scenes"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Multiple Scenes+Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+#: editor/plugins/mesh_library_editor_plugin.cpp
+msgid "Import Scene"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Importing Scene..."
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Generating Lightmaps"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Generating for Mesh: "
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Running Custom Script..."
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Couldn't load post-import script:"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Invalid/broken script for post-import (check console):"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Error running post-import script:"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Saving..."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Set as Default for '%s'"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Clear Default for '%s'"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid " Files"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Import As:"
+msgstr ""
+
+#: editor/import_dock.cpp editor/property_editor.cpp
+msgid "Preset..."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Reimport"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Save scenes, re-import and restart"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Changing the type of an imported file requires editor restart."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid ""
+"WARNING: Assets exist that use this resource, they may stop loading properly."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Failed to load resource."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Expand All Properties"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Collapse All Properties"
+msgstr ""
+
+#: editor/inspector_dock.cpp editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save As..."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Copy Params"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Paste Params"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Edit Resource Clipboard"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Copy Resource"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Make Built-In"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Make Sub-Resources Unique"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Open in Help"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Create a new resource in memory and edit it."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Load an existing resource from disk and edit it."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Save the currently edited resource."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Go to the previous edited object in history."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Go to the next edited object in history."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "History of recently edited objects."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Object properties."
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Filter properties"
+msgstr ""
+
+#: editor/inspector_dock.cpp
+msgid "Changes may be lost!"
+msgstr ""
+
+#: editor/multi_node_edit.cpp
+msgid "MultiNode Set"
+msgstr ""
+
+#: editor/node_dock.cpp
+msgid "Select a Node to edit Signals and Groups."
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Edit a Plugin"
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Create a Plugin"
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Plugin Name:"
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Subfolder:"
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Language:"
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Script Name:"
+msgstr ""
+
+#: editor/plugin_config_dialog.cpp
+msgid "Activate now?"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create Polygon"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Create points."
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid ""
+"Edit points.\n"
+"LMB: Move Point\n"
+"RMB: Erase Point"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+msgid "Erase points."
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Edit Polygon"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Insert Point"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Edit Polygon (Remove Point)"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Remove Polygon And Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Animation"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Load..."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Move Node Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+msgid "Change BlendSpace1D Limits"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+msgid "Change BlendSpace1D Labels"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "This type of node can't be used. Only root nodes are allowed."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Add Node Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Add Animation Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+msgid "Remove BlendSpace1D Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+msgid "Move BlendSpace1D Node Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid ""
+"AnimationTree is inactive.\n"
+"Activate to enable playback, check node warnings if activation fails."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Set the blending position within the space"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Select and move points, create points with RMB."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp scene/gui/graph_edit.cpp
+msgid "Enable snap and show grid."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_1d_editor.cpp
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Open Animation Node"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Triangle already exists"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Add Triangle"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Change BlendSpace2D Limits"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Change BlendSpace2D Labels"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Remove BlendSpace2D Point"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Remove BlendSpace2D Triangle"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "BlendSpace2D does not belong to an AnimationTree node."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "No triangles exist, so no blending can take place."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Toggle Auto Triangles"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Create triangles by connecting points."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Erase points and triangles."
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+msgid "Generate blend triangles automatically (instead of manually)"
+msgstr ""
+
+#: editor/plugins/animation_blend_space_2d_editor.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend:"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Parameter Changed"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Edit Filters"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Output node can't be added to the blend tree."
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Add Node to BlendTree"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Node Moved"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Unable to connect, port may be in use or connection may be invalid."
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Nodes Connected"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Nodes Disconnected"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Set Animation"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Delete Node"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/scene_tree_dock.cpp
+msgid "Delete Node(s)"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Toggle Filter On/Off"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Change Filter"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "No animation player set, so unable to retrieve track names."
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Player path set is invalid, so unable to retrieve track names."
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/root_motion_editor_plugin.cpp
+msgid ""
+"Animation player has no valid root node path, so unable to retrieve track "
+"names."
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Node Renamed"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Add Node..."
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+#: editor/plugins/root_motion_editor_plugin.cpp
+msgid "Edit Filtered Tracks:"
+msgstr ""
+
+#: editor/plugins/animation_blend_tree_editor_plugin.cpp
+msgid "Enable filtering"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Toggle Autoplay"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New Anim"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Change Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Delete Animation?"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Remove Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Invalid animation name!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation name already exists!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Rename Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Blend Next Changed"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Change Blend Time"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Duplicate Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "No animation to copy!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "No animation resource on clipboard!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Pasted Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Paste Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "No animation to edit!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation backwards from current pos. (A)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation backwards from end. (Shift+A)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Stop animation playback. (S)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation from start. (Shift+D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation from current pos. (D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation position (in seconds)."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Scale animation playback globally for the node."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation Tools"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Edit Transitions..."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Open in Inspector"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Display list of animations in player."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Autoplay on Load"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Onion Skinning"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Enable Onion Skinning"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Directions"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Past"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Future"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Depth"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "1 step"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "2 steps"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "3 steps"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Differences Only"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Force White Modulate"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Include Gizmos (3D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Pin AnimationPlayer"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Create New Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Error!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Blend Times:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Next (Auto Queue):"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Cross-Animation Blend Times"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Move Node"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Add Transition"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Node"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "End"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Immediate"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Sync"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "At End"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Travel"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Start and end nodes are needed for a sub-transition."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "No playback resource set at path: %s."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Node Removed"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Transition Removed"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Set Start Node (Autoplay)"
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid ""
+"Select and move nodes.\n"
+"RMB to add new nodes.\n"
+"Shift+LMB to create connections."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Create new nodes."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Connect nodes."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Remove selected node or transition."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Toggle autoplay this animation on start, restart or seek to zero."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Set the end animation. This is useful for sub-transitions."
+msgstr ""
+
+#: editor/plugins/animation_state_machine_editor.cpp
+msgid "Transition: "
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "AnimationTree"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "New name:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Scale:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Fade In (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Fade Out (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Mix"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Auto Restart:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Restart (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Random Restart (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Start!"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Amount:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend 0:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend 1:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "X-Fade Time (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Current:"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Add Input"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Clear Auto-Advance"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Set Auto-Advance"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Delete Input"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Animation tree is valid."
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Animation tree is invalid."
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Animation Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "OneShot Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Mix Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend2 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend3 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Blend4 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "TimeScale Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "TimeSeek Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Transition Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Import Animations..."
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Edit Node Filters"
+msgstr ""
+
+#: editor/plugins/animation_tree_player_editor_plugin.cpp
+msgid "Filters..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Contents:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "View Files"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't resolve hostname:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Connection error, please try again."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't connect to host:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "No response from host:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request failed, return code:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request failed, too many redirects"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Bad download hash, assuming file has been tampered with."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Expected:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Got:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Failed sha256 hash check"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Asset Download Error:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Downloading (%s / %s)..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Downloading..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Resolving..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Error making request"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Idle"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Retry"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download Error"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download for this asset is already in progress!"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "First"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Previous"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Next"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Last"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "All"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_settings_editor.cpp
+msgid "Plugins"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp editor/project_manager.cpp
+msgid "Sort:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Reverse"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_settings_editor.cpp
+msgid "Category:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Site:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Support..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Official"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Testing"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Assets ZIP File"
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid ""
+"Can't determine a save path for lightmap images.\n"
+"Save your scene (for images to be saved in the same dir), or pick a save "
+"path from the BakedLightmap properties."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid ""
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
+"Light' flag is on."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid "Failed creating lightmap images, make sure path is writable."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid "Bake Lightmaps"
+msgstr ""
+
+#: editor/plugins/camera_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/rename_dialog.cpp
+msgid "Preview"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Configure Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Grid Offset:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Grid Step:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation Offset:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation Step:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Remove vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Remove horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new horizontal and vertical guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move pivot"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotate CanvasItem"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move anchor"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Resize CanvasItem"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Scale CanvasItem"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move CanvasItem"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Presets for the anchors and margins values of a Control node."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid ""
+"Children of containers have their anchors and margins values overridden by "
+"their parent."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Anchors only"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change Anchors and Margins"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change Anchors"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Paste Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid ""
+"Warning: Children of a container get their position and size determined only "
+"by their parent."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp scene/gui/graph_edit.cpp
+msgid "Zoom Reset"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Select Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Drag: Rotate"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Alt+Drag: Move"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Alt+RMB: Depth list selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotate Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Scale Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Show a list of all objects at the position clicked\n"
+"(same as Alt+RMB in select mode)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Click to change object's rotation pivot."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Pan Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Toggle snapping."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snapping Options"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to grid"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Rotation Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Configure Snap..."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap Relative"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Pixel Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Smart snapping"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to parent"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node anchor"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node sides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node center"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to other nodes"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Lock the selected object in place (can't be moved)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Unlock the selected object (can be moved)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Makes sure the object's children are not selectable."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Restores the object's children's ability to be selected."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Skeleton Options"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Make IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Make Custom Bone(s) from Node(s)"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear Custom Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Show Grid"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Helpers"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Rulers"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Group And Lock Icons"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Center Selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Frame Selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Layout"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Translation mask for inserting keys."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation mask for inserting keys."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Scale mask for inserting keys."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert keys (based on mask)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid ""
+"Auto insert keys when objects are translated, rotated on scaled (based on "
+"mask).\n"
+"Keys are only added to existing tracks, no new tracks will be created.\n"
+"Keys must be inserted manually for the first time."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Auto Insert Key"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Key (Existing Tracks)"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Copy Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Multiply grid step by 2"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Divide grid step by 2"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Add %s"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Adding %s..."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Cannot instantiate multiple nodes without root."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Create Node"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Error instancing scene from %s"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change default type"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid ""
+"Drag & drop + Shift : Add node as sibling\n"
+"Drag & drop + Alt : Change node type"
+msgstr ""
+
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+msgid "Create Polygon3D"
+msgstr ""
+
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+msgid "Edit Poly"
+msgstr ""
+
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+msgid "Edit Poly (Remove Point)"
+msgstr ""
+
+#: editor/plugins/collision_shape_2d_editor_plugin.cpp
+msgid "Set Handle"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Error loading image:"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "No pixels with transparency > 128 in image..."
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Load Emission Mask"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Clear Emission Mask"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Particles"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generated Point Count:"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Emission Mask"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Capture from Pixel"
+msgstr ""
+
+#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Emission Colors"
+msgstr ""
+
+#: editor/plugins/cpu_particles_editor_plugin.cpp
+msgid "CPUParticles"
+msgstr ""
+
+#: editor/plugins/cpu_particles_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emission Points From Mesh"
+msgstr ""
+
+#: editor/plugins/cpu_particles_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emission Points From Node"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Flat0"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Flat1"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Ease in"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Ease out"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Smoothstep"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Modify Curve Point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Modify Curve Tangent"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Load Curve Preset"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Add point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Remove point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Left linear"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Right linear"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Load preset"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Remove Curve Point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Toggle Curve Linear Tangent"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Hold Shift to edit tangents individually"
+msgstr ""
+
+#: editor/plugins/gi_probe_editor_plugin.cpp
+msgid "Bake GI Probe"
+msgstr ""
+
+#: editor/plugins/gradient_editor_plugin.cpp
+msgid "Gradient Edited"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Item %d"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Items"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Item List Editor"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create Occluder Polygon"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh is empty!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Static Trimesh Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Static Convex Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "This doesn't work on scene root!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Shape"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Shape"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Navigation Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Contained Mesh is not of type ArrayMesh."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "UV Unwrap failed, mesh may not be manifold?"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "No mesh to debug."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Model has no UV in this layer"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "MeshInstance lacks a Mesh!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh has not surface to create outlines from!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Could not create outline!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Static Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Static Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Collision Sibling"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Collision Sibling"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline Mesh..."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "View UV1"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "View UV2"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Unwrap UV2 for Lightmap/AO"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Outline Size:"
+msgstr ""
+
+#: editor/plugins/mesh_library_editor_plugin.cpp
+msgid "Remove item %d?"
+msgstr ""
+
+#: editor/plugins/mesh_library_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add Item"
+msgstr ""
+
+#: editor/plugins/mesh_library_editor_plugin.cpp
+msgid "Remove Selected Item"
+msgstr ""
+
+#: editor/plugins/mesh_library_editor_plugin.cpp
+msgid "Import from Scene"
+msgstr ""
+
+#: editor/plugins/mesh_library_editor_plugin.cpp
+msgid "Update from Scene"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No mesh source specified (and no MultiMesh set in node)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No mesh source specified (and MultiMesh contains no Mesh)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (invalid path)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (not a MeshInstance)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (contains no Mesh resource)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No surface source specified."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (invalid path)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (no geometry)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (no faces)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Parent has no solid faces to populate."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Couldn't map area."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Select a Source Mesh:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Select a Target Surface:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate Surface"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate MultiMesh"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Target Surface:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Source Mesh:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "X-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Y-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Z-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh Up Axis:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Rotation:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Tilt:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Scale:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate"
+msgstr ""
+
+#: editor/plugins/navigation_polygon_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create Navigation Polygon"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generating Visibility Rect"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generate Visibility Rect"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Can only set point into a ParticlesMaterial process material"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Convert to CPUParticles"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generation Time (sec):"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Faces contain no area!"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "No faces!"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Node does not contain geometry."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Node does not contain geometry (faces)."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emitter"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Emission Points:"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Surface Points"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Surface Points+Normal (Directed)"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Volume"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Emission Source: "
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "A processor material of type 'ParticlesMaterial' is required."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generating AABB"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generate Visibility AABB"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generate AABB"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove Point from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove Out-Control from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove In-Control from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Add Point to Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Split Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move Point in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move In-Control in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move Out-Control in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Select Points"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Shift+Drag: Select Control Points"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Click: Add Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Left Click: Split Segment (in curve)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Right Click: Delete Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Select Control Points (Shift+Drag)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Add Point (in empty space)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Delete Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Close Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp editor/plugins/theme_editor_plugin.cpp
+#: editor/project_export.cpp
+msgid "Options"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Mirror Handle Angles"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Mirror Handle Lengths"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Curve Point #"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve Point Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve In Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve Out Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Split Path"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove Path Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove Out-Control Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove In-Control Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Split Segment (in curve)"
+msgstr ""
+
+#: editor/plugins/physical_bone_plugin.cpp
+msgid "Move joint"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid ""
+"The skeleton property of the Polygon2D does not point to a Skeleton2D node"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Sync Bones"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid ""
+"No texture in this polygon.\n"
+"Set a texture to be able to edit UV."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create UV Map"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid ""
+"Polygon 2D has internal vertices, so it can no longer be edited in the "
+"viewport."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create Polygon & UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create Internal Vertex"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Remove Internal Vertex"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Invalid Polygon (need 3 different vertices)"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Add Custom Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Remove Custom Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Transform UV Map"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Transform Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Paint Bone Weights"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Open Polygon 2D UV editor."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygon 2D UV Editor"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Points"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygons"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Bones"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Move Points"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Ctrl: Rotate"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Shift: Move All"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Shift+Ctrl: Scale"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Move Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Rotate Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Scale Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create a custom polygon. Enables custom polygon rendering."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid ""
+"Remove a custom polygon. If none remain, custom polygon rendering is "
+"disabled."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Paint weights with specified intensity."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Unpaint weights with specified intensity."
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Radius:"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygon->UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "UV->Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Clear UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Settings"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Enable Snap"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Configure Grid:"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Offset X:"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Offset Y:"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Step X:"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Step Y:"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Sync Bones to Polygon"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "ERROR: Couldn't load resource!"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Add Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Rename Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Delete Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Resource clipboard is empty!"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Paste Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/scene_tree_editor.cpp
+msgid "Instance:"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
+#: editor/scene_tree_editor.cpp
+msgid "Type:"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
+msgid "Open in Editor"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Load Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "ResourcePreloader"
+msgstr ""
+
+#: editor/plugins/root_motion_editor_plugin.cpp
+msgid "AnimationTree has no path set to an AnimationPlayer"
+msgstr ""
+
+#: editor/plugins/root_motion_editor_plugin.cpp
+msgid "Path to AnimationPlayer is invalid"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Clear Recent Files"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close and save changes?"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error writing TextFile:"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error: could not load file."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error could not load file."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error saving file!"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error while saving theme."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error Saving"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error importing theme."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error Importing"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "New TextFile..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Open File"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save File As..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Import Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error while saving theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error saving"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme As..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "%s Class Reference"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Toggle alphabetical sorting of the method list."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Sort"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Move Up"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Move Down"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Next script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Previous script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "File"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Open..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save All"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Soft Reload Script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Copy Script Path"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "History Previous"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "History Next"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Import Theme..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Reload Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close Docs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close All"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close Other Tabs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+msgid "Run"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Toggle Scripts Panel"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+msgid "Find Next"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Step Over"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Step Into"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Break"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+#: editor/script_editor_debugger.cpp
+msgid "Continue"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Keep Debugger Open"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Debug with External Editor"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Open Godot online documentation"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Request Docs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Help improve the Godot documentation by giving feedback"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search the reference documentation."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Go to previous edited document."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Go to next edited document."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Discard"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid ""
+"The following files are newer on disk.\n"
+"What action should be taken?:"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Reload"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Resave"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Debugger"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search Results"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "(ignore)"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Go to Function"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
+msgid "Standard"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Only resources from filesystem can be dropped."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Lookup Symbol"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Pick Color"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
+msgid "Convert Case"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
+msgid "Uppercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
+msgid "Lowercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
+msgid "Capitalize"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp
+msgid "Syntax Highlighter"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Cut"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Select All"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Delete Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Indent Left"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Indent Right"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Toggle Comment"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Fold/Unfold Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Fold All Lines"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Unfold All Lines"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Clone Down"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Complete Symbol"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Trim Trailing Whitespace"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Indent to Spaces"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Indent to Tabs"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Auto Indent"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Toggle Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Remove All Breakpoints"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Go to Next Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Go to Previous Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Find Previous"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Find in Files..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Go to Function..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Go to Line..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Contextual Help"
+msgstr ""
+
+#: editor/plugins/shader_editor_plugin.cpp
+msgid "Shader"
+msgstr ""
+
+#: editor/plugins/skeleton_2d_editor_plugin.cpp
+msgid "This skeleton has no bones, create some children Bone2D nodes."
+msgstr ""
+
+#: editor/plugins/skeleton_2d_editor_plugin.cpp
+msgid "Create Rest Pose from Bones"
+msgstr ""
+
+#: editor/plugins/skeleton_2d_editor_plugin.cpp
+msgid "Set Rest Pose to Bones"
+msgstr ""
+
+#: editor/plugins/skeleton_2d_editor_plugin.cpp
+msgid "Skeleton2D"
+msgstr ""
+
+#: editor/plugins/skeleton_2d_editor_plugin.cpp
+msgid "Make Rest Pose (From Bones)"
+msgstr ""
+
+#: editor/plugins/skeleton_2d_editor_plugin.cpp
+msgid "Set Bones to Rest Pose"
+msgstr ""
+
+#: editor/plugins/skeleton_editor_plugin.cpp
+msgid "Create physical bones"
+msgstr ""
+
+#: editor/plugins/skeleton_editor_plugin.cpp
+msgid "Skeleton"
+msgstr ""
+
+#: editor/plugins/skeleton_editor_plugin.cpp
+msgid "Create physical skeleton"
+msgstr ""
+
+#: editor/plugins/skeleton_ik_editor_plugin.cpp
+msgid "Play IK"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Orthogonal"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Perspective"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Aborted."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "X-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Y-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Z-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Plane Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scaling: "
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translating: "
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotating %s degrees."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Keying is disabled (no key inserted)."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Animation Key Inserted."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Pitch"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Yaw"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Objects Drawn"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Material Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Shader Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Surface Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Draw Calls"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Vertices"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Top View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Align with View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "No parent to instance a child at."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "This operation requires a single selected node."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Lock View Rotation"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Normal"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Wireframe"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Overdraw"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Unshaded"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Environment"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Gizmos"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Information"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View FPS"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Half Resolution"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Audio Listener"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Doppler Enable"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Cinematic Preview"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Left"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Right"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Forward"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Backwards"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Up"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Down"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Speed Modifier"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Note: The FPS value displayed is the editor's framerate.\n"
+"It cannot be used as a reliable indication of in-game performance."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Rotation Locked"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "XForm Dialog"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Nodes To Floor"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Select Mode (Q)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Drag: Rotate\n"
+"Alt+Drag: Move\n"
+"Alt+RMB: Depth list selection"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Move Mode (W)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate Mode (E)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale Mode (R)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Local Coords"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Local Space Mode (%s)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Mode (%s)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Top View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Switch Perspective/Orthogonal view"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Insert Animation Key"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Focus Origin"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Focus Selection"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Align Selection With View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Select"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Move"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Rotate"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Scale"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Toggle Freelook"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap object to floor"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Dialog..."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "1 Viewport"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "2 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "2 Viewports (Alt)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "3 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "3 Viewports (Alt)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "4 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Gizmos"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Origin"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Grid"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translate Snap:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate Snap (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale Snap (%):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Viewport Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Perspective FOV (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Z-Near:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Z-Far:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Change"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translate:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale (ratio):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Type"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Pre"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Post"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Nameless gizmo"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Create Mesh2D"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Create Polygon2D"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Create CollisionPolygon2D"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Create LightOccluder2D"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Sprite is empty!"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Can't convert a sprite using animation frames to mesh."
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Invalid geometry, can't replace by mesh."
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Invalid geometry, can't create polygon."
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Invalid geometry, can't create collision polygon."
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Invalid geometry, can't create light occluder."
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Sprite"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Convert to Mesh2D"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Convert to Polygon2D"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Create CollisionPolygon2D Sibling"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Create LightOccluder2D Sibling"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Simplification: "
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Grow (Pixels): "
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Update Preview"
+msgstr ""
+
+#: editor/plugins/sprite_editor_plugin.cpp
+msgid "Settings:"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "ERROR: Couldn't load frame resource!"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Frame"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Resource clipboard is empty or not a texture!"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Paste Frame"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Empty"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Change Animation FPS"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "(empty)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Animations:"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "New Animation"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Speed (FPS):"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Loop"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Animation Frames:"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Insert Empty (Before)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Insert Empty (After)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Move (Before)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Move (After)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "SpriteFrames"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Set Region Rect"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Set Margin"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Snap Mode:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: scene/resources/visual_shader.cpp
+msgid "None"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Pixel Snap"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Grid Snap"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Auto Slice"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Offset:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Step:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Sep.:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "TextureRegion"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Can't save theme to file:"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add All Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add All"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove All Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove All"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Edit theme..."
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Theme editing menu."
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add Class Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove Class Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create Empty Template"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create Empty Editor Template"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create From Current Editor Theme"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "CheckBox Radio1"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "CheckBox Radio2"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Check Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Many"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has,Many,Options"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 1"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 2"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 3"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Data Type:"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Icon"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp editor/rename_dialog.cpp
+msgid "Style"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Font"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Color"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Constant"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase Selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Fix Invalid Tiles"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Cut Selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Paint TileMap"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Line Draw"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rectangle Paint"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Bucket Fill"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase TileMap"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Find Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Transpose"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Mirror X"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Mirror Y"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Paint Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Pick Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Copy Selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate left"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate right"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Flip horizontally"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Flip vertically"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Clear transform"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Add Texture(s) to TileSet."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove selected Texture from TileSet."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create from Scene"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Merge from Scene"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Next Coordinate"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Select the next shape, subtile, or Tile."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Previous Coordinate"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Select the previous shape, subtile, or Tile."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Copy bitmask."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Paste bitmask."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Erase bitmask."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create a new rectangle."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create a new polygon."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Keep polygon inside region Rect."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Enable snap and show grid (configurable via the Inspector)."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Display Tile Names (Hold Alt Key)"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove selected texture? This will remove all tiles which use it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "You haven't selected a texture to remove."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create from scene? This will overwrite all current tiles."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Merge from scene?"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Texture"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "%s file(s) were not added because was already on the list."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Drag handles to edit Rect.\n"
+"Click on another Tile to edit it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Delete selected Rect."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Select current edited sub-tile.\n"
+"Click on another Tile to edit it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Delete polygon."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"LMB: Set bit on.\n"
+"RMB: Set bit off.\n"
+"Click on another Tile to edit it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Select sub-tile to use as icon, this will be also used on invalid autotile "
+"bindings.\n"
+"Click on another Tile to edit it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Select sub-tile to change its priority.\n"
+"Click on another Tile to edit it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Select sub-tile to change its z index.\n"
+"Click on another Tile to edit it."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Set Tile Region"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create Tile"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Set Tile Icon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Edit Tile Bitmask"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Edit Collision Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Edit Occlusion Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Edit Navigation Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Paste Tile Bitmask"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Clear Tile Bitmask"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Make Polygon Concave"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Make Polygon Convex"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Tile"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Collision Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Occlusion Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Navigation Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Edit Tile Priority"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Edit Tile Z Index"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create Collision Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create Occlusion Polygon"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "This property can't be changed."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "TileSet"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Set Uniform Name"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Set Input Default Port"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Add Node to Visual Shader"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Duplicate Nodes"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Delete Nodes"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Visual Shader Input Type Changed"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Vertex"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Fragment"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Light"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "VisualShader"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Edit Visual Property"
+msgstr ""
+
+#: editor/plugins/visual_shader_editor_plugin.cpp
+msgid "Visual Shader Mode Changed"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Runnable"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Delete patch '%s' from list?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Delete preset '%s'?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Failed to export the project for platform '%s'.\n"
+"Export templates seem to be missing or invalid."
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Failed to export the project for platform '%s'.\n"
+"This might be due to a configuration issue in the export preset or your "
+"export settings."
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Release"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Exporting All"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "The given export path doesn't exist:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing/corrupted:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Presets"
+msgstr ""
+
+#: editor/project_export.cpp editor/project_settings_editor.cpp
+msgid "Add..."
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export Path"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Resources"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export all resources in the project"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export selected scenes (and dependencies)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export selected resources (and dependencies)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export Mode:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Resources to export:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Patches"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Make Patch"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Features"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Custom (comma-separated):"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Feature List:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Script"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Script Export Mode:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Text"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Compiled"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Encrypted (Provide Key Below)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Invalid Encryption Key (must be 64 characters long)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Script Encryption Key (256-bits as hex):"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export PCK/Zip"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export mode?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export All"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export With Debug"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "The path does not exist."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid '.zip' project file, does not contain a 'project.godot' file."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Please choose an empty folder."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Please choose a 'project.godot' or '.zip' file."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Directory already contains a Godot project."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Imported Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't create folder."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "There is already a folder in this path with the specified name."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "It would be a good idea to name your project."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid project path (changed anything?)."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Couldn't load project.godot in project path (error %d). It may be missing or "
+"corrupted."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't edit project.godot in project path."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't create project.godot in project path."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "The following files failed extraction from package:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Rename Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "New Game Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Import Existing Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Import & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create New Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Install Project:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Install & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Name:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create folder"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Path:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Installation Path:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Browse"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Renderer:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "OpenGL ES 3.0"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Higher visual quality\n"
+"All features available\n"
+"Incompatible with older hardware\n"
+"Not recommended for web games"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "OpenGL ES 2.0"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Lower visual quality\n"
+"Some features not available\n"
+"Works on most hardware\n"
+"Recommended for web games"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Renderer can be changed later, but scenes may need to be adjusted."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Unnamed Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Can't open project at '%s'."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Are you sure to open more than one project?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"The following project settings file does not specify the version of Godot "
+"through which it was created.\n"
+"\n"
+"%s\n"
+"\n"
+"If you proceed with opening it, it will be converted to Godot's current "
+"configuration file format.\n"
+"Warning: You will not be able to open the project with previous versions of "
+"the engine anymore."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"The following project settings file was generated by an older engine "
+"version, and needs to be converted for this version:\n"
+"\n"
+"%s\n"
+"\n"
+"Do you want to convert it?\n"
+"Warning: You will not be able to open the project with previous versions of "
+"the engine anymore."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"The project settings were created by a newer engine version, whose settings "
+"are not compatible with this version."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Can't run project: no main scene defined.\n"
+"Please edit the project and set the main scene in \"Project Settings\" under "
+"the \"Application\" category."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Can't run project: Assets need to be imported.\n"
+"Please edit the project to trigger the initial import."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Are you sure to run more than one project?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Remove project from the list? (Folder contents will not be modified)"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Language changed.\n"
+"The UI will update next time the editor or project manager starts."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"You are about the scan %s folders for existing Godot projects. Do you "
+"confirm?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Manager"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project List"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Scan"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Select a Folder to Scan"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "New Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Templates"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Exit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Restart Now"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Can't run project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"You don't currently have any projects.\n"
+"Would you like to explore the official example projects in the Asset Library?"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Key "
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joy Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joy Axis"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Mouse Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid ""
+"Invalid action name. it cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action '%s' already exists!"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Rename Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Change Action deadzone"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "All Devices"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Device"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Shift+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Alt+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Control+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Press a Key..."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Mouse Button Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Left Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Right Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Middle Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Up Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Down Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Left Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Right Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "X Button 1"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "X Button 2"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joypad Axis Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Axis"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joypad Button Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Erase Input Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Erase Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Left Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Right Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Middle Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Up."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Down."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Global Property"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Select a setting item first!"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "No property '%s' exists."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Setting '%s' is internal, and it can't be deleted."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Delete Item"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Already existing"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Input Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Error saving settings."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Settings saved OK."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Override for Feature"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Translation"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Translation"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Remapped Path"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Resource Remap Add Remap"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Change Resource Remap Language"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Resource Remap"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Resource Remap Option"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Changed Locale Filter"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Changed Locale Filter Mode"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Project Settings (project.godot)"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "General"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Override For..."
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Editor must be restarted for changes to take effect"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Input Map"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Deadzone"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Device:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Localization"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Translations"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Translations:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remaps"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Resources:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remaps by Locale:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locale"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locales Filter"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Show all locales"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Show only selected locales"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Filter mode:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locales:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "AutoLoad"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Ease In"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Ease Out"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Zero"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Easing In-Out"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Easing Out-In"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "File..."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Dir..."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Assign"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Select Node"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Error loading file: Not a resource!"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Pick a Node"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Bit %d, val %d."
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Property"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Virtual Method"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Method"
+msgstr ""
+
+#: editor/pvrtc_compress.cpp
+msgid "Could not execute PVRTC tool:"
+msgstr ""
+
+#: editor/pvrtc_compress.cpp
+msgid "Can't load back converted image using PVRTC tool:"
+msgstr ""
+
+#: editor/rename_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Batch Rename"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Prefix"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Suffix"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Advanced options"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Substitute"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Node name"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Node's parent name, if available"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Node type"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Current scene name"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Root node name"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid ""
+"Sequential integer counter.\n"
+"Compare counter options."
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Per Level counter"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "If set the counter restarts for each group of child nodes"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Initial value for the counter"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Step"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Amount by which counter is incremented for each node"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Padding"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid ""
+"Minimum number of digits for the counter.\n"
+"Missing digits are padded with leading zeros."
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Regular Expressions"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Post-Process"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Keep"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "CamelCase to under_scored"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "under_scored to CamelCase"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Case"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "To Lowercase"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "To Uppercase"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Reset"
+msgstr ""
+
+#: editor/rename_dialog.cpp
+msgid "Error"
+msgstr ""
+
+#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Reparent Node"
+msgstr ""
+
+#: editor/reparent_dialog.cpp
+msgid "Reparent Location (Select new Parent):"
+msgstr ""
+
+#: editor/reparent_dialog.cpp
+msgid "Keep Global Transform"
+msgstr ""
+
+#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Reparent"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Run Mode:"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Current Scene"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Main Scene"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Main Scene Arguments:"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Scene Run Settings"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "No parent to instance the scenes at."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error loading scene from %s"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Cannot instance the scene '%s' because the current scene exists within one "
+"of its nodes."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instance Scene(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instance Child Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "This operation can't be done on the tree root."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Move Node In Parent"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Move Nodes In Parent"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Duplicate Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't reparent nodes in inherited scenes, order of nodes can't change."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Node must belong to the edited scene to become root."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instantiated scenes can't become root"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Make node as Root"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete Node(s)?"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can not perform with the root node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "This operation can't be done on instanced scenes."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Save New Scene As..."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Disabling \"editable_instance\" will cause all properties of the node to be "
+"reverted to their default."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Editable Children"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Load As Placeholder"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Make Local"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "New Scene Root"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Create Root Node:"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "2D Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "3D Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "User Interface"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Custom Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't operate on nodes from a foreign scene!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't operate on nodes the current scene inherits from!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Attach Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Remove Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Couldn't save new scene. Likely dependencies (instances) couldn't be "
+"satisfied."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error saving scene."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error duplicating scene to save it."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Sub-Resources"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Inheritance"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Open documentation"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Add Child Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Change Type"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Extend Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Make Scene Root"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Merge From Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp editor/script_editor_debugger.cpp
+msgid "Save Branch as Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Copy Node Path"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete (No Confirm)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Add/Create a New Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Instance a scene file as a Node. Creates an inherited scene if no root node "
+"exists."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Attach a new or existing script for the selected node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear a script for the selected node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Remote"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Local"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Inheritance? (No Undo!)"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle Visible"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Node configuration warning:"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node has connection(s) and group(s).\n"
+"Click to show signals dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node has connections.\n"
+"Click to show signals dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node is in group(s).\n"
+"Click to show groups dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp editor/script_create_dialog.cpp
+msgid "Open Script"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node is locked.\n"
+"Click to unlock it."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Children are not selectable.\n"
+"Click to make selectable."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle Visibility"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"AnimationPlayer is pinned.\n"
+"Click to unpin."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Invalid node name, the following characters are not allowed:"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Rename Node"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Scene Tree (Nodes):"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Node Configuration Warning!"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Select a Node"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error loading template '%s'"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error - Could not create script in filesystem."
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error loading script from %s"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "N/A"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Open Script/Choose Location"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Path is empty"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Filename is empty"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Path is not local"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid base path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Directory of the same name exists"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "File exists, will be reused"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid extension"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Wrong extension chosen"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid Path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid class name"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid inherited parent name or path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Script valid"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Allowed: a-z, A-Z, 0-9 and _"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Built-in script (into scene file)"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Create new script file"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Load existing script file"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Language"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Inherits"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Class Name"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Template"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Built-in Script"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Attach Node Script"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Remote "
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Bytes:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Stack Trace"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Pick one or more items from the list to display the graph."
+msgstr ""
+
+#: editor/script_editor_debugger.cpp modules/mono/editor/mono_bottom_panel.cpp
+msgid "Errors"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Child Process Connected"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Copy Error"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Inspect Previous Instance"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Inspect Next Instance"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Stack Frames"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Profiler"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Monitor"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Value"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Monitors"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "List of Video Memory Usage by Resource:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Total:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Video Mem"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Resource Path"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Type"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Format"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Usage"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Misc"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Clicked Control:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Clicked Control Type:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Live Edit Root:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Set From Tree"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Erase Shortcut"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Restore Shortcut"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Change Shortcut"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Shortcuts"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Binding"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Light Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change AudioStreamPlayer3D Emission Angle"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Camera FOV"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Camera Size"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Notifier AABB"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Particles AABB"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Probe Extents"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
+msgid "Change Sphere Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
+msgid "Change Box Shape Extents"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Capsule Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Capsule Shape Height"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Cylinder Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Cylinder Shape Height"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Ray Shape Length"
+msgstr ""
+
+#: modules/csg/csg_gizmos.cpp
+msgid "Change Cylinder Radius"
+msgstr ""
+
+#: modules/csg/csg_gizmos.cpp
+msgid "Change Cylinder Height"
+msgstr ""
+
+#: modules/csg/csg_gizmos.cpp
+msgid "Change Torus Inner Radius"
+msgstr ""
+
+#: modules/csg/csg_gizmos.cpp
+msgid "Change Torus Outer Radius"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Select the dynamic library for this entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Select dependencies of the library for this entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Remove current entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Double click to create a new entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Platform:"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Platform"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Dynamic Library"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Add an architecture entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "GDNativeLibrary"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Library"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Status"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Libraries: "
+msgstr ""
+
+#: modules/gdnative/register_types.cpp
+msgid "GDNative"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Step argument is zero!"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not a script with an instance"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not based on a script"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not based on a resource file"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (missing @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (can't load script at @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (invalid script at @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary (invalid subclasses)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Object can't provide a length."
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Next Plane"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Previous Plane"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Plane:"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Next Floor"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Previous Floor"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Floor:"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Delete Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Fill Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Duplicate Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Paint"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Grid Map"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Snap View"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Disabled"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Above"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Below"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit X Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit Y Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit Z Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate X"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate Y"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate Z"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate X"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate Y"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate Z"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Clear Rotation"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Create Area"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Create Exterior Connector"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Erase Area"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clear Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Fill Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Settings"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Pick Distance:"
+msgstr ""
+
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Generating solution..."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Generating C# project..."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to create solution."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to save solution."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Done"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to create C# project."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Mono"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "About C# support"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Create C# solution"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Builds"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Build Project"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "View log"
+msgstr ""
+
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
+#: modules/recast/navigation_mesh_editor_plugin.cpp
+msgid "Bake NavMesh"
+msgstr ""
+
+#: modules/recast/navigation_mesh_editor_plugin.cpp
+msgid "Clear the navigation mesh."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Setting up Configuration..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Calculating grid size..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Creating heightfield..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Marking walkable triangles..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Constructing compact heightfield..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Eroding walkable area..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Partitioning..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Creating contours..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Creating polymesh..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Converting to native navigation mesh..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Navigation Mesh Generator Setup:"
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Parsing Geometry..."
+msgstr ""
+
+#: modules/recast/navigation_mesh_generator.cpp
+msgid "Done!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"A node yielded without working memory, please read the docs on how to yield "
+"properly!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"Node yielded, but did not return a function state in the first working "
+"memory."
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"Return value must be assigned to first element of node working memory! Fix "
+"your node please."
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Node returned an invalid sequence output: "
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Found sequence bit but not the node in the stack, report bug!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Stack overflow with stack depth: "
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Signal Arguments"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Argument Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Argument name"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Set Variable Default Value"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Set Variable Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Variables:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Name is not a valid identifier:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Name already in use by another func/var/signal:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Expression"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Duplicate VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a simple reference to the node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a simple reference to the node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a Variable Setter."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a Variable Setter."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Preload Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Node(s) From Tree"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Getter Property"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Setter Property"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Base Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Move Node(s)"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove VisualScript Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Connect Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Connect Node Data"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Connect Node Sequence"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Script already has function '%s'"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Input Value"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Resize Comment"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Can't copy the function node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Clipboard is empty!"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Paste VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Editing Variable:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Editing Signal:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Base Type:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Members:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Available Nodes:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Select or create a function to edit graph"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Signal Arguments:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Variable:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Delete Selected"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Find Node Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Copy Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Cut Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Paste Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Member"
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Input type not iterable: "
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Iterator became invalid"
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Iterator became invalid: "
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Invalid index property name."
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Base object is not a Node!"
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Path does not lead Node!"
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Invalid index property name '%s' in node %s."
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ": Invalid argument of type: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ": Invalid arguments: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "VariableGet not found in script: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "VariableSet not found in script: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "Custom node has no _step() method, can't process graph."
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ""
+"Invalid return value from _step(), must be integer (seq out), or string "
+"(error)."
+msgstr ""
+
+#: modules/visual_script/visual_script_property_selector.cpp
+msgid "Search VisualScript"
+msgstr ""
+
+#: modules/visual_script/visual_script_property_selector.cpp
+msgid "Get %s"
+msgstr ""
+
+#: modules/visual_script/visual_script_property_selector.cpp
+msgid "Set %s"
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "Package name is missing."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "Package segments must be of non-zero length."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "The character '%s' is not allowed in Android application package names."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "A digit cannot be the first character in a package segment."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "The character '%s' cannot be the first character in a package segment."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "The package must have at least one '.' separator."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "ADB executable not configured in the Editor Settings."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "OpenJDK jarsigner not configured in the Editor Settings."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "Debug keystore not configured in the Editor Settings nor in the preset."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "Invalid public key for APK expansion."
+msgstr ""
+
+#: platform/android/export/export.cpp
+msgid "Invalid package name:"
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "Identifier is missing."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "Identifier segments must be of non-zero length."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "The character '%s' is not allowed in Identifier."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "A digit cannot be the first character in a Identifier segment."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid ""
+"The character '%s' cannot be the first character in a Identifier segment."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "The Identifier must have at least one '.' separator."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "App Store Team ID not specified - cannot configure the project."
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "Invalid Identifier:"
+msgstr ""
+
+#: platform/iphone/export/export.cpp
+msgid "Required icon is not specified in the preset."
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Run in Browser"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Run exported HTML in the system's default browser."
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not write file:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not open template for export:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Invalid export template:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not read custom HTML shell:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not read boot splash image file:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Using default boot splash image."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid package unique name."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid product GUID."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid publisher GUID."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid background color."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid Store Logo image dimensions (should be 50x50)."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid square 44x44 logo image dimensions (should be 44x44)."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid square 71x71 logo image dimensions (should be 71x71)."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid square 150x150 logo image dimensions (should be 150x150)."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid square 310x310 logo image dimensions (should be 310x310)."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid wide 310x150 logo image dimensions (should be 310x150)."
+msgstr ""
+
+#: platform/uwp/export/export.cpp
+msgid "Invalid splash screen image dimensions (should be 620x300)."
+msgstr ""
+
+#: scene/2d/animated_sprite.cpp
+msgid ""
+"A SpriteFrames resource must be created or set in the 'Frames' property in "
+"order for AnimatedSprite to display frames."
+msgstr ""
+
+#: scene/2d/canvas_modulate.cpp
+msgid ""
+"Only one visible CanvasModulate is allowed per scene (or set of instanced "
+"scenes). The first created one will work, while the rest will be ignored."
+msgstr ""
+
+#: scene/2d/collision_object_2d.cpp
+msgid ""
+"This node has no shape, so it can't collide or interact with other objects.\n"
+"Consider adding a CollisionShape2D or CollisionPolygon2D as a child to "
+"define its shape."
+msgstr ""
+
+#: scene/2d/collision_polygon_2d.cpp
+msgid ""
+"CollisionPolygon2D only serves to provide a collision shape to a "
+"CollisionObject2D derived node. Please only use it as a child of Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
+msgstr ""
+
+#: scene/2d/collision_polygon_2d.cpp
+msgid "An empty CollisionPolygon2D has no effect on collision."
+msgstr ""
+
+#: scene/2d/collision_shape_2d.cpp
+msgid ""
+"CollisionShape2D only serves to provide a collision shape to a "
+"CollisionObject2D derived node. Please only use it as a child of Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
+msgstr ""
+
+#: scene/2d/collision_shape_2d.cpp
+msgid ""
+"A shape must be provided for CollisionShape2D to function. Please create a "
+"shape resource for it!"
+msgstr ""
+
+#: scene/2d/cpu_particles_2d.cpp
+msgid ""
+"CPUParticles2D animation requires the usage of a CanvasItemMaterial with "
+"\"Particles Animation\" enabled."
+msgstr ""
+
+#: scene/2d/light_2d.cpp
+msgid ""
+"A texture with the shape of the light must be supplied to the 'texture' "
+"property."
+msgstr ""
+
+#: scene/2d/light_occluder_2d.cpp
+msgid ""
+"An occluder polygon must be set (or drawn) for this occluder to take effect."
+msgstr ""
+
+#: scene/2d/light_occluder_2d.cpp
+msgid "The occluder polygon for this occluder is empty. Please draw a polygon!"
+msgstr ""
+
+#: scene/2d/navigation_polygon.cpp
+msgid ""
+"A NavigationPolygon resource must be set or created for this node to work. "
+"Please set a property or draw a polygon."
+msgstr ""
+
+#: scene/2d/navigation_polygon.cpp
+msgid ""
+"NavigationPolygonInstance must be a child or grandchild to a Navigation2D "
+"node. It only provides navigation data."
+msgstr ""
+
+#: scene/2d/parallax_layer.cpp
+msgid ""
+"ParallaxLayer node only works when set as child of a ParallaxBackground node."
+msgstr ""
+
+#: scene/2d/particles_2d.cpp
+msgid ""
+"GPU-based particles are not supported by the GLES2 video driver.\n"
+"Use the CPUParticles2D node instead. You can use the \"Convert to "
+"CPUParticles\" option for this purpose."
+msgstr ""
+
+#: scene/2d/particles_2d.cpp scene/3d/particles.cpp
+msgid ""
+"A material to process the particles is not assigned, so no behavior is "
+"imprinted."
+msgstr ""
+
+#: scene/2d/particles_2d.cpp
+msgid ""
+"Particles2D animation requires the usage of a CanvasItemMaterial with "
+"\"Particles Animation\" enabled."
+msgstr ""
+
+#: scene/2d/path_2d.cpp
+msgid "PathFollow2D only works when set as a child of a Path2D node."
+msgstr ""
+
+#: scene/2d/physics_body_2d.cpp
+msgid ""
+"Size changes to RigidBody2D (in character or rigid modes) will be overridden "
+"by the physics engine when running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/2d/remote_transform_2d.cpp
+msgid "Path property must point to a valid Node2D node to work."
+msgstr ""
+
+#: scene/2d/skeleton_2d.cpp
+msgid "This Bone2D chain should end at a Skeleton2D node."
+msgstr ""
+
+#: scene/2d/skeleton_2d.cpp
+msgid "A Bone2D only works with a Skeleton2D or another Bone2D as parent node."
+msgstr ""
+
+#: scene/2d/skeleton_2d.cpp
+msgid ""
+"This bone lacks a proper REST pose. Go to the Skeleton2D node and set one."
+msgstr ""
+
+#: scene/2d/visibility_notifier_2d.cpp
+msgid ""
+"VisibilityEnable2D works best when used with the edited scene root directly "
+"as parent."
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRCamera must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRController must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid ""
+"The controller id must not be 0 or this controller will not be bound to an "
+"actual controller"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRAnchor must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid ""
+"The anchor id must not be 0 or this anchor will not be bound to an actual "
+"anchor"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVROrigin requires an ARVRCamera child node"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "%d%%"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "(Time Left: %d:%02d s)"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Plotting Meshes: "
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Plotting Lights:"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp scene/3d/gi_probe.cpp
+msgid "Finishing Plot"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Lighting Meshes: "
+msgstr ""
+
+#: scene/3d/collision_object.cpp
+msgid ""
+"This node has no shape, so it can't collide or interact with other objects.\n"
+"Consider adding a CollisionShape or CollisionPolygon as a child to define "
+"its shape."
+msgstr ""
+
+#: scene/3d/collision_polygon.cpp
+msgid ""
+"CollisionPolygon only serves to provide a collision shape to a "
+"CollisionObject derived node. Please only use it as a child of Area, "
+"StaticBody, RigidBody, KinematicBody, etc. to give them a shape."
+msgstr ""
+
+#: scene/3d/collision_polygon.cpp
+msgid "An empty CollisionPolygon has no effect on collision."
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"CollisionShape only serves to provide a collision shape to a CollisionObject "
+"derived node. Please only use it as a child of Area, StaticBody, RigidBody, "
+"KinematicBody, etc. to give them a shape."
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"A shape must be provided for CollisionShape to function. Please create a "
+"shape resource for it!"
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"Plane shapes don't work well and will be removed in future versions. Please "
+"don't use them."
+msgstr ""
+
+#: scene/3d/cpu_particles.cpp
+msgid "Nothing is visible because no mesh has been assigned."
+msgstr ""
+
+#: scene/3d/cpu_particles.cpp
+msgid ""
+"CPUParticles animation requires the usage of a SpatialMaterial with "
+"\"Billboard Particles\" enabled."
+msgstr ""
+
+#: scene/3d/gi_probe.cpp
+msgid "Plotting Meshes"
+msgstr ""
+
+#: scene/3d/gi_probe.cpp
+msgid ""
+"GIProbes are not supported by the GLES2 video driver.\n"
+"Use a BakedLightmap instead."
+msgstr ""
+
+#: scene/3d/navigation_mesh.cpp
+msgid "A NavigationMesh resource must be set or created for this node to work."
+msgstr ""
+
+#: scene/3d/navigation_mesh.cpp
+msgid ""
+"NavigationMeshInstance must be a child or grandchild to a Navigation node. "
+"It only provides navigation data."
+msgstr ""
+
+#: scene/3d/particles.cpp
+msgid ""
+"GPU-based particles are not supported by the GLES2 video driver.\n"
+"Use the CPUParticles node instead. You can use the \"Convert to CPUParticles"
+"\" option for this purpose."
+msgstr ""
+
+#: scene/3d/particles.cpp
+msgid ""
+"Nothing is visible because meshes have not been assigned to draw passes."
+msgstr ""
+
+#: scene/3d/particles.cpp
+msgid ""
+"Particles animation requires the usage of a SpatialMaterial with \"Billboard "
+"Particles\" enabled."
+msgstr ""
+
+#: scene/3d/path.cpp
+msgid "PathFollow only works when set as a child of a Path node."
+msgstr ""
+
+#: scene/3d/path.cpp
+msgid ""
+"PathFollow ROTATION_ORIENTED requires \"Up Vector\" enabled in its parent "
+"Path's Curve resource."
+msgstr ""
+
+#: scene/3d/physics_body.cpp
+msgid ""
+"Size changes to RigidBody (in character or rigid modes) will be overridden "
+"by the physics engine when running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/3d/remote_transform.cpp
+msgid "Path property must point to a valid Spatial node to work."
+msgstr ""
+
+#: scene/3d/soft_body.cpp
+msgid "This body will be ignored until you set a mesh"
+msgstr ""
+
+#: scene/3d/soft_body.cpp
+msgid ""
+"Size changes to SoftBody will be overridden by the physics engine when "
+"running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/3d/sprite_3d.cpp
+msgid ""
+"A SpriteFrames resource must be created or set in the 'Frames' property in "
+"order for AnimatedSprite3D to display frames."
+msgstr ""
+
+#: scene/3d/vehicle_body.cpp
+msgid ""
+"VehicleWheel serves to provide a wheel system to a VehicleBody. Please use "
+"it as a child of a VehicleBody."
+msgstr ""
+
+#: scene/3d/world_environment.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/world_environment.cpp
+msgid ""
+"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
+msgstr ""
+
+#: scene/3d/world_environment.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
+#: scene/animation/animation_blend_tree.cpp
+msgid "On BlendTree node '%s', animation not found: '%s'"
+msgstr ""
+
+#: scene/animation/animation_blend_tree.cpp
+msgid "Animation not found: '%s'"
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "In node '%s', invalid animation: '%s'."
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "Invalid animation: '%s'."
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "Nothing connected to input '%s' of node '%s'."
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "A root AnimationNode for the graph is not set."
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "Path to an AnimationPlayer node containing animations is not set."
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "Path set for AnimationPlayer does not lead to an AnimationPlayer node."
+msgstr ""
+
+#: scene/animation/animation_tree.cpp
+msgid "AnimationPlayer root is not a valid node."
+msgstr ""
+
+#: scene/animation/animation_tree_player.cpp
+msgid "This node has been deprecated. Use AnimationTree instead."
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Pick a color from the screen."
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Raw Mode"
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Switch between hexadecimal and code values."
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Add current color as a preset."
+msgstr ""
+
+#: scene/gui/container.cpp
+msgid ""
+"Container by itself serves no purpose unless a script configures it's "
+"children placement behavior.\n"
+"If you dont't intend to add a script, then please use a plain 'Control' node "
+"instead."
+msgstr ""
+
+#: scene/gui/dialogs.cpp
+msgid "Alert!"
+msgstr ""
+
+#: scene/gui/dialogs.cpp
+msgid "Please Confirm..."
+msgstr ""
+
+#: scene/gui/file_dialog.cpp
+msgid "Go to parent folder."
+msgstr ""
+
+#: scene/gui/popup.cpp
+msgid ""
+"Popups will hide by default unless you call popup() or any of the popup*() "
+"functions. Making them visible for editing is fine though, but they will "
+"hide upon running."
+msgstr ""
+
+#: scene/gui/range.cpp
+msgid "If exp_edit is true min_value must be > 0."
+msgstr ""
+
+#: scene/gui/scroll_container.cpp
+msgid ""
+"ScrollContainer is intended to work with a single child control.\n"
+"Use a container as child (VBox,HBox,etc), or a Control and set the custom "
+"minimum size manually."
+msgstr ""
+
+#: scene/gui/tree.cpp
+msgid "(Other)"
+msgstr ""
+
+#: scene/main/scene_tree.cpp
+msgid ""
+"Default Environment as specified in Project Settings (Rendering -> "
+"Environment -> Default Environment) could not be loaded."
+msgstr ""
+
+#: scene/main/viewport.cpp
+msgid ""
+"This viewport is not set as render target. If you intend for it to display "
+"its contents directly to the screen, make it a child of a Control so it can "
+"obtain a size. Otherwise, make it a RenderTarget and assign its internal "
+"texture to some node for display."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Error initializing FreeType."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Unknown font format."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Error loading font."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Invalid font size."
+msgstr ""
+
+#: scene/resources/visual_shader.cpp
+msgid "Input"
+msgstr ""
+
+#: scene/resources/visual_shader_nodes.cpp
+msgid "Invalid source for shader."
+msgstr ""
+
+#: servers/visual/shader_language.cpp
+msgid "Assignment to function."
+msgstr ""
+
+#: servers/visual/shader_language.cpp
+msgid "Assignment to uniform."
+msgstr ""
+
+#: servers/visual/shader_language.cpp
+msgid "Varyings can only be assigned in vertex function."
+msgstr ""
diff --git a/editor/translations/es.po b/editor/translations/es.po
index f66b06cccd..783344b9de 100644
--- a/editor/translations/es.po
+++ b/editor/translations/es.po
@@ -38,12 +38,13 @@
# emma peel <emma.peel@riseup.net>, 2018.
# Vicente Juárez <vijuarez@uc.cl>, 2019.
# juan david julio <illus.kun@gmail.com>, 2019.
+# Patrick Zoch Alves <patrickzochalves@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-19 16:33+0000\n"
-"Last-Translator: eon-s <emanuel.segretin@gmail.com>\n"
+"PO-Revision-Date: 2019-04-30 14:39+0000\n"
+"Last-Translator: Javier Ocampos <xavier.ocampos@gmail.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/"
"godot/es/>\n"
"Language: es\n"
@@ -51,7 +52,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.6.1\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -189,14 +190,20 @@ msgid "Animation Playback Track"
msgstr "Pista de Reproducción de Animación"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Agregar Pista"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Tiempo de Duración de la Animación (segundos)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Tiempo de Duración de la Animación (segundos)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Agregar Pista"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Loop de Animación"
@@ -223,7 +230,7 @@ msgstr "Act./Desact. esta pista."
#: editor/animation_track_editor.cpp
msgid "Update Mode (How this property is set)"
-msgstr "Modo de Actualización (Como esta configurada esta propiedad)"
+msgstr "Modo de Actualización (Como esta configurada esta propriedad)"
#: editor/animation_track_editor.cpp
msgid "Interpolation Mode"
@@ -453,9 +460,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Agrupar las pistas por nodo o mostrarlas como una lista plana."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Snap"
+msgstr "Snap:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -463,7 +469,7 @@ msgstr "Valor de step de animación."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Segundos"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -4856,20 +4862,19 @@ msgstr "Disposición"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Máscara de desplazamiento para insertar claves."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Máscara de rotación para insertar claves."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Máscara de escala para insertar claves."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Insertar Claves (Ins)"
+msgstr "Insertar claves (basadas en máscara)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4878,11 +4883,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Inserción automática de claves cuando los objetos son desplazados, rotados "
+"en escala (basado en máscara).\n"
+"Las claves sólo se añaden a las pistas existentes, no se crearán nuevas "
+"pistas.\n"
+"Las claves deben insertarse manualmente por primera vez."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Insertar clave de animación"
+msgstr "Auto Insertar Clave"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5877,9 +5886,8 @@ msgid "Save Theme As..."
msgstr "Guardar tema como..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " Referencia de clase"
+msgstr "%s Referencia de Clase"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6703,24 +6711,20 @@ msgid "Nameless gizmo"
msgstr "Gizmo sin nombre"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Crear Mesh 2D"
+msgstr "Crear Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Crear Polygon3D"
+msgstr "Crear Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Crear Polígono de Colisión"
+msgstr "Crear CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Crear polígono oclusor"
+msgstr "Crear LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6735,43 +6739,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Geometría inválida, no se puede reemplazar por mesh."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Geometría inválida, no se puede reemplazar por mesh."
+msgstr "Geometría inválida, no es posible crear un polígono."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Geometría inválida, no se puede reemplazar por mesh."
+msgstr "Geometría inválida, no es posible crear un polígono de colisión."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Geometría inválida, no se puede reemplazar por mesh."
+msgstr "Geometría inválida, no es posible crear un oclusor de luz."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Convertir a Mesh 2D"
+msgstr "Convertir a Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Mover polígono"
+msgstr "Convertir a Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Crear Polígono de Colisión"
+msgstr "Crear hermano de CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Crear polígono oclusor"
+msgstr "Crear hermano de LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7357,9 +7354,8 @@ msgid "Duplicate Nodes"
msgstr "Duplicar Nodos"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Eliminar Nodo"
+msgstr "Eliminar Nodos"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po
index e27603d799..39c41edab3 100644
--- a/editor/translations/es_AR.po
+++ b/editor/translations/es_AR.po
@@ -10,12 +10,14 @@
# Reynaldo Cruz <rcruz60@gmail.com>, 2018.
# Javier Ocampos <xavier.ocampos@gmail.com>, 2018, 2019.
# Andrés S <andres.segovia.dev@gmail.com>, 2019.
+# Florencia Menéndez <mariaflormz2@gmail.com>, 2019.
+# roger <616steam@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-03-30 20:04+0000\n"
-"Last-Translator: Lisandro Lorea <lisandrolorea@gmail.com>\n"
+"PO-Revision-Date: 2019-05-16 18:49+0000\n"
+"Last-Translator: roger <616steam@gmail.com>\n"
"Language-Team: Spanish (Argentina) <https://hosted.weblate.org/projects/"
"godot-engine/godot/es_AR/>\n"
"Language: es_AR\n"
@@ -23,7 +25,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -68,7 +70,7 @@ msgstr "En la llamada a '%s':"
#: editor/animation_bezier_editor.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
-msgstr "Libre"
+msgstr "Gratis"
#: editor/animation_bezier_editor.cpp
msgid "Balanced"
@@ -160,14 +162,20 @@ msgid "Animation Playback Track"
msgstr "Pista de Reproducción de Animación"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Agregar Pista"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Tiempo de Duración de la Animación (segundos)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Tiempo de Duración de la Animación (segundos)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Agregar Pista"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Loop de Animación"
@@ -423,9 +431,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Agrupar las pistas por nodo o mostrarlas como una lista plana."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Esnapear"
+msgstr "Snap:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -433,7 +440,7 @@ msgstr "Valor de paso de animación."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Segundos"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -4821,20 +4828,20 @@ msgstr "Layout"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Máscara de traslación para insertar claves."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Máscara de rotación para insertar claves."
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Máscara de rotación para insertar claves."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Insertar Claves (Ins)"
+msgstr "Insertar claves (basadas en máscara)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4843,11 +4850,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Inserción automática de claves cuando los objetos son trasladados, rotados o "
+"escalados (basado en máscara).\n"
+"Las claves sólo se añaden a las pistas existentes, no se crearán nuevas "
+"pistas.\n"
+"Las claves deben insertarse manualmente por primera vez."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Insertar Clave de Animación"
+msgstr "Auto Insertar Clave"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5837,9 +5848,8 @@ msgid "Save Theme As..."
msgstr "Guardar Tema Como..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " Referencia de Clases"
+msgstr "%s Referencia de Clase"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6663,24 +6673,20 @@ msgid "Nameless gizmo"
msgstr "Gizmo sin nombre"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Crear Mesh 2D"
+msgstr "Crear Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Crear Polygon3D"
+msgstr "Crear Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Crear Polígono de Colisión"
+msgstr "Crear CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Crear Polígono Oclusor"
+msgstr "Crear LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6695,43 +6701,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Geometría inválida, no se puede reemplazar por mesh."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Geometría inválida, no se puede reemplazar por mesh."
+msgstr "Geometría inválida, no es posible crear un polígono."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Geometría inválida, no se puede reemplazar por mesh."
+msgstr "Geometría inválida, no es posible crear un polígono de colisión."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Geometría inválida, no se puede reemplazar por mesh."
+msgstr "Geometría inválida, no es posible crear un oclusor de luz."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Convertir A Mesh 2D"
+msgstr "Convertir a Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Mover Polígono"
+msgstr "Convertir a Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Crear Polígono de Colisión"
+msgstr "Crear hermano de CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Crear Polígono Oclusor"
+msgstr "Crear hermano de LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7316,9 +7315,8 @@ msgid "Duplicate Nodes"
msgstr "Duplicar Nodos"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Eliminar Nodo"
+msgstr "Eliminar Nodos"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/et.po b/editor/translations/et.po
index 455623f6aa..43720cc344 100644
--- a/editor/translations/et.po
+++ b/editor/translations/et.po
@@ -146,11 +146,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/fa.po b/editor/translations/fa.po
index 445b941a96..d3c016bc2d 100644
--- a/editor/translations/fa.po
+++ b/editor/translations/fa.po
@@ -170,14 +170,20 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "ترک را اضاÙÙ‡ Ú©Ù†"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "طول انیمیشن (به ثانیه)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "طول انیمیشن (به ثانیه)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "ترک را اضاÙÙ‡ Ú©Ù†"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "تکرار انیمیشن"
diff --git a/editor/translations/fi.po b/editor/translations/fi.po
index 117aaa6561..27df98cab3 100644
--- a/editor/translations/fi.po
+++ b/editor/translations/fi.po
@@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-03 22:06+0000\n"
+"PO-Revision-Date: 2019-05-04 13:48+0000\n"
"Last-Translator: Tapani Niemi <tapani.niemi@kapsi.fi>\n"
"Language-Team: Finnish <https://hosted.weblate.org/projects/godot-engine/"
"godot/fi/>\n"
@@ -22,7 +22,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -159,14 +159,20 @@ msgid "Animation Playback Track"
msgstr "Animaatiotoistoraita"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Lisää raita"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Animaation pituus (sekunteina)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Animaation pituus (sekunteina)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Lisää raita"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Animaation kierto"
@@ -416,9 +422,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Ryhmitä raidat solmujen mukaan tai näytä ne tavallisena luettelona."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Tartu"
+msgstr "Tartu:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -426,7 +431,7 @@ msgstr "Animaation askelluksen arvo."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Sekunnit"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -4792,20 +4797,19 @@ msgstr "Asettelu"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Siirrosmaski avainruutujen lisäämiseen."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Kierrosmaski avainruutujen lisäämiseen."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Skaalausmaski avainruutujen lisäämiseen."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Lisää avainruutu (olemassa olevat raidat)"
+msgstr "Lisää avainruutuja (maskiin perustuen)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4814,11 +4818,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Lisää avainruutuja automaattisesti, kun objekteja siirretään, kierretään tai "
+"skaalataan (maskiin perustuen).\n"
+"Avainruutuja lisätään vain olemassa oleville raidoille, uusia raitoja ei "
+"luoda.\n"
+"Avainruudut täytyy lisätä ensimmäisellä kerralla käsin."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Animaatio: Lisää avain"
+msgstr "Lisää avainruutuja automaattisesti"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5808,9 +5816,8 @@ msgid "Save Theme As..."
msgstr "Tallenna teema nimellä..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " Luokan referenssi"
+msgstr "%s luokan referenssi"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6634,24 +6641,20 @@ msgid "Nameless gizmo"
msgstr "Nimetön muokkain"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Luo 2D-mesh"
+msgstr "Luo Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Luo Polygon3D"
+msgstr "Luo Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Luo törmäyspolygoni"
+msgstr "Luo CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Luo peittopolygoni"
+msgstr "Luo LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6666,43 +6669,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Virheellinen geometria, ei voida korvata meshillä."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Virheellinen geometria, ei voida korvata meshillä."
+msgstr "Virheellinen geometria, ei voida luoda polygonia."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Virheellinen geometria, ei voida korvata meshillä."
+msgstr "Virheellinen geometria, ei voida luoda törmäyspolygonia."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Virheellinen geometria, ei voida korvata meshillä."
+msgstr "Virheellinen geometria, ei voida luoda valopeitettä."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Muunna 2D-meshiksi"
+msgstr "Muunna Mesh2D resurssiksi"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Siirrä polygonia"
+msgstr "Muunna Polygon2D solmuksi"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Luo törmäyspolygoni"
+msgstr "Luo CollisionPolygon2D solmun sisar"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Luo peittopolygoni"
+msgstr "Luo LightOccluder2D solmun sisar"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7287,9 +7283,8 @@ msgid "Duplicate Nodes"
msgstr "Kahdenna solmut"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Poista solmu"
+msgstr "Poista solmut"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/fil.po b/editor/translations/fil.po
index aece9febdd..86133e9264 100644
--- a/editor/translations/fil.po
+++ b/editor/translations/fil.po
@@ -152,11 +152,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/fr.po b/editor/translations/fr.po
index 37175d7001..a3a74d7d41 100644
--- a/editor/translations/fr.po
+++ b/editor/translations/fr.po
@@ -55,11 +55,12 @@
# Caye Pierre <pierrecaye@laposte.net>, 2019.
# Peter Kent <0.peter.kent@gmail.com>, 2019.
# jef dered <themen098s@vivaldi.net>, 2019.
+# Patrick Zoch Alves <patrickzochalves@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-05 13:04+0000\n"
+"PO-Revision-Date: 2019-05-20 11:49+0000\n"
"Last-Translator: Caye Pierre <pierrecaye@laposte.net>\n"
"Language-Team: French <https://hosted.weblate.org/projects/godot-engine/"
"godot/fr/>\n"
@@ -68,7 +69,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -80,15 +81,15 @@ msgstr ""
#: modules/mono/glue/gd_glue.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Not enough bytes for decoding bytes, or invalid format."
-msgstr "Pas assez d'octets pour les octets de décodage, ou format non valide."
+msgstr "Pas assez d'octets pour le décodage, ou format non valide."
#: core/math/expression.cpp
msgid "Invalid input %i (not passed) in expression"
-msgstr "Entrée non valide %i (non passée) dans l’expression"
+msgstr "Entrée non valide %i (pas passée) dans l’expression"
#: core/math/expression.cpp
msgid "self can't be used because instance is null (not passed)"
-msgstr "self ne peut être utilisé car l'instance est null (non fournie)"
+msgstr "self ne peut être utilisé car l'instance est null (pas passée)"
#: core/math/expression.cpp
msgid "Invalid operands to operator %s, %s and %s."
@@ -100,15 +101,15 @@ msgstr "Index de type %s invalide pour le type de base %s"
#: core/math/expression.cpp
msgid "Invalid named index '%s' for base type %s"
-msgstr "Index nommé %s invalide pour le type de base %s"
+msgstr "Nom d'index '%s' invalide pour le type de base %s"
#: core/math/expression.cpp
msgid "Invalid arguments to construct '%s'"
-msgstr "Arguments invalides pour construire « %s »"
+msgstr "Arguments invalides pour construire '%s'"
#: core/math/expression.cpp
msgid "On call to '%s':"
-msgstr "Sur appel à « %s » :"
+msgstr "Sur appel à '%s' :"
#: editor/animation_bezier_editor.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -129,11 +130,11 @@ msgstr "Insérer la clé ici"
#: editor/animation_bezier_editor.cpp
msgid "Duplicate Selected Key(s)"
-msgstr "Dupliquer les clé(s) sélectionnée(s)"
+msgstr "Dupliquer la(les) clé(s) sélectionnée(s)"
#: editor/animation_bezier_editor.cpp
msgid "Delete Selected Key(s)"
-msgstr "Supprimer les clé(s) sélectionnée(s)"
+msgstr "Supprimer (la)les clé(s) sélectionnée(s)"
#: editor/animation_bezier_editor.cpp
msgid "Add Bezier Point"
@@ -153,23 +154,23 @@ msgstr "Supprimer les clés d'animation"
#: editor/animation_track_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr "Modifier le temps d'image-clé"
+msgstr "Modifier le temps de l'image-clé"
#: editor/animation_track_editor.cpp
msgid "Anim Change Transition"
-msgstr "Changement de transition de l'animation"
+msgstr "Changer la transition de l'animation"
#: editor/animation_track_editor.cpp
msgid "Anim Change Transform"
-msgstr "Anim: Change Transformation"
+msgstr "Changer la transformation de l'animation"
#: editor/animation_track_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr "Anim: Change Valeur de l'Image Clé"
+msgstr "Changer la valeur de l'image-clé de l'animation"
#: editor/animation_track_editor.cpp
msgid "Anim Change Call"
-msgstr "Anim: Change l'Appel"
+msgstr "Changer l'appel de l'animation"
#: editor/animation_track_editor.cpp
msgid "Change Animation Length"
@@ -205,14 +206,18 @@ msgid "Animation Playback Track"
msgstr "Piste de lecture d'animation"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Ajouter une piste"
+msgid "Animation length (frames)"
+msgstr "Durée de l'animation (en images)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Durée de l'animation (en secondes)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Ajouter une piste"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Bouclage de l'animation"
@@ -247,7 +252,7 @@ msgstr "Mode d'interpolation"
#: editor/animation_track_editor.cpp
msgid "Loop Wrap Mode (Interpolate end with beginning on loop)"
-msgstr "Mode bouclé (fin interpolée avec début en boucle)"
+msgstr "Mode bouclé (fin interpolée avec le début dans la boucle)"
#: editor/animation_track_editor.cpp
msgid "Remove this track."
@@ -255,11 +260,11 @@ msgstr "Supprime cette piste."
#: editor/animation_track_editor.cpp
msgid "Time (s): "
-msgstr "Temps (s) : "
+msgstr "Temps (s): "
#: editor/animation_track_editor.cpp
msgid "Toggle Track Enabled"
-msgstr "Activer le basculement de piste"
+msgstr "Basculement de piste activé"
#: editor/animation_track_editor.cpp
msgid "Continuous"
@@ -473,9 +478,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Grouper les pistes par nœuds ou les afficher dans une liste simple."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Aligner"
+msgstr "Aligner :"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -483,7 +487,7 @@ msgstr "Valeur du pas d'animation."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Secondes"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -4888,20 +4892,19 @@ msgstr "Disposition sur l'écran"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Masque de translation pour l'insertion des clés."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Masque de rotation pour l'insertion des clés."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Masque de mise à l'échelle pour l'insertion des clés."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Insérer une clé (pistes existantes)"
+msgstr "Insérer des clés (en fonction du masque)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4910,11 +4913,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Insertion automatique des clés lors de la translation des objets, rotation à "
+"l'échelle (en fonction du masque).\n"
+"Les clés ne sont ajoutées qu'aux pistes existantes, aucune nouvelle piste ne "
+"sera créée.\n"
+"Les clés doivent être insérées manuellement pour la première fois."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Insérer une clé d'animation"
+msgstr "Auto insertion de clé"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5911,9 +5918,8 @@ msgid "Save Theme As..."
msgstr "Enregistrer le thème sous…"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " Référence de classe"
+msgstr "Référence de classe %s"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6740,24 +6746,20 @@ msgid "Nameless gizmo"
msgstr "Gadget sans nom"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Créer un maillage 2D"
+msgstr "Créer un Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Créer un Polygon3D"
+msgstr "Créer un Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Créer le polygone de collision"
+msgstr "Créer un CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Créer un polygone occulteur"
+msgstr "Créer un LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6774,43 +6776,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Géométrie invalide, impossible de remplacer par un maillage."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Géométrie invalide, impossible de remplacer par un maillage."
+msgstr "Géométrie invalide, impossible de créer le polygone."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Géométrie invalide, impossible de remplacer par un maillage."
+msgstr "Géométrie invalide, impossible de créer le polygone de collision."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Géométrie invalide, impossible de remplacer par un maillage."
+msgstr "Géométrie invalide, impossible de créer l'occulteur de lumière."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Convertir en maillage 2D"
+msgstr "Convertir en Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Déplacer le polygone"
+msgstr "Convertir en Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Créer le polygone de collision"
+msgstr "Créer un CollisionPolygon2D frère"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Créer un polygone occulteur"
+msgstr "Créer un LightOccluder2D frère"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -6842,7 +6837,7 @@ msgstr "Le presse-papiers des ressources est vide ou n'est pas une texture !"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Paste Frame"
-msgstr "Coller Frame"
+msgstr "Coller une image"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Empty"
@@ -6850,7 +6845,7 @@ msgstr "Ajouter vide"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Change Animation FPS"
-msgstr "Modifier le taux d'IPS de l'animation"
+msgstr "Modifier le nombre d'images par seconde de l'animation"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "(empty)"
@@ -6866,7 +6861,7 @@ msgstr "Nouvelle animation"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Speed (FPS):"
-msgstr "Vitesse (FPS) :"
+msgstr "Vitesse (IPS) :"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Loop"
@@ -6886,11 +6881,11 @@ msgstr "Insérer vide (après)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Move (Before)"
-msgstr "Déplacer (Avant)"
+msgstr "Déplacer (avant)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Move (After)"
-msgstr "Déplacer (Après)"
+msgstr "Déplacer (après)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "SpriteFrames"
@@ -7397,9 +7392,8 @@ msgid "Duplicate Nodes"
msgstr "Dupliquer le(s) nœud(s)"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Supprimer un nœud"
+msgstr "Supprimer des nœuds"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/he.po b/editor/translations/he.po
index 8ef45fd8d8..1bde350633 100644
--- a/editor/translations/he.po
+++ b/editor/translations/he.po
@@ -166,14 +166,20 @@ msgstr "שקופיות ההנפשה"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "הוספת רצועות חדשות."
+msgid "Animation length (frames)"
+msgstr "משך ההנפשה (בשניות)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "משך ההנפשה (בשניות)"
#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "הוספת רצועות חדשות."
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "תקריב הנפשה"
diff --git a/editor/translations/hi.po b/editor/translations/hi.po
index f7bf57678d..7bc92cc5b7 100644
--- a/editor/translations/hi.po
+++ b/editor/translations/hi.po
@@ -5,12 +5,13 @@
# Abhas Kumar Sinha <abhaskumarsinha@gmail.com>, 2017.
# Suryansh5545 <suryanshpathak5545@gmail.com>, 2018.
# Vikram1323 <vikram1323@gmail.com>, 2018.
+# vkubre <v@kubre.in>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-12-13 14:40+0100\n"
-"Last-Translator: Vikram1323 <vikram1323@gmail.com>\n"
+"PO-Revision-Date: 2019-05-04 13:48+0000\n"
+"Last-Translator: vkubre <v@kubre.in>\n"
"Language-Team: Hindi <https://hosted.weblate.org/projects/godot-engine/godot/"
"hi/>\n"
"Language: hi\n"
@@ -18,7 +19,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Poedit 2.2\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -70,7 +71,7 @@ msgstr "संतà¥à¤²à¤¿à¤¤"
#: editor/animation_bezier_editor.cpp
msgid "Mirror"
-msgstr ""
+msgstr "पà¥à¤°à¤¤à¤¿à¤®à¤¾"
#: editor/animation_bezier_editor.cpp
msgid "Insert Key Here"
@@ -87,7 +88,7 @@ msgstr "चयनित फ़ाइलें हटाà¤à¤‚?"
#: editor/animation_bezier_editor.cpp
msgid "Add Bezier Point"
-msgstr ""
+msgstr "बेज़ियर पॉइंट तैयार करे"
#: editor/animation_bezier_editor.cpp
msgid "Move Bezier Points"
@@ -161,14 +162,20 @@ msgstr "à¤à¤¨à¤¿à¤®à¥‡à¤¶à¤¨ पà¥à¤²à¥‡à¤¬à¥ˆà¤• टà¥à¤°à¥ˆà¤•"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "टà¥à¤°à¥ˆà¤• जोड़ें"
+msgid "Animation length (frames)"
+msgstr "à¤à¤¨à¤¿à¤®à¥‡à¤¶à¤¨ लंबाई समय (सेकंडà¥à¤¸)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "à¤à¤¨à¤¿à¤®à¥‡à¤¶à¤¨ लंबाई समय (सेकंडà¥à¤¸)"
#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "टà¥à¤°à¥ˆà¤• जोड़ें"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "à¤à¤¨à¤¿à¤®à¥‡à¤¶à¤¨ लूप"
diff --git a/editor/translations/hr.po b/editor/translations/hr.po
index a7501f9b14..10da7d4fc0 100644
--- a/editor/translations/hr.po
+++ b/editor/translations/hr.po
@@ -3,11 +3,12 @@
# Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
# Unlimited Creativity <marinosah1@gmail.com>, 2019.
+# Patik <patrikfs5@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2019-01-06 15:06+0000\n"
-"Last-Translator: Unlimited Creativity <marinosah1@gmail.com>\n"
+"PO-Revision-Date: 2019-05-20 11:49+0000\n"
+"Last-Translator: Patik <patrikfs5@gmail.com>\n"
"Language-Team: Croatian <https://hosted.weblate.org/projects/godot-engine/"
"godot/hr/>\n"
"Language: hr\n"
@@ -15,7 +16,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 3.4-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -26,35 +27,35 @@ msgstr "Neispravni argument za convert(), upotrijebi konstantu TYPE_*"
#: modules/mono/glue/gd_glue.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Not enough bytes for decoding bytes, or invalid format."
-msgstr ""
+msgstr "Nedovoljno byte-ova za dekodiranje byte-ova, ili neispravni format."
#: core/math/expression.cpp
msgid "Invalid input %i (not passed) in expression"
-msgstr ""
+msgstr "Neispravni ulaz %i (nije proslijeđen) u izrazu"
#: core/math/expression.cpp
msgid "self can't be used because instance is null (not passed)"
-msgstr ""
+msgstr "'self' nije moguće koristiti jer je instanca null (ništa)"
#: core/math/expression.cpp
msgid "Invalid operands to operator %s, %s and %s."
-msgstr ""
+msgstr "Nevažeći operatori za operator %s, %s i %s."
#: core/math/expression.cpp
msgid "Invalid index of type %s for base type %s"
-msgstr ""
+msgstr "Nevažeći indeks za tip %s baznog tipa %s"
#: core/math/expression.cpp
msgid "Invalid named index '%s' for base type %s"
-msgstr ""
+msgstr "NevažeÄi imenovani indeks '%s' za bazni tip %s"
#: core/math/expression.cpp
msgid "Invalid arguments to construct '%s'"
-msgstr ""
+msgstr "Nevažeći argumenti za konstrukciju '%s'"
#: core/math/expression.cpp
msgid "On call to '%s':"
-msgstr ""
+msgstr "Pri pozivu '%s':"
#: editor/animation_bezier_editor.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -63,7 +64,7 @@ msgstr ""
#: editor/animation_bezier_editor.cpp
msgid "Balanced"
-msgstr ""
+msgstr "Balansiran"
#: editor/animation_bezier_editor.cpp
msgid "Mirror"
@@ -71,23 +72,23 @@ msgstr ""
#: editor/animation_bezier_editor.cpp
msgid "Insert Key Here"
-msgstr ""
+msgstr "Unesite kljuÄ ovdje"
#: editor/animation_bezier_editor.cpp
msgid "Duplicate Selected Key(s)"
-msgstr ""
+msgstr "Duplikati Odabranih KljuÄeva"
#: editor/animation_bezier_editor.cpp
msgid "Delete Selected Key(s)"
-msgstr ""
+msgstr "Brisati odabrani kljuÄ/odabrane kljuÄeve"
#: editor/animation_bezier_editor.cpp
msgid "Add Bezier Point"
-msgstr ""
+msgstr "Dodaj Bezier ToÄku"
#: editor/animation_bezier_editor.cpp
msgid "Move Bezier Points"
-msgstr ""
+msgstr "Pomakni Bezier ToÄke"
#: editor/animation_bezier_editor.cpp editor/animation_track_editor.cpp
msgid "Anim Duplicate Keys"
@@ -151,45 +152,51 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr ""
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Trajanje animacije (u sekundama)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
-msgstr ""
+#, fuzzy
+msgid "Animation length (seconds)"
+msgstr "Trajanje animacije (u sekundama)"
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Dodati stazu"
#: editor/animation_track_editor.cpp
msgid "Animation Looping"
-msgstr ""
+msgstr "Ponavljanje Animacije"
#: editor/animation_track_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Functions:"
-msgstr ""
+msgstr "Funkcije:"
#: editor/animation_track_editor.cpp
msgid "Audio Clips:"
-msgstr ""
+msgstr "Audio Klipovi:"
#: editor/animation_track_editor.cpp
msgid "Anim Clips:"
-msgstr ""
+msgstr "Animacijski Klipovi:"
#: editor/animation_track_editor.cpp
msgid "Change Track Path"
-msgstr ""
+msgstr "Promijeni Put Staze"
#: editor/animation_track_editor.cpp
msgid "Toggle this track on/off."
-msgstr ""
+msgstr "Upali/ugasi ovu stazu."
#: editor/animation_track_editor.cpp
msgid "Update Mode (How this property is set)"
-msgstr ""
+msgstr "NaÄin ažuriranja (kako se ovo svojstvo postavlja)"
#: editor/animation_track_editor.cpp
msgid "Interpolation Mode"
-msgstr ""
+msgstr "NaÄin Interpolacije"
#: editor/animation_track_editor.cpp
msgid "Loop Wrap Mode (Interpolate end with beginning on loop)"
@@ -197,27 +204,27 @@ msgstr ""
#: editor/animation_track_editor.cpp
msgid "Remove this track."
-msgstr ""
+msgstr "Ukloni ovu stazu."
#: editor/animation_track_editor.cpp
msgid "Time (s): "
-msgstr ""
+msgstr "Vrijeme/vremena: "
#: editor/animation_track_editor.cpp
msgid "Toggle Track Enabled"
-msgstr ""
+msgstr "Upali/Ugasi Stazu"
#: editor/animation_track_editor.cpp
msgid "Continuous"
-msgstr ""
+msgstr "Kontinuirano"
#: editor/animation_track_editor.cpp
msgid "Discrete"
-msgstr ""
+msgstr "Diskretno"
#: editor/animation_track_editor.cpp
msgid "Trigger"
-msgstr ""
+msgstr "OkidaÄ"
#: editor/animation_track_editor.cpp
msgid "Capture"
@@ -225,16 +232,16 @@ msgstr ""
#: editor/animation_track_editor.cpp
msgid "Nearest"
-msgstr ""
+msgstr "Najbliži"
#: editor/animation_track_editor.cpp editor/plugins/curve_editor_plugin.cpp
#: editor/property_editor.cpp
msgid "Linear"
-msgstr ""
+msgstr "Linearno"
#: editor/animation_track_editor.cpp
msgid "Cubic"
-msgstr ""
+msgstr "Kubno"
#: editor/animation_track_editor.cpp
msgid "Clamp Loop Interp"
@@ -247,39 +254,39 @@ msgstr ""
#: editor/animation_track_editor.cpp
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key"
-msgstr ""
+msgstr "Umetni KljuÄ"
#: editor/animation_track_editor.cpp
msgid "Duplicate Key(s)"
-msgstr ""
+msgstr "Duplicirani kljuÄ(evi)"
#: editor/animation_track_editor.cpp
msgid "Delete Key(s)"
-msgstr ""
+msgstr "ObriÅ¡i kljuÄ(eve)"
#: editor/animation_track_editor.cpp
msgid "Change Animation Update Mode"
-msgstr ""
+msgstr "Promijeni NaÄin Ažuriranja Animacije"
#: editor/animation_track_editor.cpp
msgid "Change Animation Interpolation Mode"
-msgstr ""
+msgstr "Promijeni NaÄin Interpolacije Animacije"
#: editor/animation_track_editor.cpp
msgid "Change Animation Loop Mode"
-msgstr ""
+msgstr "Promijeni NaÄin Ponavljanja Animacije"
#: editor/animation_track_editor.cpp
msgid "Remove Anim Track"
-msgstr ""
+msgstr "Ukloni Stazu Animacije"
#: editor/animation_track_editor.cpp
msgid "Create NEW track for %s and insert key?"
-msgstr ""
+msgstr "Stvori NOVU stazu za %s i umetni kljuÄ?"
#: editor/animation_track_editor.cpp
msgid "Create %d NEW tracks and insert keys?"
-msgstr ""
+msgstr "Napravi %d NOVIH staza i umetni kljuÄeve?"
#: editor/animation_track_editor.cpp editor/create_dialog.cpp
#: editor/editor_audio_buses.cpp editor/editor_plugin_settings.cpp
@@ -288,7 +295,7 @@ msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp editor/script_create_dialog.cpp
msgid "Create"
-msgstr ""
+msgstr "Stvori"
#: editor/animation_track_editor.cpp
msgid "Anim Insert"
@@ -296,27 +303,27 @@ msgstr ""
#: editor/animation_track_editor.cpp
msgid "AnimationPlayer can't animate itself, only other players."
-msgstr ""
+msgstr "Animator ne može animirati sebe, samo druge animatore."
#: editor/animation_track_editor.cpp
msgid "Anim Create & Insert"
-msgstr ""
+msgstr "Anim Stvori & Umetni"
#: editor/animation_track_editor.cpp
msgid "Anim Insert Track & Key"
-msgstr ""
+msgstr "Anim Umetni Stazu & KljuÄ"
#: editor/animation_track_editor.cpp
msgid "Anim Insert Key"
-msgstr ""
+msgstr "Anim Umetni KljuÄ"
#: editor/animation_track_editor.cpp
msgid "Change Animation Step"
-msgstr ""
+msgstr "Promijeni Korak Animacije"
#: editor/animation_track_editor.cpp
msgid "Rearrange Tracks"
-msgstr ""
+msgstr "Preuredi Staze"
#: editor/animation_track_editor.cpp
msgid "Transform tracks only apply to Spatial-based nodes."
@@ -336,23 +343,23 @@ msgstr ""
#: editor/animation_track_editor.cpp
msgid "An animation player can't animate itself, only other players."
-msgstr ""
+msgstr "Animator ne može animirati sebe, samo druge objekte."
#: editor/animation_track_editor.cpp
msgid "Not possible to add a new track without a root"
-msgstr ""
+msgstr "Nije moguće dodati novu stazu bez korijena"
#: editor/animation_track_editor.cpp
msgid "Add Bezier Track"
-msgstr ""
+msgstr "Dodaj Bezier Stazu"
#: editor/animation_track_editor.cpp
msgid "Track path is invalid, so can't add a key."
-msgstr ""
+msgstr "Nevažeći put staze, ne mogu dodati kljuÄ."
#: editor/animation_track_editor.cpp
msgid "Track is not of type Spatial, can't insert key"
-msgstr ""
+msgstr "Staza nije tipa Prostorna, ne mogu umetnuti kljuÄ"
#: editor/animation_track_editor.cpp
msgid "Add Transform Track Key"
@@ -360,19 +367,19 @@ msgstr ""
#: editor/animation_track_editor.cpp
msgid "Add Track Key"
-msgstr ""
+msgstr "Dodaj KljuÄ Staze"
#: editor/animation_track_editor.cpp
msgid "Track path is invalid, so can't add a method key."
-msgstr ""
+msgstr "Nevažeći put staze, ne mogu dodati kljuÄ metode."
#: editor/animation_track_editor.cpp
msgid "Add Method Track Key"
-msgstr ""
+msgstr "Dodaj KljuÄ Metode Staze"
#: editor/animation_track_editor.cpp
msgid "Method not found in object: "
-msgstr ""
+msgstr "Metoda nije nađena u objektu: "
#: editor/animation_track_editor.cpp
msgid "Anim Move Keys"
@@ -380,28 +387,29 @@ msgstr ""
#: editor/animation_track_editor.cpp
msgid "Clipboard is empty"
-msgstr ""
+msgstr "Međuspremnik je prazan"
#: editor/animation_track_editor.cpp
msgid "Paste Tracks"
-msgstr ""
+msgstr "Zalijepi Staze"
#: editor/animation_track_editor.cpp
msgid "Anim Scale Keys"
-msgstr ""
+msgstr "Anim Skaliraj KljuÄeve"
#: editor/animation_track_editor.cpp
msgid ""
"This option does not work for Bezier editing, as it's only a single track."
msgstr ""
+"Ova opcija ne radi za editiranje Beziera, zato Å¡to je samo jedna staza."
#: editor/animation_track_editor.cpp
msgid "Only show tracks from nodes selected in tree."
-msgstr ""
+msgstr "Pokaži samo staze Ävorova oznaÄenih u stablu."
#: editor/animation_track_editor.cpp
msgid "Group tracks by node or display them as plain list."
-msgstr ""
+msgstr "Grupiraj staze po Ävoru ili ih prikaži kao obiÄnu listu."
#: editor/animation_track_editor.cpp
msgid "Snap:"
diff --git a/editor/translations/hu.po b/editor/translations/hu.po
index 2f1aa1b660..9ca5955d0d 100644
--- a/editor/translations/hu.po
+++ b/editor/translations/hu.po
@@ -170,16 +170,21 @@ msgstr "Animáció lejátszásának leállítása. (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Animáció nyomvonal hozzáadás"
+msgid "Animation length (frames)"
+msgstr "Animáció hossza (másodpercben)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Animáció hossza (másodpercben)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Animáció nyomvonal hozzáadás"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Animáció nagyítás."
diff --git a/editor/translations/id.po b/editor/translations/id.po
index 876990c0c1..a221eb2276 100644
--- a/editor/translations/id.po
+++ b/editor/translations/id.po
@@ -170,14 +170,20 @@ msgid "Animation Playback Track"
msgstr "Track Pemutar Animasi"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Tambah Track"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Panjang Animasi (detik)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Panjang Animasi (detik)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Tambah Track"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Perulangan Animasi"
diff --git a/editor/translations/is.po b/editor/translations/is.po
index cc911642be..9b43911998 100644
--- a/editor/translations/is.po
+++ b/editor/translations/is.po
@@ -159,15 +159,19 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-#, fuzzy
-msgid "Add Track"
-msgstr "Anim bæta við lag"
+msgid "Animation length (frames)"
+msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr ""
#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "Anim bæta við lag"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr ""
diff --git a/editor/translations/it.po b/editor/translations/it.po
index 3dbfa81714..191e5c8137 100644
--- a/editor/translations/it.po
+++ b/editor/translations/it.po
@@ -37,8 +37,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-14 13:04+0000\n"
-"Last-Translator: Marco Galli <mrcgll98@gmail.com>\n"
+"PO-Revision-Date: 2019-05-16 18:49+0000\n"
+"Last-Translator: MassiminoilTrace <omino.gis@gmail.com>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/godot-engine/"
"godot/it/>\n"
"Language: it\n"
@@ -46,7 +46,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -185,14 +185,20 @@ msgid "Animation Playback Track"
msgstr "Traccia di riproduzione animazione"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Aggiungi Traccia"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Durata Animazione (in secondi)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Durata Animazione (in secondi)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Aggiungi Traccia"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Ciclicità Animazione"
@@ -1823,7 +1829,7 @@ msgstr "Salva risorsa come..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
-msgstr "Impossibile aprire il file per la scrittura:"
+msgstr "Impossibile aprire il file in scrittura:"
#: editor/editor_node.cpp
msgid "Requested file format unknown:"
@@ -2033,11 +2039,11 @@ msgstr "Apri scena rapidamente..."
#: editor/editor_node.cpp
msgid "Quick Open Script..."
-msgstr "Apri Script Rapido..."
+msgstr "Apri script rapidamente..."
#: editor/editor_node.cpp
msgid "Save & Close"
-msgstr "Salva e Chiudi"
+msgstr "Salva e chiudi"
#: editor/editor_node.cpp
msgid "Save changes to '%s' before closing?"
@@ -2053,7 +2059,7 @@ msgstr "È necessario un nodo radice per salvare la scena."
#: editor/editor_node.cpp
msgid "Save Scene As..."
-msgstr "Salva Scena Come..."
+msgstr "Salva scena con nome..."
#: editor/editor_node.cpp
msgid "No"
@@ -2061,7 +2067,7 @@ msgstr "No"
#: editor/editor_node.cpp
msgid "Yes"
-msgstr "Si"
+msgstr "Sì"
#: editor/editor_node.cpp
msgid "This scene has never been saved. Save before running?"
@@ -2089,7 +2095,7 @@ msgstr "Questa operazione non può essere eseguita senza un nodo selezionato."
#: editor/editor_node.cpp
msgid "Current scene not saved. Open anyway?"
-msgstr "Scena corrente non salvata. Aprire comunque?"
+msgstr "Scena attuale non salvata. Aprirla comunque?"
#: editor/editor_node.cpp
msgid "Can't reload a scene that was never saved."
@@ -2105,7 +2111,7 @@ msgstr "Questa azione non può essere annullata. Ripristinare comunque?"
#: editor/editor_node.cpp
msgid "Quick Run Scene..."
-msgstr "Esegui Scena Rapido..."
+msgstr "Esegui scena rapidamente..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -2121,7 +2127,7 @@ msgstr "Aprire Gestione Progetti?"
#: editor/editor_node.cpp
msgid "Save & Quit"
-msgstr "Salva e Esci"
+msgstr "Salva ed esci"
#: editor/editor_node.cpp
msgid "Save changes to the following scene(s) before quitting?"
@@ -2130,19 +2136,20 @@ msgstr "Salvare le modifiche alle scene seguenti prima di uscire?"
#: editor/editor_node.cpp
msgid "Save changes the following scene(s) before opening Project Manager?"
msgstr ""
-"Salvare le modifiche alle scene seguenti prima di aprire il Manager Progetti?"
+"Salvare le modifiche alle scene seguenti prima di aprire la Gestione "
+"progetti?"
#: editor/editor_node.cpp
msgid ""
"This option is deprecated. Situations where refresh must be forced are now "
"considered a bug. Please report."
msgstr ""
-"Questa opzione é deprecata. Situazioni dove un refresh é obbligatorio sono "
-"ora considerate come bug. Si prega di effettuare un report."
+"Questa opzione è deprecata. Situazioni dove un refresh è obbligatorio sono "
+"ora considerate come bug. Si prega di segnalarlo."
#: editor/editor_node.cpp
msgid "Pick a Main Scene"
-msgstr "Scegli una Scena Principale"
+msgstr "Scegli una Scena principale"
#: editor/editor_node.cpp
msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
@@ -2186,9 +2193,9 @@ msgid ""
"Scene '%s' was automatically imported, so it can't be modified.\n"
"To make changes to it, a new inherited scene can be created."
msgstr ""
-"La scena '%s' é stata automaticamente importata, pertanto non puo essere "
+"La scena '%s' è stata automaticamente importata, pertanto non può essere "
"modificata.\n"
-"Per effettuare cambiamenti, puo essere creata una nuova scena ereditata."
+"Per modificarla, puoi essere creata una nuova scena ereditata."
#: editor/editor_node.cpp
msgid ""
@@ -2205,7 +2212,7 @@ msgstr "La scena '%s' ha rotto le dipendenze:"
#: editor/editor_node.cpp
msgid "Clear Recent Scenes"
-msgstr "Rimuovi Scene Recenti"
+msgstr "Rimuovi scene recenti"
#: editor/editor_node.cpp
msgid "Save Layout"
@@ -2223,7 +2230,7 @@ msgstr "Default"
#: editor/editor_node.cpp editor/editor_properties.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_editor.cpp
msgid "Show in FileSystem"
-msgstr "Mostra nel FileSystem"
+msgstr "Mostra nel filesystem"
#: editor/editor_node.cpp
msgid "Play This Scene"
@@ -2255,11 +2262,11 @@ msgstr "Posizione dock"
#: editor/editor_node.cpp
msgid "Distraction Free Mode"
-msgstr "Modalità Senza Distrazioni"
+msgstr "Modalità senza distrazioni"
#: editor/editor_node.cpp
msgid "Toggle distraction-free mode."
-msgstr "Abilita modalità senza distrazioni."
+msgstr "Commuta modalità senza distrazioni."
#: editor/editor_node.cpp
msgid "Add a new scene."
@@ -2283,7 +2290,7 @@ msgstr "Scheda precedente"
#: editor/editor_node.cpp
msgid "Filter Files..."
-msgstr "Filtra Files..."
+msgstr "Filtra file..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -2295,31 +2302,31 @@ msgstr "Nuova scena"
#: editor/editor_node.cpp
msgid "New Inherited Scene..."
-msgstr "Nuova Scena Ereditata..."
+msgstr "Nuova scena ereditata..."
#: editor/editor_node.cpp
msgid "Open Scene..."
-msgstr "Apri Scena..."
+msgstr "Apri scena..."
#: editor/editor_node.cpp
msgid "Save Scene"
-msgstr "Salva Scena"
+msgstr "Salva scena"
#: editor/editor_node.cpp
msgid "Save All Scenes"
-msgstr "Salva tutte le Scene"
+msgstr "Salva tutte le scene"
#: editor/editor_node.cpp
msgid "Close Scene"
-msgstr "Chiudi Scena"
+msgstr "Chiudi scena"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Open Recent"
-msgstr "Apri Recente"
+msgstr "Apri recente"
#: editor/editor_node.cpp
msgid "Convert To..."
-msgstr "Converti In..."
+msgstr "Converti in..."
#: editor/editor_node.cpp
msgid "MeshLibrary..."
@@ -2337,11 +2344,11 @@ msgstr "Annulla"
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Redo"
-msgstr "Redo"
+msgstr "Rifai"
#: editor/editor_node.cpp
msgid "Revert Scene"
-msgstr "Ripristina Scena"
+msgstr "Ripristina scena"
#: editor/editor_node.cpp
msgid "Miscellaneous project or scene-wide tools."
@@ -2353,7 +2360,7 @@ msgstr "Progetto"
#: editor/editor_node.cpp
msgid "Project Settings"
-msgstr "Impostazioni Progetto"
+msgstr "Impostazioni progetto"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export"
@@ -2369,7 +2376,7 @@ msgstr "Apri la cartella del progetto"
#: editor/editor_node.cpp
msgid "Quit to Project List"
-msgstr "Esci alla Lista Progetti"
+msgstr "Esci e torna alla lista progetti"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
#: editor/project_export.cpp
@@ -2378,7 +2385,7 @@ msgstr "Debug"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
-msgstr "Distribuzione con il Debug Remoto"
+msgstr "Distribuzione con Debug remoto"
#: editor/editor_node.cpp
msgid ""
@@ -2409,14 +2416,14 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Visible Collision Shapes"
-msgstr "Forme di Collisione Visibili"
+msgstr "Forme di collisione visibili"
#: editor/editor_node.cpp
msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
-"Le forme di collisione e i nodi di raycast (per il 2D e 3D) Saranno visibili "
+"Le forme di collisione e i nodi di raycast (per il 2D e 3D) saranno visibili "
"nel gioco in esecuzione se l'opzione è attiva."
#: editor/editor_node.cpp
@@ -2433,7 +2440,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr "Sincronizza Cambiamenti Scena"
+msgstr "Sincronizza cambiamenti scena"
#: editor/editor_node.cpp
msgid ""
@@ -2444,12 +2451,12 @@ msgid ""
msgstr ""
"Quando questa opzione è attiva, qualsiasi cambiamento fatto alla scena "
"nell'editor sarà replicato nel gioco in esecuzione.\n"
-"Quando usata remotamente su un dispositivo, essa è più efficiente con il "
+"Quando usata in remoto su un dispositivo, sarà più efficiente con un "
"filesystem in rete."
#: editor/editor_node.cpp
msgid "Sync Script Changes"
-msgstr "Sincronizza Cambiamenti Script"
+msgstr "Sincronizza cambiamenti script"
#: editor/editor_node.cpp
msgid ""
@@ -2460,7 +2467,7 @@ msgid ""
msgstr ""
"Quando questa opzione è attiva, qualsiasi script salvato verrà ricaricato "
"nel gioco in esecuzione.\n"
-"Quando usata remotamente su un dispositivo, essa è più efficiente con il "
+"Quando usata in remoto su un dispositivo, sarà più efficiente con un "
"filesystem in rete."
#: editor/editor_node.cpp
@@ -2469,31 +2476,31 @@ msgstr "Editor"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
-msgstr "Impostazioni Editor"
+msgstr "Impostazioni editor"
#: editor/editor_node.cpp
msgid "Editor Layout"
-msgstr "Layout dell'Editor"
+msgstr "Layout dell'editor"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
-msgstr "Abilita/Disabilita Fullscreen"
+msgstr "Abilita/Disabilita modalità a schermo intero"
#: editor/editor_node.cpp
msgid "Open Editor Data/Settings Folder"
-msgstr "Apri Cartella Dati/Impostazioni Editor"
+msgstr "Apri cartella dati/impostazioni editor"
#: editor/editor_node.cpp
msgid "Open Editor Data Folder"
-msgstr "Apri la Cartella Dati dell'Editor"
+msgstr "Apri la cartella dati dell'editor"
#: editor/editor_node.cpp
msgid "Open Editor Settings Folder"
-msgstr "Apri Cartella Impostazioni Editor"
+msgstr "Apri cartella impostazioni editor"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
-msgstr "Gestisci Template d'Esportazione"
+msgstr "Gestisci template d'esportazione"
#: editor/editor_node.cpp
msgid "Help"
@@ -2509,15 +2516,15 @@ msgstr "Cerca"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Online Docs"
-msgstr "Documentazione Online"
+msgstr "Documentazione online"
#: editor/editor_node.cpp
msgid "Q&A"
-msgstr "Domande e Risposte"
+msgstr "Domande e risposte"
#: editor/editor_node.cpp
msgid "Issue Tracker"
-msgstr "Tracciatore Segnalazioni"
+msgstr "Tracciatore segnalazioni"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
msgid "Community"
@@ -2533,7 +2540,7 @@ msgstr "Esegui il progetto."
#: editor/editor_node.cpp
msgid "Play"
-msgstr "Play"
+msgstr "Esegui"
#: editor/editor_node.cpp
msgid "Pause the scene"
@@ -2549,7 +2556,7 @@ msgstr "Ferma la scena."
#: editor/editor_node.cpp editor/editor_profiler.cpp
msgid "Stop"
-msgstr "Stop"
+msgstr "Ferma"
#: editor/editor_node.cpp
msgid "Play the edited scene."
@@ -2557,7 +2564,7 @@ msgstr "Esegui la scena in modifica."
#: editor/editor_node.cpp
msgid "Play Scene"
-msgstr "Esegui Scena"
+msgstr "Esegui scena"
#: editor/editor_node.cpp
msgid "Play custom scene"
@@ -2565,7 +2572,7 @@ msgstr "Esegui scena personalizzata"
#: editor/editor_node.cpp
msgid "Play Custom Scene"
-msgstr "Esegui Scena Personalizzata"
+msgstr "Esegui scena personalizzata"
#: editor/editor_node.cpp
msgid "Changing the video driver requires restarting the editor."
@@ -2574,23 +2581,23 @@ msgstr "Il cambiamento dei driver video necessita il riavvio dell'editor."
#: editor/editor_node.cpp editor/project_settings_editor.cpp
#: editor/settings_config_dialog.cpp
msgid "Save & Restart"
-msgstr "Salva e Riavvia"
+msgstr "Salva e riavvia"
#: editor/editor_node.cpp
msgid "Spins when the editor window redraws."
-msgstr "Gira quando l'editor viene ridisegnato."
+msgstr "Gira quando la finestra dell'editor viene ridisegnata."
#: editor/editor_node.cpp
msgid "Update Always"
-msgstr "Aggiorna Sempre"
+msgstr "Aggiorna sempre"
#: editor/editor_node.cpp
msgid "Update Changes"
-msgstr "Aggiorna Cambiamenti"
+msgstr "Aggiorna cambiamenti"
#: editor/editor_node.cpp
msgid "Disable Update Spinner"
-msgstr "Disabilita lo Spinner di Update"
+msgstr "Disabilita l'icona girevole di aggiornamento"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_manager.cpp
@@ -2599,11 +2606,11 @@ msgstr "Importa"
#: editor/editor_node.cpp
msgid "FileSystem"
-msgstr "FileSystem"
+msgstr "Filesystem"
#: editor/editor_node.cpp
msgid "Inspector"
-msgstr "Inspector"
+msgstr "Ispettore"
#: editor/editor_node.cpp
msgid "Node"
@@ -2611,7 +2618,7 @@ msgstr "Nodo"
#: editor/editor_node.cpp
msgid "Expand Bottom Panel"
-msgstr "Espandi Pannello Inferiore"
+msgstr "Espandi pannello inferiore"
#: editor/editor_node.cpp scene/resources/visual_shader.cpp
msgid "Output"
@@ -2623,19 +2630,19 @@ msgstr "Non salvare"
#: editor/editor_node.cpp
msgid "Import Templates From ZIP File"
-msgstr "Importa templates Da File ZIP"
+msgstr "Importa template da un file ZIP"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export Project"
-msgstr "Esporta Progetto"
+msgstr "Esporta progetto"
#: editor/editor_node.cpp
msgid "Export Library"
-msgstr "Esporta Libreria"
+msgstr "Esporta libreria"
#: editor/editor_node.cpp
msgid "Merge With Existing"
-msgstr "Unisci Con Esistente"
+msgstr "Unisci con esistente"
#: editor/editor_node.cpp
msgid "Password:"
@@ -2643,15 +2650,15 @@ msgstr "Password:"
#: editor/editor_node.cpp
msgid "Open & Run a Script"
-msgstr "Apri e Esegui uno Script"
+msgstr "Apri ed esegui uno script"
#: editor/editor_node.cpp
msgid "New Inherited"
-msgstr "Nuova Ereditata"
+msgstr "Nuova ereditata"
#: editor/editor_node.cpp
msgid "Load Errors"
-msgstr "Carica Errori"
+msgstr "Carica errori"
#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Select"
@@ -2659,7 +2666,7 @@ msgstr "Seleziona"
#: editor/editor_node.cpp
msgid "Open 2D Editor"
-msgstr "Apri Editor 2D"
+msgstr "Apri editor 2D"
#: editor/editor_node.cpp
msgid "Open 3D Editor"
diff --git a/editor/translations/ja.po b/editor/translations/ja.po
index 67a472c64d..74ea163697 100644
--- a/editor/translations/ja.po
+++ b/editor/translations/ja.po
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-19 16:33+0000\n"
+"PO-Revision-Date: 2019-05-16 18:49+0000\n"
"Last-Translator: Wataru Onuki <watonu@magadou.com>\n"
"Language-Team: Japanese <https://hosted.weblate.org/projects/godot-engine/"
"godot/ja/>\n"
@@ -35,7 +35,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -171,14 +171,20 @@ msgid "Animation Playback Track"
msgstr "アニメーションå†ç”Ÿãƒˆãƒ©ãƒƒã‚¯"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "トラックを追加"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "アニメーションã®é•·ã• (秒)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "アニメーションã®é•·ã• (秒)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "トラックを追加"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "アニメーションループ"
@@ -1395,33 +1401,31 @@ msgid "Packing"
msgstr "パックã™ã‚‹"
#: editor/editor_export.cpp
-#, fuzzy
msgid ""
"Target platform requires 'ETC' texture compression for GLES2. Enable 'Import "
"Etc' in Project Settings."
msgstr ""
"対象プラットフォームã§ã¯GLES2ã®ãŸã‚ã«'ETC'テクスãƒãƒ£åœ§ç¸®ãŒå¿…è¦ã§ã™ã€‚プロジェ"
-"クト設定より有効ã«ã—ã¦ãã ã•ã„。"
+"クト設定より 'Import Etc' をオンã«ã—ã¦ãã ã•ã„。"
#: editor/editor_export.cpp
-#, fuzzy
msgid ""
"Target platform requires 'ETC2' texture compression for GLES3. Enable "
"'Import Etc 2' in Project Settings."
msgstr ""
-"対象プラットフォームã§ã¯GLES2ã®ãŸã‚ã«'ETC'テクスãƒãƒ£åœ§ç¸®ãŒå¿…è¦ã§ã™ã€‚プロジェ"
-"クト設定より有効ã«ã—ã¦ãã ã•ã„。"
+"対象プラットフォームã§ã¯GLES3ã®ãŸã‚ã«'ETC2'テクスãƒãƒ£åœ§ç¸®ãŒå¿…è¦ã§ã™ã€‚プロジェ"
+"クト設定より 'Import Etc 2' をオンã«ã—ã¦ãã ã•ã„。"
#: editor/editor_export.cpp
-#, fuzzy
msgid ""
"Target platform requires 'ETC' texture compression for the driver fallback "
"to GLES2.\n"
"Enable 'Import Etc' in Project Settings, or disable 'Driver Fallback "
"Enabled'."
msgstr ""
-"対象プラットフォームã§ã¯GLES2ã®ãŸã‚ã«'ETC'テクスãƒãƒ£åœ§ç¸®ãŒå¿…è¦ã§ã™ã€‚プロジェ"
-"クト設定より有効ã«ã—ã¦ãã ã•ã„。"
+"対象プラットフォームã§ã¯GLES2ã¸ãƒ•ã‚©ãƒ¼ãƒ«ãƒãƒƒã‚¯ã™ã‚‹ãŸã‚ã«'ETC'テクスãƒãƒ£åœ§ç¸®ãŒ"
+"å¿…è¦ã§ã™ã€‚プロジェクト設定より 'Import Etc' をオンã«ã™ã‚‹ã‹ã€'Fallback To "
+"Gles 2' をオフã«ã—ã¦ãã ã•ã„。"
#: editor/editor_export.cpp platform/android/export/export.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
diff --git a/editor/translations/ka.po b/editor/translations/ka.po
index 26eabd113b..58114e6cef 100644
--- a/editor/translations/ka.po
+++ b/editor/translations/ka.po
@@ -162,15 +162,20 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "áƒáƒœáƒ˜áƒ›áƒáƒªáƒ˜áƒ˜áƒ¡ თრექის დáƒáƒ›áƒáƒ¢áƒ”ბáƒ"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "áƒáƒœáƒ˜áƒ›áƒáƒªáƒ˜áƒ˜áƒ¡ ხáƒáƒœáƒ’რძლივáƒáƒ‘რ(წáƒáƒ›áƒ”ბში)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "áƒáƒœáƒ˜áƒ›áƒáƒªáƒ˜áƒ˜áƒ¡ ხáƒáƒœáƒ’რძლივáƒáƒ‘რ(წáƒáƒ›áƒ”ბში)."
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "áƒáƒœáƒ˜áƒ›áƒáƒªáƒ˜áƒ˜áƒ¡ თრექის დáƒáƒ›áƒáƒ¢áƒ”ბáƒ"
+
+#: editor/animation_track_editor.cpp
#, fuzzy
msgid "Animation Looping"
msgstr "áƒáƒœáƒ˜áƒ›áƒáƒªáƒ˜áƒ˜áƒ¡ ბრუნვáƒ"
diff --git a/editor/translations/ko.po b/editor/translations/ko.po
index eb7964f81d..f92a66c981 100644
--- a/editor/translations/ko.po
+++ b/editor/translations/ko.po
@@ -17,8 +17,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-05 13:04+0000\n"
-"Last-Translator: moolow <copyhyeon@gmail.com>\n"
+"PO-Revision-Date: 2019-05-10 08:15+0000\n"
+"Last-Translator: 송태섭 <xotjq237@gmail.com>\n"
"Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/"
"godot/ko/>\n"
"Language: ko\n"
@@ -26,7 +26,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -163,14 +163,20 @@ msgid "Animation Playback Track"
msgstr "애니메ì´ì…˜ ìž¬ìƒ íŠ¸ëž™"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "트랙 추가"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "애니메ì´ì…˜ ê¸¸ì´ ì‹œê°„ (ì´ˆ)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "애니메ì´ì…˜ ê¸¸ì´ ì‹œê°„ (ì´ˆ)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "트랙 추가"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "애니메ì´ì…˜ 반복"
@@ -250,11 +256,11 @@ msgstr "입방형"
#: editor/animation_track_editor.cpp
msgid "Clamp Loop Interp"
-msgstr "í´ëž¨í”„ 루프 ì¸í„°í”„리터"
+msgstr "루프 보간 고정"
#: editor/animation_track_editor.cpp
msgid "Wrap Loop Interp"
-msgstr "ëž© 루프 ì¸í„°í”„리터"
+msgstr "루프 ë³´ê°„ ê°ì¶”기"
#: editor/animation_track_editor.cpp
#: editor/plugins/canvas_item_editor_plugin.cpp
@@ -422,9 +428,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "노드 별로 ê·¸ë£¹ì„ íŠ¸ëž™ 하거나 ì¼ë°˜ 목ë¡ìœ¼ë¡œ 표시합니다."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "스냅"
+msgstr "스냅:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -432,7 +437,7 @@ msgstr "애니메ì´ì…˜ 단계 ê°’."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "ì´ˆ"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -4773,20 +4778,19 @@ msgstr "ë ˆì´ì•„웃"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "키를 삽입하기 위한 전환 마스í¬."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "키를 삽입하기 위한 회전 마스í¬."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "키를 삽입하기 위한 규모 마스í¬."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "키 삽입 (Ins 키)"
+msgstr "키 삽입 (ë§ˆìŠ¤í¬ ê¸°ì¤€)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4795,11 +4799,13 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"물체가 ì „í™˜ë  ë•Œ ìžë™ìœ¼ë¡œ 키를 삽입합니다, 회전 ë˜ëŠ” 규모 (ë§ˆìŠ¤í¬ ê¸°ì¤€).\n"
+"키는 기존 트랙ì—만 추가ë˜ë©°, 새 íŠ¸ëž™ì´ ë§Œë“¤ì–´ì§€ì§€ 않습니다.\n"
+"처ìŒì— 키는 수ë™ìœ¼ë¡œ 삽입하여야 합니다."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "애니메ì´ì…˜ 키 삽입"
+msgstr "ìžë™ 키 삽입"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5785,9 +5791,8 @@ msgid "Save Theme As..."
msgstr "테마 다른 ì´ë¦„으로 저장..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " í´ëž˜ìŠ¤ ë ˆí¼ëŸ°ìŠ¤"
+msgstr "%s í´ëž˜ìŠ¤ 참조"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6420,7 +6425,7 @@ msgstr "í¬ê¸° ì¡°ì ˆ 모드 (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
-msgstr "로컬 좌표"
+msgstr "지역 좌표"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
@@ -6612,24 +6617,20 @@ msgid "Nameless gizmo"
msgstr "ì´ë¦„없는 오브ì íŠ¸ì˜ 중심ì "
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "2D 메시 만들기"
+msgstr "Mesh2D 만들기"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "í´ë¦¬ê³¤3D 만들기"
+msgstr "Polygon2D 만들기"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "내비게ì´ì…˜ ì¶©ëŒ í´ë¦¬ê³¤ 만들기"
+msgstr "CollisionPolygon2D 만들기"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Occluder í´ë¦¬ê³¤ 만들기"
+msgstr "LightOccluder2D 만들기"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6641,46 +6642,39 @@ msgstr "스프ë¼ì´íŠ¸ê°€ 애니메ì´ì…˜ í”„ë ˆìž„ì„ ì‚¬ìš©í•´ì„œ 메시로 ì
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Invalid geometry, can't replace by mesh."
-msgstr "유효하지 ì•Šì€ í˜•ìƒ, 메시로 대체할 수 없습니다."
+msgstr "ìž˜ëª»ëœ í˜•íƒœ, 메시로 대체할 수 없습니다."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "유효하지 ì•Šì€ í˜•ìƒ, 메시로 대체할 수 없습니다."
+msgstr "ìž˜ëª»ëœ í˜•íƒœ, í´ë¦¬ê³¤ì„ 만들 수 없습니다."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "유효하지 ì•Šì€ í˜•ìƒ, 메시로 대체할 수 없습니다."
+msgstr "ìž˜ëª»ëœ í˜•íƒœ, ì¶©ëŒ í´ë¦¬ê³¤ì„ 만들 수 없습니다."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "유효하지 ì•Šì€ í˜•ìƒ, 메시로 대체할 수 없습니다."
+msgstr "ìž˜ëª»ëœ í˜•íƒœ, 조명 ì–´í´ë£¨ë”를 만들 수 없습니다."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "스프ë¼ì´íŠ¸"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "2D 메시로 전환"
+msgstr "Mesh2D로 전환"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "í´ë¦¬ê³¤ ì´ë™"
+msgstr "Polygon2D로 전환"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "내비게ì´ì…˜ ì¶©ëŒ í´ë¦¬ê³¤ 만들기"
+msgstr "CollisionPolygon2D 노드 만들기"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Occluder í´ë¦¬ê³¤ 만들기"
+msgstr "LightOccluder2D 노드 만들기"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7266,7 +7260,6 @@ msgid "Duplicate Nodes"
msgstr "노드 복제"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
msgstr "노드 삭제"
@@ -8974,7 +8967,7 @@ msgstr "ë¼ì´ë¸ŒëŸ¬ë¦¬ë“¤: "
#: modules/gdnative/register_types.cpp
msgid "GDNative"
-msgstr "GD네ì´í‹°ë¸Œ"
+msgstr "GDNative"
#: modules/gdscript/gdscript_functions.cpp
msgid "Step argument is zero!"
diff --git a/editor/translations/lt.po b/editor/translations/lt.po
index 22fe1747e6..e21910b69f 100644
--- a/editor/translations/lt.po
+++ b/editor/translations/lt.po
@@ -158,12 +158,18 @@ msgstr ""
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Animacija: Pridėti Takelį"
+msgid "Animation length (frames)"
+msgstr "Animacija"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
-msgstr ""
+#, fuzzy
+msgid "Animation length (seconds)"
+msgstr "Animacijos Nodas"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "Animacija: Pridėti Takelį"
#: editor/animation_track_editor.cpp
#, fuzzy
diff --git a/editor/translations/lv.po b/editor/translations/lv.po
index a8acaaf300..d0d40ffcc5 100644
--- a/editor/translations/lv.po
+++ b/editor/translations/lv.po
@@ -157,14 +157,20 @@ msgid "Animation Playback Track"
msgstr "AnimÄcijas atskaņoÅ¡anas celiņs"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Pievienot celiņu"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "AnimÄcijas Garums (sekundes)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "AnimÄcijas Garums (sekundes)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Pievienot celiņu"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "AnimÄciju Cilpa"
diff --git a/editor/translations/mi.po b/editor/translations/mi.po
index 30d76b28d3..4bb8d367f0 100644
--- a/editor/translations/mi.po
+++ b/editor/translations/mi.po
@@ -144,11 +144,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/ml.po b/editor/translations/ml.po
index 215ca3d2cc..2dc5014173 100644
--- a/editor/translations/ml.po
+++ b/editor/translations/ml.po
@@ -152,11 +152,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/ms.po b/editor/translations/ms.po
index f253cca02b..07647f5341 100644
--- a/editor/translations/ms.po
+++ b/editor/translations/ms.po
@@ -157,15 +157,19 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-#, fuzzy
-msgid "Add Track"
-msgstr "Anim Tambah Trek"
+msgid "Animation length (frames)"
+msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr ""
#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "Anim Tambah Trek"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr ""
diff --git a/editor/translations/nb.po b/editor/translations/nb.po
index 26bd0cc890..af0f07cf1b 100644
--- a/editor/translations/nb.po
+++ b/editor/translations/nb.po
@@ -13,11 +13,12 @@
# passeride <lukas@passeride.com>, 2017.
# Byzantin <kasper-hoel@hotmail.com>, 2018.
# Hans-Marius Øverås <hansmariusoveras@gmail.com>, 2019.
+# Revolution <revosw@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-23 15:48+0000\n"
+"PO-Revision-Date: 2019-05-04 13:48+0000\n"
"Last-Translator: Allan Nordhøy <epost@anotheragency.no>\n"
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/godot-"
"engine/godot/nb_NO/>\n"
@@ -143,7 +144,7 @@ msgstr "Endre Animasjonsnavn:"
#: editor/animation_track_editor.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Change Animation Loop"
-msgstr ""
+msgstr "Endre Animasjonssløyfe"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -177,16 +178,21 @@ msgstr "Stopp avspilling av animasjon. (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Anim Legg til Spor"
+msgid "Animation length (frames)"
+msgstr "Animasjon lengde (i sekunder)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Animasjon lengde (i sekunder)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Anim Legg til Spor"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Animasjons-zoom."
@@ -239,7 +245,7 @@ msgstr "X-Fade Tid (s):"
#: editor/animation_track_editor.cpp
msgid "Toggle Track Enabled"
-msgstr ""
+msgstr "Veksl Aktivering Av Spor"
#: editor/animation_track_editor.cpp
msgid "Continuous"
@@ -273,11 +279,11 @@ msgstr "Kubisk"
#: editor/animation_track_editor.cpp
msgid "Clamp Loop Interp"
-msgstr ""
+msgstr "Klem Sløyfeinterp"
#: editor/animation_track_editor.cpp
msgid "Wrap Loop Interp"
-msgstr ""
+msgstr "Pakk Inn Sløyfeinterp"
#: editor/animation_track_editor.cpp
#: editor/plugins/canvas_item_editor_plugin.cpp
@@ -351,14 +357,12 @@ msgid "Anim Insert Key"
msgstr "Anim Sett Inn Nøkkel"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Animation Step"
-msgstr "Endre Animasjonsnavn:"
+msgstr "Endre Animasjonstrinn"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Rearrange Tracks"
-msgstr "Omorganiser Autoloads"
+msgstr "Omorganiser Spor"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -378,7 +382,6 @@ msgstr ""
"-AudioStreamPlayer3D"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Animation tracks can only point to AnimationPlayer nodes."
msgstr "Animasjonsspor kan kun peke på AnimationPlayer-noder."
@@ -418,9 +421,8 @@ msgid "Add Track Key"
msgstr "Anim Legg til Spor"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Track path is invalid, so can't add a method key."
-msgstr "Sporsti er ugyldig, så kan ikke legge til metodenøkkel."
+msgstr "Sporsti er ugyldig, så kan ikke legge til en metodenøkkel."
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -477,11 +479,11 @@ msgstr "Animasjonstre er gyldig."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Sekunder"
#: editor/animation_track_editor.cpp
msgid "FPS"
-msgstr ""
+msgstr "FPS"
#: editor/animation_track_editor.cpp editor/editor_properties.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -612,11 +614,11 @@ msgstr "Lydklipp:"
#: editor/animation_track_editor_plugins.cpp
msgid "Change Audio Track Clip Start Offset"
-msgstr ""
+msgstr "Endre Forskyvning Av Lydklippets Start"
#: editor/animation_track_editor_plugins.cpp
msgid "Change Audio Track Clip End Offset"
-msgstr ""
+msgstr "Endre Forskyvning Av Lydklippets Slutt"
#: editor/array_property_edit.cpp
msgid "Resize Array"
@@ -688,7 +690,7 @@ msgstr "Advarsler"
#: editor/code_editor.cpp
msgid "Line and column numbers."
-msgstr ""
+msgstr "Linje- og kolonnenummer."
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
@@ -1445,12 +1447,16 @@ msgid ""
"Target platform requires 'ETC' texture compression for GLES2. Enable 'Import "
"Etc' in Project Settings."
msgstr ""
+"MÃ¥lplatform krever 'ETC' teksturkomprimering for GLES2. Aktiver 'Importer "
+"Etc' i Prosjektinnstillinger."
#: editor/editor_export.cpp
msgid ""
"Target platform requires 'ETC2' texture compression for GLES3. Enable "
"'Import Etc 2' in Project Settings."
msgstr ""
+"MÃ¥lplatform krever 'ETC' teksturkomprimering for GLES3. Aktiver 'Importer "
+"Etc 2' i Prosjektinnstillinger."
#: editor/editor_export.cpp
msgid ""
@@ -1459,6 +1465,10 @@ msgid ""
"Enable 'Import Etc' in Project Settings, or disable 'Driver Fallback "
"Enabled'."
msgstr ""
+"MÃ¥lplatform krever 'ETC' teksturkomprimering for drivertilbakefallet til "
+"GLES2.\n"
+"Aktiver 'Importer Etc' i Prosjektinnstillinger, eller deaktiver "
+"'Drivertilbakefall Aktivert'."
#: editor/editor_export.cpp platform/android/export/export.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
@@ -1857,7 +1867,7 @@ msgstr "Eksport av prosjektet mislyktes med feilkode %d."
#: editor/editor_node.cpp
msgid "Imported resources can't be saved."
-msgstr ""
+msgstr "Importerte ressurser kan ikke lagres."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
#: scene/gui/dialogs.cpp
@@ -1873,6 +1883,8 @@ msgid ""
"This resource can't be saved because it does not belong to the edited scene. "
"Make it unique first."
msgstr ""
+"Denne ressursen kan ikke lagres fordi den hører ikke til den redigerte "
+"scenen. Gjør den unik først."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Save Resource As..."
@@ -2102,7 +2114,7 @@ msgstr "Kunne ikke laste ressurs."
#: editor/editor_node.cpp
msgid "A root node is required to save the scene."
-msgstr ""
+msgstr "En rotnode kreves for å lagre scenen."
#: editor/editor_node.cpp
msgid "Save Scene As..."
@@ -2544,7 +2556,7 @@ msgstr "Redigeringsverktøy-instillinger"
#: editor/editor_node.cpp
msgid "Open Editor Data Folder"
-msgstr ""
+msgstr "Ã…pne Redigererdatamappen"
#: editor/editor_node.cpp
#, fuzzy
@@ -2958,12 +2970,12 @@ msgstr "Nytt navn:"
#: editor/editor_properties_array_dict.cpp
msgid "Add Key/Value Pair"
-msgstr ""
+msgstr "Legg Til Nøkkel/Verdi Par"
#: editor/editor_properties_array_dict.cpp
#: editor/plugins/theme_editor_plugin.cpp
msgid "Remove Item"
-msgstr ""
+msgstr "Fjern Gjenstand"
#: editor/editor_run_native.cpp
msgid "Select device from the list"
@@ -3400,7 +3412,7 @@ msgstr "En fil eller mappe med dette navnet eksisterer allerede."
#: editor/filesystem_dock.cpp
msgid "Overwrite"
-msgstr ""
+msgstr "Overskriv"
#: editor/filesystem_dock.cpp editor/plugins/script_editor_plugin.cpp
msgid "Create Script"
@@ -3557,7 +3569,7 @@ msgstr "Importerer Scene..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
-msgstr ""
+msgstr "Genererer Lyskart"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
@@ -3611,16 +3623,19 @@ msgstr "Reimporter"
#: editor/import_dock.cpp
msgid "Save scenes, re-import and restart"
-msgstr ""
+msgstr "Lagre scener, om-importer og start om"
#: editor/import_dock.cpp
msgid "Changing the type of an imported file requires editor restart."
-msgstr ""
+msgstr "Ã… endre typen av en importert fil krever omstart av redigereren"
#: editor/import_dock.cpp
+#, fuzzy
msgid ""
"WARNING: Assets exist that use this resource, they may stop loading properly."
msgstr ""
+"ADVARSEL: ___ eksister som bruker denne ressursen, det kan hende de ikke "
+"laster inn riktig."
#: editor/inspector_dock.cpp
msgid "Failed to load resource."
@@ -3733,7 +3748,7 @@ msgstr "Plugins"
#: editor/plugin_config_dialog.cpp
msgid "Subfolder:"
-msgstr ""
+msgstr "Undermappe:"
#: editor/plugin_config_dialog.cpp
msgid "Language:"
@@ -3834,7 +3849,7 @@ msgstr "Endre Blend-Tid"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_state_machine_editor.cpp
msgid "This type of node can't be used. Only root nodes are allowed."
-msgstr ""
+msgstr "Denne typen node kan ikke bli brukt. Kun rotnoder er tillatt."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3855,7 +3870,7 @@ msgstr "Fjern Stipunkt"
#: editor/plugins/animation_blend_space_1d_editor.cpp
msgid "Move BlendSpace1D Node Point"
-msgstr ""
+msgstr "Flytt BlendSpace1D Nodepunkt"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3874,7 +3889,7 @@ msgstr ""
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Select and move points, create points with RMB."
-msgstr ""
+msgstr "Velg og flytt punkt, lag punkt med høyre museklikk."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp scene/gui/graph_edit.cpp
diff --git a/editor/translations/nl.po b/editor/translations/nl.po
index 6eb5a47d21..a9d958478a 100644
--- a/editor/translations/nl.po
+++ b/editor/translations/nl.po
@@ -32,12 +32,14 @@
# jef dered <themen098s@vivaldi.net>, 2019.
# Alex H. <sandertjeh13@hotmail.com>, 2019.
# edouardgr <edouard.gruyters@gmail.com>, 2019.
+# Jimmy De Smet <J773@telenet.be>, 2019.
+# Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-25 11:54+0000\n"
-"Last-Translator: edouardgr <edouard.gruyters@gmail.com>\n"
+"PO-Revision-Date: 2019-05-19 07:48+0000\n"
+"Last-Translator: Alex H. <sandertjeh13@hotmail.com>\n"
"Language-Team: Dutch <https://hosted.weblate.org/projects/godot-engine/godot/"
"nl/>\n"
"Language: nl\n"
@@ -182,14 +184,20 @@ msgid "Animation Playback Track"
msgstr "Animatie Terugspelen Track"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Track Toevoegen"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Animatielengte (in seconden)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Animatielengte (in seconden)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Track Toevoegen"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Animatie Loopen"
@@ -207,13 +215,12 @@ msgid "Anim Clips:"
msgstr "Animatieclips:"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Change Track Path"
-msgstr "Wijzig Array Waarde"
+msgstr "Verander Track pad"
#: editor/animation_track_editor.cpp
msgid "Toggle this track on/off."
-msgstr "Aan-uitschakelaar Track."
+msgstr "Schakel deze track aan/uit."
#: editor/animation_track_editor.cpp
msgid "Update Mode (How this property is set)"
@@ -234,12 +241,11 @@ msgstr "Verwijder deze track."
#: editor/animation_track_editor.cpp
msgid "Time (s): "
-msgstr "Tijd (s): "
+msgstr "Tijd (en): "
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Toggle Track Enabled"
-msgstr "Verander de ingeschakelde track"
+msgstr "Track schakelaar ingeschakeld"
#: editor/animation_track_editor.cpp
msgid "Continuous"
@@ -285,11 +291,11 @@ msgstr "Voer Sleutel in"
#: editor/animation_track_editor.cpp
msgid "Duplicate Key(s)"
-msgstr "Dupliceer Key(s)"
+msgstr "Dupliceer Sleutel(s)"
#: editor/animation_track_editor.cpp
msgid "Delete Key(s)"
-msgstr "Verwijder Key(s)"
+msgstr "Verwijder Sleutel(s)"
#: editor/animation_track_editor.cpp
msgid "Change Animation Update Mode"
@@ -349,7 +355,6 @@ msgid "Change Animation Step"
msgstr "Verander Animatiestappen"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Rearrange Tracks"
msgstr "Herschik Tracks"
@@ -396,14 +401,12 @@ msgid "Track is not of type Spatial, can't insert key"
msgstr "Track is niet van het type Spatial, kan geen key invoegen"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Add Transform Track Key"
-msgstr "3D Transformatie Track"
+msgstr "Voeg Transformatie Track Sleutel toe"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Add Track Key"
-msgstr "Track Toevoegen"
+msgstr "Voeg Track sleutel toe"
#: editor/animation_track_editor.cpp
msgid "Track path is invalid, so can't add a method key."
@@ -412,7 +415,7 @@ msgstr "Track path is niet geldig, dus kan geen methode key toevoegen."
#: editor/animation_track_editor.cpp
#, fuzzy
msgid "Add Method Track Key"
-msgstr "Methode Invocatie Track"
+msgstr "Voeg Methode Track sleutel toe"
#: editor/animation_track_editor.cpp
msgid "Method not found in object: "
@@ -452,7 +455,7 @@ msgstr "Sporen weergeven op basis van nodes of als lijst."
#: editor/animation_track_editor.cpp
#, fuzzy
msgid "Snap:"
-msgstr "Snap"
+msgstr "Snap:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -460,7 +463,7 @@ msgstr "Animatie stap waarde."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Seconden"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -504,14 +507,12 @@ msgid "Delete Selection"
msgstr "Verwijder Selectie"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Go to Next Step"
-msgstr "Ga Naar Volgende Stap"
+msgstr "Ga naar Volgende Stap"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Go to Previous Step"
-msgstr "Ga Naar Vorige Stap"
+msgstr "Ga naar Vorige Stap"
#: editor/animation_track_editor.cpp
msgid "Optimize Animation"
@@ -588,15 +589,15 @@ msgstr "Kopiëren"
#: editor/animation_track_editor_plugins.cpp
#, fuzzy
msgid "Add Audio Track Clip"
-msgstr "Audioclips:"
+msgstr "Voeg audiospoorclip toe"
#: editor/animation_track_editor_plugins.cpp
msgid "Change Audio Track Clip Start Offset"
-msgstr ""
+msgstr "Wijzig start afwijking van audiospoorclip"
#: editor/animation_track_editor_plugins.cpp
msgid "Change Audio Track Clip End Offset"
-msgstr ""
+msgstr "Wijzig eind afwijking van audiospoorclip"
#: editor/array_property_edit.cpp
msgid "Resize Array"
@@ -752,9 +753,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Ontkoppel '%s' van '%s'"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect all from signal: '%s'"
-msgstr "Ontkoppel '%s' van '%s'"
+msgstr "Ontkoppel alles van signaal: '%s'"
#: editor/connections_dialog.cpp
msgid "Connect..."
@@ -788,9 +788,8 @@ msgstr ""
"Weet je zeker dat je alle verbindingen naar dit signaal wilt verwijderen?"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect All"
-msgstr "Losmaken"
+msgstr "Ontkoppel Alles"
#: editor/connections_dialog.cpp
msgid "Edit..."
@@ -934,9 +933,8 @@ msgid "Error loading:"
msgstr "Error bij het laden van:"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Load failed due to missing dependencies:"
-msgstr "Scene faalde om te laden door ontbrekende afhankelijkheden:"
+msgstr "Laden mislukt vanwege het ontbrekende van afhankelijkheden:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Open Anyway"
@@ -1236,7 +1234,7 @@ msgstr "Bus Toevoegen"
#: editor/editor_audio_buses.cpp
#, fuzzy
msgid "Add a new Audio Bus to this layout."
-msgstr "Sla Audio Bus Layout Op Als..."
+msgstr "Voeg een nieuwe Audio Bus toe aan deze layout."
#: editor/editor_audio_buses.cpp editor/editor_properties.cpp
#: editor/plugins/animation_player_editor_plugin.cpp editor/property_editor.cpp
@@ -1558,14 +1556,12 @@ msgid "Move Favorite Down"
msgstr "Verplaats Favoriet Naar Beneden"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Previous Folder"
-msgstr "Vorig tabblad"
+msgstr "Vorige Folder"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Next Folder"
-msgstr "Map Maken"
+msgstr "Volgende Folder"
#: editor/editor_file_dialog.cpp
msgid "Go to parent folder"
@@ -1581,9 +1577,8 @@ msgid "View items as a grid of thumbnails."
msgstr "Toon items in een miniatuurraster."
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-#, fuzzy
msgid "View items as a list."
-msgstr "Bekijk objecten als een lijst"
+msgstr "Bekijk items als een lijst."
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
@@ -1893,6 +1888,8 @@ msgid ""
"This scene can't be saved because there is a cyclic instancing inclusion.\n"
"Please resolve it and then attempt to save again."
msgstr ""
+"Deze scene kan niet opgeslagen worden vanwege een cyclische instantiëring.\n"
+"Opslaan is pas mogelijk als dit opgelost wordt."
#: editor/editor_node.cpp
msgid ""
@@ -4254,6 +4251,8 @@ msgstr "De uitgekozen knoop of overgang verwijderen."
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Toggle autoplay this animation on start, restart or seek to zero."
msgstr ""
+"Schakel tussen automatisch afspelen van deze animatie bij start, herstart of "
+"zoek naar nul."
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Set the end animation. This is useful for sub-transitions."
@@ -4902,16 +4901,19 @@ msgid "Layout"
msgstr "Indeling"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Vertaalmasker voor het invoegen van sleutels."
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Rotatiemasker voor het invoegen van sleutels."
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Schaalmasker voor het invoegen van sleutels."
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
@@ -4919,12 +4921,18 @@ msgid "Insert keys (based on mask)."
msgstr "Voeg Sleutel in (Bestaande Banen)"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid ""
"Auto insert keys when objects are translated, rotated on scaled (based on "
"mask).\n"
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Automatische invoegtoetsen bij het vertalen van objecten, geroteerd op "
+"schaal (op basis van masker).\n"
+"Sleutels worden alleen toegevoegd aan bestaande tracks, er worden geen "
+"nieuwe tracks aangemaakt.\n"
+"Sleutels moeten voor de eerste keer handmatig worden ingevoerd."
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
@@ -5568,7 +5576,7 @@ msgstr ""
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Mirror Handle Lengths"
-msgstr ""
+msgstr "Spiegel Lengtehendels"
#: editor/plugins/path_editor_plugin.cpp
msgid "Curve Point #"
@@ -5681,7 +5689,7 @@ msgstr "Transformatie Type"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Paint Bone Weights"
-msgstr ""
+msgstr "Teken Botgewichten"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#, fuzzy
@@ -6101,12 +6109,13 @@ msgid "Open Godot online documentation"
msgstr "Open Godot online documentatie"
#: editor/plugins/script_editor_plugin.cpp
+#, fuzzy
msgid "Request Docs"
-msgstr ""
+msgstr "Verzoek Documenten"
#: editor/plugins/script_editor_plugin.cpp
msgid "Help improve the Godot documentation by giving feedback"
-msgstr ""
+msgstr "Help de Godot-documentatie te verbeteren door feedback te geven"
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the reference documentation."
@@ -6311,8 +6320,10 @@ msgid "Shader"
msgstr "Shader"
#: editor/plugins/skeleton_2d_editor_plugin.cpp
+#, fuzzy
msgid "This skeleton has no bones, create some children Bone2D nodes."
msgstr ""
+"Dit skelet heeft geen botten, creëer enkele Bone2D-knooppunten als kinderen."
#: editor/plugins/skeleton_2d_editor_plugin.cpp
#, fuzzy
@@ -6985,8 +6996,9 @@ msgid "SpriteFrames"
msgstr "Sprite-Frames"
#: editor/plugins/texture_region_editor_plugin.cpp
+#, fuzzy
msgid "Set Region Rect"
-msgstr ""
+msgstr "Stel Gebied Vierkant in"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Set Margin"
@@ -7336,10 +7348,13 @@ msgid "%s file(s) were not added because was already on the list."
msgstr "%s bestand(en) niet toegevoegd omdat deze al op de lijst staan."
#: editor/plugins/tile_set_editor_plugin.cpp
+#, fuzzy
msgid ""
"Drag handles to edit Rect.\n"
"Click on another Tile to edit it."
msgstr ""
+"Versleep handles om Vierkant te bewerken.\n"
+"Klik op een andere Tegel om deze te bewerken."
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
@@ -7493,8 +7508,9 @@ msgid "TileSet"
msgstr "TileSet..."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid "Set Uniform Name"
-msgstr ""
+msgstr "Uniforme naam instellen"
#: editor/plugins/visual_shader_editor_plugin.cpp
#, fuzzy
@@ -7786,7 +7802,7 @@ msgstr "Kan project.godot niet in projectpad maken."
#: editor/project_manager.cpp
msgid "The following files failed extraction from package:"
-msgstr ""
+msgstr "De volgende bestanden konden niet worden uitgepakt:"
#: editor/project_manager.cpp
#, fuzzy
@@ -8405,7 +8421,7 @@ msgstr "Bestand..."
#: editor/property_editor.cpp
msgid "Dir..."
-msgstr ""
+msgstr "Pad..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -8427,7 +8443,7 @@ msgstr "Plak Nodes"
#: editor/property_editor.cpp
msgid "Bit %d, val %d."
-msgstr ""
+msgstr "Bit %d, waarde %d."
#: editor/property_selector.cpp
msgid "Select Property"
@@ -8620,7 +8636,7 @@ msgstr "Scene Uitvoerinstellingen"
#: editor/scene_tree_dock.cpp
msgid "No parent to instance the scenes at."
-msgstr ""
+msgstr "Geen ouder om scenes mee te instantiëren."
#: editor/scene_tree_dock.cpp
msgid "Error loading scene from %s"
@@ -8645,16 +8661,19 @@ msgid "Clear Script"
msgstr "Script vrijmaken"
#: editor/scene_tree_dock.cpp
+#, fuzzy
msgid "This operation can't be done on the tree root."
-msgstr ""
+msgstr "Deze bewerking kan niet worden uitgevoerd op de tree root."
#: editor/scene_tree_dock.cpp
+#, fuzzy
msgid "Move Node In Parent"
-msgstr ""
+msgstr "Verplaats knooppunt naar ouder"
#: editor/scene_tree_dock.cpp
+#, fuzzy
msgid "Move Nodes In Parent"
-msgstr ""
+msgstr "Verplaats knooppunten naar ouder"
#: editor/scene_tree_dock.cpp
msgid "Duplicate Node(s)"
diff --git a/editor/translations/pl.po b/editor/translations/pl.po
index 7923ebe539..0d663d94e4 100644
--- a/editor/translations/pl.po
+++ b/editor/translations/pl.po
@@ -33,11 +33,12 @@
# Robert <vizz0@onet.pl>, 2019.
# Michał Topa <moonchasered@gmail.com>, 2019.
# Przemysław Pierzga <przemyslawpierzga@gmail.com>, 2019.
+# Artur MaciÄ…g <arturmaciag@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-25 11:54+0000\n"
+"PO-Revision-Date: 2019-05-08 11:48+0000\n"
"Last-Translator: Tomek <kobewi4e@gmail.com>\n"
"Language-Team: Polish <https://hosted.weblate.org/projects/godot-engine/"
"godot/pl/>\n"
@@ -185,14 +186,20 @@ msgid "Animation Playback Track"
msgstr "Ścieżka animacji"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Dodaj ścieżkę"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Długość animacji (sekundy)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Długość animacji (sekundy)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Dodaj ścieżkę"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Zapętlenie animacji"
@@ -445,9 +452,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Grupuj ścieżki po węzłach lub wyświetl je jako prostą listę."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "PrzyciÄ…gaj"
+msgstr "PrzyciÄ…ganie:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -455,7 +461,7 @@ msgstr "Wartość kroku animacji."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "sekund"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -2218,7 +2224,7 @@ msgstr "Zamknij kartÄ™"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr "Przełącz Zakładkę Sceny"
+msgstr "Przełącz zakładkę sceny"
#: editor/editor_node.cpp
msgid "%d more files or folders"
@@ -4822,20 +4828,19 @@ msgstr "Układ"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Maska przesunięcia dla wstawiania kluczy."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Maska obrotu dla wstawiania kluczy."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Maska skali dla wstawiania kluczy."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Wstaw klucz (istniejące ścieżki)"
+msgstr "Wstaw klucze (w oparciu o maskÄ™)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4844,11 +4849,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Automatycznie wstaw klucze, kiedy obiekt jest przesuwany, obracany lub "
+"skalowany (w oparciu o maskÄ™).\n"
+"Klucze są dodawane tylko do istniejących ścieżek, żadne nowe ścieżki nie "
+"zostanÄ… utworzone.\n"
+"Za pierwszym razem klucze muszą być umieszczone ręcznie."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Wstaw klatkÄ™ kluczowÄ…"
+msgstr "Automatycznie wstaw klucz"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5834,9 +5843,8 @@ msgid "Save Theme As..."
msgstr "Zapisz motyw jako..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " - referencja klasy"
+msgstr "Referencja klasy %s"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6660,24 +6668,20 @@ msgid "Nameless gizmo"
msgstr "Uchwyt bez nazwy"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Utwórz siatkę 2D"
+msgstr "Utwórz węzeł Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Utwórz Wielokąt3D"
+msgstr "Utwórz węzeł Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Utwórz wielokąt kolizji"
+msgstr "Utwórz węzeł CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Stwórz Occluder Polygon"
+msgstr "Utwórz węzeł LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6693,43 +6697,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Nieprawidłowa geometria, nie można zastąpić przez siatkę."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Nieprawidłowa geometria, nie można zastąpić przez siatkę."
+msgstr "Nieprawidłowa geometria, nie można utworzyć wielokąta."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Nieprawidłowa geometria, nie można zastąpić przez siatkę."
+msgstr "Nieprawidłowa geometria, nie można utworzyć wielokąta kolizji."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Nieprawidłowa geometria, nie można zastąpić przez siatkę."
+msgstr "Nieprawidłowa geometria, nie można utworzyć przesłaniacza światła."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Konwertuj do siatki 2D"
+msgstr "Zamień na Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Przesuń Wielokąt"
+msgstr "Zamień na Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Utwórz wielokąt kolizji"
+msgstr "Utwórz równorzędny węzeł CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Stwórz Occluder Polygon"
+msgstr "Utwórz równorzędny węzeł LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7314,9 +7311,8 @@ msgid "Duplicate Nodes"
msgstr "Duplikuj węzły"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Usuń węzeł"
+msgstr "Usuń węzły"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/pr.po b/editor/translations/pr.po
index 0aa4cbbca8..914145719d 100644
--- a/editor/translations/pr.po
+++ b/editor/translations/pr.po
@@ -168,11 +168,16 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Yer unique name be evil."
+
+#: editor/animation_track_editor.cpp
+msgid "Animation length (seconds)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po
index 9dc52df2be..5412309075 100644
--- a/editor/translations/pt_BR.po
+++ b/editor/translations/pt_BR.po
@@ -58,12 +58,13 @@
# Hans M. Boron <hansmateusboron@gmail.com>, 2019.
# Gustavo Bolanho <jdmapas@gmail.com>, 2019.
# Nilton Bendini Junior <almascelulas@bol.com.br>, 2019.
+# Ivo Nascimento <iannsp@gmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: 2016-05-30\n"
-"PO-Revision-Date: 2019-04-19 16:33+0000\n"
-"Last-Translator: Nilton Bendini Junior <almascelulas@bol.com.br>\n"
+"PO-Revision-Date: 2019-04-29 08:48+0000\n"
+"Last-Translator: Ivo Nascimento <iannsp@gmail.com>\n"
"Language-Team: Portuguese (Brazil) <https://hosted.weblate.org/projects/"
"godot-engine/godot/pt_BR/>\n"
"Language: pt_BR\n"
@@ -71,7 +72,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.6.1\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -207,14 +208,20 @@ msgid "Animation Playback Track"
msgstr "Faixa de Reprodução de Animação"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Adicionar Trilha"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Duração da Animação (em segundos)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Duração da Animação (em segundos)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Adicionar Trilha"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Loop da Animação"
@@ -478,7 +485,7 @@ msgstr "Valor do passo de animação."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Segundos"
#: editor/animation_track_editor.cpp
msgid "FPS"
diff --git a/editor/translations/pt_PT.po b/editor/translations/pt_PT.po
index f9e93885d9..f83c37d2c3 100644
--- a/editor/translations/pt_PT.po
+++ b/editor/translations/pt_PT.po
@@ -18,7 +18,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-03-30 20:04+0000\n"
+"PO-Revision-Date: 2019-04-29 08:48+0000\n"
"Last-Translator: João Lopes <linux-man@hotmail.com>\n"
"Language-Team: Portuguese (Portugal) <https://hosted.weblate.org/projects/"
"godot-engine/godot/pt_PT/>\n"
@@ -27,7 +27,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.6.1\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -164,14 +164,20 @@ msgid "Animation Playback Track"
msgstr "Pista de Reprodução de Animação"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Adicionar Pista"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Duração da Animação (segundos)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Duração da Animação (segundos)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Adicionar Pista"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Loop da Animação"
@@ -288,11 +294,11 @@ msgstr "Remover Pista de Animação"
#: editor/animation_track_editor.cpp
msgid "Create NEW track for %s and insert key?"
-msgstr "Criar NOVA Pista para %s e inserir Chave?"
+msgstr "Criar NOVA pista para %s e inserir chave?"
#: editor/animation_track_editor.cpp
msgid "Create %d NEW tracks and insert keys?"
-msgstr "Criar %d NOVAS Pistas e inserir Chaves?"
+msgstr "Criar %d NOVAS pistas e inserir chaves?"
#: editor/animation_track_editor.cpp editor/create_dialog.cpp
#: editor/editor_audio_buses.cpp editor/editor_plugin_settings.cpp
@@ -373,7 +379,7 @@ msgstr "Caminho da pista é inválido, não se consegue adicionar uma chave."
#: editor/animation_track_editor.cpp
msgid "Track is not of type Spatial, can't insert key"
-msgstr "Pista não do tipo Spatial, não se consegue inserir chave"
+msgstr "Pista não do tipo Spatial, impossível inserir chave"
#: editor/animation_track_editor.cpp
msgid "Add Transform Track Key"
@@ -385,8 +391,7 @@ msgstr "Adicionar Chave da Pista"
#: editor/animation_track_editor.cpp
msgid "Track path is invalid, so can't add a method key."
-msgstr ""
-"Caminho da pista é inválido, não se consegue adicionar uma chave método."
+msgstr "Caminho da pista é inválido, impossível adicionar uma chave método."
#: editor/animation_track_editor.cpp
msgid "Add Method Track Key"
@@ -427,9 +432,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "Agrupar faixas por nó ou exibi-las como lista simples."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Ajustar"
+msgstr "Ajustar:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -437,7 +441,7 @@ msgstr "Valor passo da Animação."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Segundos"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -2846,7 +2850,7 @@ msgstr "Página: "
#: editor/editor_properties_array_dict.cpp
msgid "New Key:"
-msgstr "Novo Chave:"
+msgstr "Nova Chave:"
#: editor/editor_properties_array_dict.cpp
msgid "New Value:"
@@ -4804,20 +4808,19 @@ msgstr "Esquema"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "Máscara de translação para inserir chaves."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "Máscara de rotação para inserir chaves."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "Máscara de escala para inserir chaves."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Inserir Chave (Pistas existentes)"
+msgstr "Inserir chaves (baseado na máscara)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4826,11 +4829,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Insere chaves automaticamente quando objetos são movidos, rodados ou "
+"redimensionados (baseado na máscara).\n"
+"Chaves apenas são adicionadas a pistas existentes, não sendo criadas novas "
+"pistas.\n"
+"Chaves têm de ser inseridas manualmente na primeira vez."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Anim Inserir Chave"
+msgstr "Inserir Chave automaticamente"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5816,9 +5823,8 @@ msgid "Save Theme As..."
msgstr "Guardar tema como..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " Referência de classe"
+msgstr "Referência de classe %s"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6228,7 +6234,7 @@ msgstr "A rodar %s graus."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Keying is disabled (no key inserted)."
-msgstr "Edição desativada (nenhuma Chave inserida)."
+msgstr "Edição desativada (nenhuma chave inserida)."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Animation Key Inserted."
@@ -6642,24 +6648,20 @@ msgid "Nameless gizmo"
msgstr "Bugiganga sem Nome"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Criar Malha 2D"
+msgstr "Criar Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Criar Polygon3D"
+msgstr "Criar Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Criar Polígono de Colisão"
+msgstr "Criar CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Criar Polígono oclusor"
+msgstr "Criar LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6674,43 +6676,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Geometria inválida, não substituível por malha."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Geometria inválida, não substituível por malha."
+msgstr "Geometria inválida, impossível criar polígono."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Geometria inválida, não substituível por malha."
+msgstr "Geometria inválida, impossível criar polígono de colisão."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Geometria inválida, não substituível por malha."
+msgstr "Geometria inválida, impossível criar oclusor de luz."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Converter para Malha 2D"
+msgstr "Converter para Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Mover Polígono"
+msgstr "Converter para Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Criar Polígono de Colisão"
+msgstr "Criar irmão de CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Criar Polígono oclusor"
+msgstr "Criar irmão de LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7295,9 +7290,8 @@ msgid "Duplicate Nodes"
msgstr "Duplicar Nós"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Apagar Nó"
+msgstr "Apagar Nós"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/ro.po b/editor/translations/ro.po
index dbc222bbbf..96565393c6 100644
--- a/editor/translations/ro.po
+++ b/editor/translations/ro.po
@@ -163,16 +163,21 @@ msgstr "Oprește rularea animației. (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Anim Adăugați Pistă"
+msgid "Animation length (frames)"
+msgstr "Lungime Animație (în secunde)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Lungime Animație (în secunde)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Anim Adăugați Pistă"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Zoom Animație."
diff --git a/editor/translations/ru.po b/editor/translations/ru.po
index b9794177bb..590b9408fd 100644
--- a/editor/translations/ru.po
+++ b/editor/translations/ru.po
@@ -43,12 +43,16 @@
# ÐÑ€Ñений Солодков <arsen332211@gmail.com>, 2019.
# Nikita <yakrobat@protonmail.com>, 2019.
# LAT_Rio <AlSenya@yandex.ru>, 2019.
+# devnp <dev.necropan@gmail.com>, 2019.
+# Виктор <victor8632@bk.ru>, 2019.
+# Mickety <xyngraph@gmail.com>, 2019.
+# Breadp4ck <iii103@mail.ru>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-14 13:04+0000\n"
-"Last-Translator: LAT_Rio <AlSenya@yandex.ru>\n"
+"PO-Revision-Date: 2019-05-08 11:48+0000\n"
+"Last-Translator: Breadp4ck <iii103@mail.ru>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/godot-engine/"
"godot/ru/>\n"
"Language: ru\n"
@@ -57,7 +61,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -194,14 +198,20 @@ msgid "Animation Playback Track"
msgstr "Трек ВоÑÐ¿Ñ€Ð¾Ð¸Ð·Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ðнимации"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Добавить новый Трек"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "ПродолжительноÑÑ‚ÑŒ анимации (в Ñекундах)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "ПродолжительноÑÑ‚ÑŒ анимации (в Ñекундах)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Добавить новый Трек"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Зацикливание анимации"
@@ -464,7 +474,7 @@ msgstr "Значение шага анимации."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Секунды"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -3673,9 +3683,8 @@ msgstr "Загрузка..."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Move Node Point"
-msgstr "Передвинуть Точку"
+msgstr "Передвинуть узел"
#: editor/plugins/animation_blend_space_1d_editor.cpp
msgid "Change BlendSpace1D Limits"
@@ -4830,34 +4839,43 @@ msgid "Layout"
msgstr "Макет"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "МаÑка Ð¿ÐµÑ€ÐµÐ¼ÐµÑ‰ÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»Ñемых ключей."
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "МаÑка поворота Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»Ñемых ключей."
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "МаÑка маÑштаба Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»Ñемых ключей."
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Ð’Ñтавить ключи (Ins)"
+msgstr "Ð’Ñтавить ключи (в завиÑимоÑти от маÑки)"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid ""
"Auto insert keys when objects are translated, rotated on scaled (based on "
"mask).\n"
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"ÐвтоматичеÑки вÑтавлÑÑ‚ÑŒ ключи когда объекты перемещены, повёрнуты или их "
+"размер изменён (завиÑит от маÑки).\n"
+"Ключи добавлÑÑŽÑ‚ÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ в ÑущеÑтвующие дорожки, новые дорожки не будут "
+"Ñозданы.\n"
+"Первые ключи должны быть добавлены вручную."
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
msgid "Auto Insert Key"
-msgstr "Ð’Ñтавить ключ"
+msgstr "ÐвтоматичеÑки вÑтавлÑÑ‚ÑŒ ключ"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5846,7 +5864,7 @@ msgstr "Сохранить тему как..."
#: editor/plugins/script_editor_plugin.cpp
#, fuzzy
msgid "%s Class Reference"
-msgstr " СÑылка на КлаÑÑ"
+msgstr "%s Справка по клаÑÑу"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6671,9 +6689,8 @@ msgid "Post"
msgstr "ПоÑле"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Nameless gizmo"
-msgstr "БезымÑнный гизмо"
+msgstr "БезымÑÐ½Ð½Ð°Ñ ÑˆÑ‚ÑƒÐºÐ¾Ð²Ð¸Ð½Ð°"
#: editor/plugins/sprite_editor_plugin.cpp
#, fuzzy
@@ -6709,14 +6726,13 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "ÐÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð³ÐµÐ¾Ð¼ÐµÑ‚Ñ€Ð¸Ñ, не может быть заменена Ñеткой."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "ÐÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð³ÐµÐ¾Ð¼ÐµÑ‚Ñ€Ð¸Ñ, не может быть заменена Ñеткой."
+msgstr "ÐÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð³ÐµÐ¾Ð¼ÐµÑ‚Ñ€Ð¸Ñ, Ð½ÐµÐ»ÑŒÐ·Ñ Ñоздать полигональную Ñетку."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "ÐÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð³ÐµÐ¾Ð¼ÐµÑ‚Ñ€Ð¸Ñ, не может быть заменена Ñеткой."
+msgstr ""
+"ÐÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð³ÐµÐ¾Ð¼ÐµÑ‚Ñ€Ð¸Ñ, Ð½ÐµÐ»ÑŒÐ·Ñ Ñоздать полигональную Ñетку Ñтолкновений."
#: editor/plugins/sprite_editor_plugin.cpp
#, fuzzy
@@ -6733,9 +6749,8 @@ msgid "Convert to Mesh2D"
msgstr "Преобразовать в 2D Mesh"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "Передвинуть полигон"
+msgstr "Преобразовать в Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
#, fuzzy
@@ -7331,9 +7346,8 @@ msgid "Duplicate Nodes"
msgstr "Дублировать узлы"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Удалить узел"
+msgstr "Удалить узлы"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
@@ -8885,7 +8899,7 @@ msgstr "Видео памÑÑ‚ÑŒ"
#: editor/script_editor_debugger.cpp
msgid "Resource Path"
-msgstr "Путь реÑурÑа"
+msgstr "Путь к реÑурÑу"
#: editor/script_editor_debugger.cpp
msgid "Type"
@@ -9525,9 +9539,8 @@ msgid "Change Input Value"
msgstr "Изменить входное значение"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Resize Comment"
-msgstr "Изменить размер CanvasItem"
+msgstr "Изменить размер комментариÑ"
#: modules/visual_script/visual_script_editor.cpp
msgid "Can't copy the function node."
@@ -10341,9 +10354,8 @@ msgid "Please Confirm..."
msgstr "Подтверждение..."
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Go to parent folder."
-msgstr "Перейти к родительÑкой папке"
+msgstr "Перейти к родительÑкой папке."
#: scene/gui/popup.cpp
msgid ""
diff --git a/editor/translations/si.po b/editor/translations/si.po
index 581ab36ee0..943dcad6b8 100644
--- a/editor/translations/si.po
+++ b/editor/translations/si.po
@@ -153,14 +153,20 @@ msgid "Animation Playback Track"
msgstr "සජීවීකරණ ධà·à·€à¶±à¶º ලුහුබදින්න"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "ලුහුබදින්නෙක් එක් කරන්න"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "සජීවීකරණ කà·à¶½à¶º (තප්පර)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "සජීවීකරණ කà·à¶½à¶º (තප්පර)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "ලුහුබදින්නෙක් එක් කරන්න"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "සජීවීකරණ පුනරà·à·€à¶»à·Šà¶®à¶±à¶º"
diff --git a/editor/translations/sk.po b/editor/translations/sk.po
index 862f095dd3..5606781122 100644
--- a/editor/translations/sk.po
+++ b/editor/translations/sk.po
@@ -158,14 +158,20 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr ""
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Dĺžka Času Animácie (v sekundách)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Dĺžka Času Animácie (v sekundách)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr ""
diff --git a/editor/translations/sl.po b/editor/translations/sl.po
index 23d7e5ebee..c7422f7535 100644
--- a/editor/translations/sl.po
+++ b/editor/translations/sl.po
@@ -8,12 +8,13 @@
# Simon Å ander <simon.sand3r@gmail.com>, 2017.
# Yahara Octanis <yaharao55@gmail.com>, 2018.
# Tine Jozelj <tine@tjo.space>, 2018.
+# Andrej Poženel <andrej.pozenel@outlook.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-12-13 14:43+0100\n"
-"Last-Translator: Tine Jozelj <tine@tjo.space>\n"
+"PO-Revision-Date: 2019-05-16 18:49+0000\n"
+"Last-Translator: Andrej Poženel <andrej.pozenel@outlook.com>\n"
"Language-Team: Slovenian <https://hosted.weblate.org/projects/godot-engine/"
"godot/sl/>\n"
"Language: sl\n"
@@ -22,26 +23,27 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3;\n"
-"X-Generator: Poedit 2.2\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Invalid type argument to convert(), use TYPE_* constants."
-msgstr "Neveljavena vrsta argumenta za convert(), uporabite TYPE_* konstanto."
+msgstr "Neveljavna vrsta argumenta za convert(), uporabite TYPE_* konstanto."
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/mono/glue/gd_glue.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Not enough bytes for decoding bytes, or invalid format."
-msgstr "Ni dovolj pomnilnika za dekodiranje bajtov, ali neveljaven format."
+msgstr ""
+"Ni dovolj pomnilnika za dekodiranje bajtov, ali pa je neveljaven format."
#: core/math/expression.cpp
msgid "Invalid input %i (not passed) in expression"
-msgstr ""
+msgstr "NapaÄen vnos %i(ni podan) v izrazu"
#: core/math/expression.cpp
msgid "self can't be used because instance is null (not passed)"
-msgstr "self nemore biti uporabljen, ker instanca ni null (ni podano)"
+msgstr "self ne more biti uporabljen, ker instanca ni null (ni podano)"
#: core/math/expression.cpp
#, fuzzy
@@ -166,16 +168,21 @@ msgstr "Ustavi predvajanje animacije. (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Animacija Dodaj sled"
+msgid "Animation length (frames)"
+msgstr "Dolžina animacije (v sekundah)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Dolžina animacije (v sekundah)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Animacija Dodaj sled"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Približaj animacijo."
diff --git a/editor/translations/sq.po b/editor/translations/sq.po
index d52ebdcd96..fe29b8779d 100644
--- a/editor/translations/sq.po
+++ b/editor/translations/sq.po
@@ -154,14 +154,20 @@ msgid "Animation Playback Track"
msgstr "Binari i Rishikimit të Animacionit"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Shto Binarë"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Kohëzgjatja e Animacionit (sekonda)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Kohëzgjatja e Animacionit (sekonda)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Shto Binarë"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Përsëritje Animacioni"
diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po
index 57e05ca847..f9a7ce452f 100644
--- a/editor/translations/sr_Cyrl.po
+++ b/editor/translations/sr_Cyrl.po
@@ -165,16 +165,21 @@ msgstr "ЗауÑтави анимацију. (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Додај нову траку"
+msgid "Animation length (frames)"
+msgstr "Дужина анимације (у Ñекундама)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Дужина анимације (у Ñекундама)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Додај нову траку"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Скала анимације."
diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po
index ac3590e494..3f92101118 100644
--- a/editor/translations/sr_Latn.po
+++ b/editor/translations/sr_Latn.po
@@ -159,12 +159,18 @@ msgstr ""
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Animacija Dodaj Kanal"
+msgid "Animation length (frames)"
+msgstr "Optimizuj Animaciju"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
-msgstr ""
+#, fuzzy
+msgid "Animation length (seconds)"
+msgstr "Promijeni Dužinu Animacije"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "Animacija Dodaj Kanal"
#: editor/animation_track_editor.cpp
msgid "Animation Looping"
diff --git a/editor/translations/sv.po b/editor/translations/sv.po
index 63a6d6e6c7..2f08a32697 100644
--- a/editor/translations/sv.po
+++ b/editor/translations/sv.po
@@ -161,15 +161,20 @@ msgstr ""
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Anim Lägg till spår"
+msgid "Animation length (frames)"
+msgstr "Animation längd (i sekunder)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Animation längd (i sekunder)."
#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "Anim Lägg till spår"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Animationslooping"
diff --git a/editor/translations/ta.po b/editor/translations/ta.po
index 17e837d5b1..ee708bff60 100644
--- a/editor/translations/ta.po
+++ b/editor/translations/ta.po
@@ -157,15 +157,19 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-#, fuzzy
-msgid "Add Track"
-msgstr "அசைவூடà¯à®Ÿà¯ பாதை சேரà¯"
+msgid "Animation length (frames)"
+msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr ""
#: editor/animation_track_editor.cpp
+#, fuzzy
+msgid "Add Track"
+msgstr "அசைவூடà¯à®Ÿà¯ பாதை சேரà¯"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr ""
diff --git a/editor/translations/te.po b/editor/translations/te.po
index b5f7015c88..f43e4c486f 100644
--- a/editor/translations/te.po
+++ b/editor/translations/te.po
@@ -152,11 +152,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/th.po b/editor/translations/th.po
index 5b1470e970..9624447da3 100644
--- a/editor/translations/th.po
+++ b/editor/translations/th.po
@@ -169,16 +169,21 @@ msgstr "หยุดà¸à¸²à¸£à¹€à¸¥à¹ˆà¸™à¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™ (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "เพิ่มà¹à¸—ร็à¸à¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™"
+msgid "Animation length (frames)"
+msgstr "ความยาวà¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™ (วินาที)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "ความยาวà¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™ (วินาที)"
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "เพิ่มà¹à¸—ร็à¸à¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "ซูมà¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™"
diff --git a/editor/translations/tr.po b/editor/translations/tr.po
index 30f753d6ab..9622fda90a 100644
--- a/editor/translations/tr.po
+++ b/editor/translations/tr.po
@@ -25,12 +25,13 @@
# Mertcan Duman <mertcan.dmn16@gmail.com>, 2019.
# Furkan Türkal <furkan.turkal@hotmail.com>, 2019.
# Aiden Demir <dnm00110011@hotmail.com>, 2019.
+# Anton Semchenko <semchenkoanton@protonmail.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-04-14 13:04+0000\n"
-"Last-Translator: Aiden Demir <dnm00110011@hotmail.com>\n"
+"PO-Revision-Date: 2019-05-10 08:19+0000\n"
+"Last-Translator: Anton Semchenko <semchenkoanton@protonmail.com>\n"
"Language-Team: Turkish <https://hosted.weblate.org/projects/godot-engine/"
"godot/tr/>\n"
"Language: tr\n"
@@ -38,23 +39,22 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.7-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Invalid type argument to convert(), use TYPE_* constants."
-msgstr ""
-"convert() için geçersiz türde değiştirgen, TYPE_* sabitlerini kullanın."
+msgstr "convert() için geçersiz argüman tipi, TYPE_* sabitlerini kullanın."
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/mono/glue/gd_glue.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Not enough bytes for decoding bytes, or invalid format."
-msgstr "Byte kodu çözmek için yetersiz byte, ya da Geçersiz format."
+msgstr "Byte kodu çözmek için yetersiz byte, ya da geçersiz format."
#: core/math/expression.cpp
msgid "Invalid input %i (not passed) in expression"
-msgstr "%i ifadesindeki girdi geçersiz"
+msgstr "İfade de geçersiz girdi %i (geçmedi)."
#: core/math/expression.cpp
msgid "self can't be used because instance is null (not passed)"
@@ -67,22 +67,23 @@ msgstr "Geçersiz işlenen operatörler %s, %s ve %s"
#: core/math/expression.cpp
msgid "Invalid index of type %s for base type %s"
-msgstr "%s temel tipi için, %s tipinde geçersiz index."
+msgstr "%s temel tipi için, %s tipinde geçersiz indeks"
#: core/math/expression.cpp
msgid "Invalid named index '%s' for base type %s"
-msgstr "%s temel tipi için, geçersiz isimlendirilmiş index %s"
+msgstr "%s temel tipi için, geçersiz isimlendirilmiş indeks '%s'"
#: core/math/expression.cpp
msgid "Invalid arguments to construct '%s'"
-msgstr "'%s' oluşturulurken geçersiz argümanlar atandı."
+msgstr "'%s' oluşturulurken geçersiz argümanlar atandı"
#: core/math/expression.cpp
msgid "On call to '%s':"
-msgstr "'%s': çağrıldığında."
+msgstr "'%s' çağrıldığında:"
#: editor/animation_bezier_editor.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
+#, fuzzy
msgid "Free"
msgstr "Ãœcretsiz"
@@ -177,14 +178,20 @@ msgid "Animation Playback Track"
msgstr "Animasyon Oynatıcı İzi"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Ä°z Ekle"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "Animasyon UzunluÄŸu (saniye)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "Animasyon UzunluÄŸu (saniye)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Ä°z Ekle"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "Animasyon Döngüsü"
@@ -276,9 +283,8 @@ msgid "Insert Key"
msgstr "Anahtar Gir"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Duplicate Key(s)"
-msgstr "Düğüm(leri) Çoğalt"
+msgstr "Anahtar(lar)ı Çoğalt"
#: editor/animation_track_editor.cpp
msgid "Delete Key(s)"
@@ -439,9 +445,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "İzleri düğüme göre grupla veya onları düz liste olarak göster."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "Yapış"
+msgstr "Yapıştır:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -449,7 +454,7 @@ msgstr "Animasyon adım değeri."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Saniye"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -1214,7 +1219,7 @@ msgstr "Bus ekle"
#: editor/editor_audio_buses.cpp
msgid "Add a new Audio Bus to this layout."
-msgstr ""
+msgstr "Bu yerleşim planına yeni ses veri yolu ekle."
#: editor/editor_audio_buses.cpp editor/editor_properties.cpp
#: editor/plugins/animation_player_editor_plugin.cpp editor/property_editor.cpp
@@ -1383,28 +1388,26 @@ msgstr "Dosya Depolama:"
#: editor/editor_export.cpp
msgid "No export template found at the expected path:"
-msgstr ""
+msgstr "Beklenen adreste dışa aktarım şablonu bulunamadı:"
#: editor/editor_export.cpp
msgid "Packing"
msgstr "Çıkınla"
#: editor/editor_export.cpp
-#, fuzzy
msgid ""
"Target platform requires 'ETC' texture compression for GLES2. Enable 'Import "
"Etc' in Project Settings."
msgstr ""
-"Hedef platform GLES2 için 'ETC' doku sıkıştırma gerektirir. Proje "
+"Hedef platform GLES2 için 'ETC' doku sıkıştırma gerekiyor. Proje "
"Ayarları'nda 'Import Etc' etkinleştirin."
#: editor/editor_export.cpp
-#, fuzzy
msgid ""
"Target platform requires 'ETC2' texture compression for GLES3. Enable "
"'Import Etc 2' in Project Settings."
msgstr ""
-"Hedef platform GLES3 için 'ETC2' doku sıkıştırma gerektirir. Proje "
+"Hedef platform GLES3 için 'ETC2' doku sıkıştırma gerekiyor. Proje "
"Ayarları'nda 'Import Etc 2' etkinleştirin."
#: editor/editor_export.cpp
@@ -1418,16 +1421,14 @@ msgstr ""
#: editor/editor_export.cpp platform/android/export/export.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
-#, fuzzy
msgid "Custom debug template not found."
-msgstr "Özel kusur ayıklama çıkını bulunmadı."
+msgstr "Özel hata ayıklama şablonu bulunmadı."
#: editor/editor_export.cpp platform/android/export/export.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
-#, fuzzy
msgid "Custom release template not found."
-msgstr "Özel yayınlama çıkını bulunamadı."
+msgstr "Özel yayınlama şablonu bulunamadı."
#: editor/editor_export.cpp platform/javascript/export/export.cpp
msgid "Template file not found:"
@@ -1541,23 +1542,20 @@ msgid "Move Favorite Down"
msgstr "Beğenileni Aşağı Taşı"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Previous Folder"
-msgstr "Önceki Zemin"
+msgstr "Önceki Klasör"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Next Folder"
-msgstr "Sonraki Zemin"
+msgstr "Sonraki Klasör"
#: editor/editor_file_dialog.cpp
msgid "Go to parent folder"
msgstr "Üst klasöre git"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "(Un)favorite current folder."
-msgstr "Klasör oluşturulamadı."
+msgstr "Bu klasörü favorilerden çıkar/favorilere ekle."
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
#, fuzzy
@@ -1565,9 +1563,8 @@ msgid "View items as a grid of thumbnails."
msgstr "Öğeleri küçük resim ızgarası şeklinde göster"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-#, fuzzy
msgid "View items as a list."
-msgstr "Öğeleri liste olarak göster"
+msgstr "Öğeleri liste olarak göster."
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
@@ -1627,19 +1624,16 @@ msgid "Methods"
msgstr "Metotlar"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Methods:"
-msgstr "Metotlar"
+msgstr "Metotlar:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Theme Properties"
-msgstr "Özellikler"
+msgstr "Tema Özellikleri"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Theme Properties:"
-msgstr "Özellikler:"
+msgstr "Tema Özellikleri:"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Signals:"
@@ -1666,14 +1660,12 @@ msgid "Constants:"
msgstr "Sabitler:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Class Description"
-msgstr "Açıklama"
+msgstr "Sınıf Açıklaması"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Class Description:"
-msgstr "Açıklama:"
+msgstr "Sınıf Açıklaması:"
#: editor/editor_help.cpp
msgid "Online Tutorials:"
@@ -1690,14 +1682,12 @@ msgstr ""
"[color=$color][url=$url2]öneride bulunabilirsiniz[/url][/color]."
#: editor/editor_help.cpp
-#, fuzzy
msgid "Property Descriptions"
-msgstr "Özellik Açıklaması:"
+msgstr "Özellik Açıklamaları"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Property Descriptions:"
-msgstr "Özellik Açıklaması:"
+msgstr "Özellik Açıklamaları:"
#: editor/editor_help.cpp
msgid ""
@@ -1708,14 +1698,12 @@ msgstr ""
"bulunarak[/url][/color] yardım edebilirsiniz!"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Method Descriptions"
-msgstr "Metot Açıklaması:"
+msgstr "Metot Açıklamaları"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Method Descriptions:"
-msgstr "Metot Açıklaması:"
+msgstr "Metot Açıklamaları:"
#: editor/editor_help.cpp
msgid ""
@@ -1731,49 +1719,40 @@ msgid "Search Help"
msgstr "Yardım Ara"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Display All"
-msgstr "Olağanı Görüntüle"
+msgstr "Hepsini Görüntüle"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Classes Only"
-msgstr "Sınıflar"
+msgstr "Sadece Sınıflar"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Methods Only"
-msgstr "Metotlar"
+msgstr "Sadece Metotlar"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Signals Only"
-msgstr "Sinyaller"
+msgstr "Sadece Sinyaller"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Constants Only"
-msgstr "Sabitler"
+msgstr "Sadece Sabitler"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Properties Only"
-msgstr "Özellikler"
+msgstr "Sadece Özellikler"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Theme Properties Only"
-msgstr "Özellikler"
+msgstr "Sadece Tema Özellikleri"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Member Type"
-msgstr "Ãœyeler"
+msgstr "Ãœye Tipi"
#: editor/editor_help_search.cpp
-#, fuzzy
msgid "Class"
-msgstr "Sınıf:"
+msgstr "Sınıf"
#: editor/editor_inspector.cpp editor/project_settings_editor.cpp
msgid "Property:"
@@ -1785,7 +1764,7 @@ msgstr "Ayarla"
#: editor/editor_inspector.cpp
msgid "Set Multiple:"
-msgstr ""
+msgstr "Çoklu Ayarla:"
#: editor/editor_log.cpp
msgid "Output:"
@@ -1811,7 +1790,7 @@ msgstr "Proje dışa aktarımı %d hata koduyla başarısız."
#: editor/editor_node.cpp
msgid "Imported resources can't be saved."
-msgstr ""
+msgstr "İçe aktarılmış kaynaklar kaydedilemez."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
#: scene/gui/dialogs.cpp
@@ -1823,10 +1802,13 @@ msgid "Error saving resource!"
msgstr "Kaynak kaydedilirken hata!"
#: editor/editor_node.cpp
+#, fuzzy
msgid ""
"This resource can't be saved because it does not belong to the edited scene. "
"Make it unique first."
msgstr ""
+"Bu kaynak düzenlenen sahneye ait olmadığı için kaydedilemez. Önce benzersiz "
+"hale getir."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Save Resource As..."
@@ -1846,7 +1828,7 @@ msgstr "Kaydedilirken hata oluÅŸtu."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Can't open '%s'. The file could have been moved or deleted."
-msgstr ""
+msgstr "'%s' açılamıyor. Dosya taşınmış ya da silinmiş olabilir."
#: editor/editor_node.cpp
msgid "Error while parsing '%s'."
@@ -1885,6 +1867,8 @@ msgid ""
"This scene can't be saved because there is a cyclic instancing inclusion.\n"
"Please resolve it and then attempt to save again."
msgstr ""
+"Sahne döngüsel örnekleme bulundurduğu için kaydedilemiyor.\n"
+"Lütfen bunu düzeltin ve bir daha kaydetmeyi deneyin."
#: editor/editor_node.cpp
msgid ""
@@ -1896,7 +1880,7 @@ msgstr ""
#: editor/editor_node.cpp editor/scene_tree_dock.cpp
msgid "Can't overwrite scene that is still open!"
-msgstr ""
+msgstr "Açık olan sahnenin üzerine yazılamıyor!"
#: editor/editor_node.cpp
msgid "Can't load MeshLibrary for merging!"
@@ -2047,14 +2031,12 @@ msgid "Save changes to '%s' before closing?"
msgstr "Kapatmadan önce değişklikler buraya '%s' kaydedilsin mi?"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Saved %s modified resource(s)."
-msgstr "Kaynak yükleme başarısız oldu."
+msgstr "'%s' deÄŸiÅŸtirilmiÅŸ kaynak kaydedildi."
#: editor/editor_node.cpp
-#, fuzzy
msgid "A root node is required to save the scene."
-msgstr "Büyük doku için yalnızca bir dizeç gereklidir."
+msgstr "Sahneyi kaydedilmesi için kök düğüm gerekiyor."
#: editor/editor_node.cpp
msgid "Save Scene As..."
@@ -2165,11 +2147,12 @@ msgid "Unable to load addon script from path: '%s'."
msgstr "Yoldaki eklenti betiği yüklenemedi: '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Unable to load addon script from path: '%s' There seems to be an error in "
"the code, please check the syntax."
-msgstr "Eklenti betiği '%s' yolundan yüklenemedi. Betik araç modunda değil."
+msgstr ""
+"'%s' adresindeki eklenti betik yüklenemiyor. Kodun içinde bir hata var gibi "
+"görünüyor, lütfen sözdizimini kontrol edin."
#: editor/editor_node.cpp
msgid ""
@@ -2225,14 +2208,12 @@ msgid "Show in FileSystem"
msgstr "Dosya Sisteminde Göster"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Play This Scene"
-msgstr "Sahneyi Oynat"
+msgstr "Bu Sahneyi Oynat"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Close Tab"
-msgstr "DiÄŸer Sekmeleri Kapat"
+msgstr "Sekmeyi Kapat"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
@@ -2307,7 +2288,6 @@ msgid "Save Scene"
msgstr "Sahne Kaydet"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save All Scenes"
msgstr "Tüm Sahneleri Kaydet"
@@ -2366,9 +2346,8 @@ msgid "Tools"
msgstr "Araçlar"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Open Project Data Folder"
-msgstr "Proje Yöneticisi Açılsın mı?"
+msgstr "Proje Verileri Klasörünü Aç"
#: editor/editor_node.cpp
msgid "Quit to Project List"
@@ -2483,18 +2462,16 @@ msgid "Toggle Fullscreen"
msgstr "Tam Ekran Aç / Kapat"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Open Editor Data/Settings Folder"
-msgstr "Düzenleyici Ayarları"
+msgstr "Düzenleyici Verileri/Ayarları Klasörünü Aç"
#: editor/editor_node.cpp
msgid "Open Editor Data Folder"
-msgstr ""
+msgstr "Düzenleyici Verileri Klasörünü Aç"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Open Editor Settings Folder"
-msgstr "Düzenleyici Ayarları"
+msgstr "Düzenleyici Ayarları Klasörünü Aç"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
@@ -2575,12 +2552,12 @@ msgstr "Özel Sahneyi Oynat"
#: editor/editor_node.cpp
msgid "Changing the video driver requires restarting the editor."
msgstr ""
+"Görüntü sürücüsünü değiştirmek için editörün yeniden başlatılması gerekiyor."
#: editor/editor_node.cpp editor/project_settings_editor.cpp
#: editor/settings_config_dialog.cpp
-#, fuzzy
msgid "Save & Restart"
-msgstr "Kaydet & Yeniden İçe Aktar"
+msgstr "Kaydet ve BaÅŸtan BaÅŸlat"
#: editor/editor_node.cpp
#, fuzzy
@@ -2617,9 +2594,8 @@ msgid "Node"
msgstr "Düğüm"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Expand Bottom Panel"
-msgstr "Hepsini geniÅŸlet"
+msgstr "Alt Panoyu GeniÅŸlet"
#: editor/editor_node.cpp scene/resources/visual_shader.cpp
msgid "Output"
@@ -2698,9 +2674,8 @@ msgid "Thumbnail..."
msgstr "Küçük Resim..."
#: editor/editor_plugin_settings.cpp
-#, fuzzy
msgid "Edit Plugin"
-msgstr "Çokluyu Düzenleyin"
+msgstr "Eklentiyi Düzenle"
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2724,15 +2699,13 @@ msgid "Status:"
msgstr "Durum:"
#: editor/editor_plugin_settings.cpp
-#, fuzzy
msgid "Edit:"
-msgstr "Düzenle"
+msgstr "Düzenle:"
#: editor/editor_profiler.cpp editor/plugins/animation_state_machine_editor.cpp
#: editor/rename_dialog.cpp
-#, fuzzy
msgid "Start"
-msgstr "BaÅŸlat!"
+msgstr "BaÅŸlat"
#: editor/editor_profiler.cpp
msgid "Measure:"
@@ -2784,7 +2757,7 @@ msgstr "Açık"
#: editor/editor_properties.cpp
msgid "Layer"
-msgstr ""
+msgstr "Katman"
#: editor/editor_properties.cpp
#, fuzzy
@@ -2810,20 +2783,31 @@ msgid ""
"The selected resource (%s) does not match any type expected for this "
"property (%s)."
msgstr ""
+"Seçili kaynak (%s) bu özellik (%s) için beklenen herhangi bir tip ile "
+"uyuÅŸmuyor."
#: editor/editor_properties.cpp
+#, fuzzy
msgid ""
"Can't create a ViewportTexture on resources saved as a file.\n"
"Resource needs to belong to a scene."
msgstr ""
+"Dosya şeklinde kaydedilmiş kaynakların üzerine ViewportTexture "
+"oluşturulamıyor.\n"
+"Kaynak bir sahneye ait olmalı."
#: editor/editor_properties.cpp
+#, fuzzy
msgid ""
"Can't create a ViewportTexture on this resource because it's not set as "
"local to scene.\n"
"Please switch on the 'local to scene' property on it (and all resources "
"containing it up to a node)."
msgstr ""
+"Bu kaynak üzerine ViewportTexture oluşturulamıyor çünkü bu kaynak 'local to "
+"scene' olarak ayarlanmadı.\n"
+"Lütfen bu kaynak (ve bir düğüme kadarki bütün kaynakların) üzerindeki 'local "
+"to scene' özelliğini açın."
#: editor/editor_properties.cpp editor/property_editor.cpp
msgid "Pick a Viewport"
@@ -2878,7 +2862,7 @@ msgstr "Odacık Boyutu:"
#: editor/editor_properties_array_dict.cpp
msgid "Page: "
-msgstr ""
+msgstr "Sayfa: "
#: editor/editor_properties_array_dict.cpp
#, fuzzy
@@ -2892,7 +2876,7 @@ msgstr "Yeni ad:"
#: editor/editor_properties_array_dict.cpp
msgid "Add Key/Value Pair"
-msgstr ""
+msgstr "Anahtar/DeÄŸer Ä°kilisini Ekle"
#: editor/editor_properties_array_dict.cpp
#: editor/plugins/theme_editor_plugin.cpp
@@ -3052,6 +3036,8 @@ msgid ""
"Templates installation failed. The problematic templates archives can be "
"found at '%s'."
msgstr ""
+"Şablon yüklemesi başarısız oldu. Sorunlu şablon arşivi şurada bulunabilir: "
+"'%s'."
#: editor/export_template_manager.cpp
msgid "Error requesting url: "
@@ -3370,42 +3356,36 @@ msgid "Replace all (no undo)"
msgstr "Tümünü Değiştir"
#: editor/find_in_files.cpp
-#, fuzzy
msgid "Searching..."
-msgstr "Kaydediliyor..."
+msgstr "Aranıyor..."
#: editor/find_in_files.cpp
-#, fuzzy
msgid "Search complete"
-msgstr "Yazı Ara"
+msgstr "Arama tamamlandı"
#: editor/groups_editor.cpp
-#, fuzzy
msgid "Group name already exists."
-msgstr "HATA: Bu animasyon adı zaten var!"
+msgstr "Grup adı zaten var."
#: editor/groups_editor.cpp
-#, fuzzy
msgid "Invalid group name."
-msgstr "Geçersiz ad."
+msgstr "Geçersiz grup adı."
#: editor/groups_editor.cpp editor/node_dock.cpp
msgid "Groups"
msgstr "Gruplar"
#: editor/groups_editor.cpp
-#, fuzzy
msgid "Nodes not in Group"
-msgstr "Öbeğe Ekle"
+msgstr "Düğümler Grupta Değil"
#: editor/groups_editor.cpp editor/scene_tree_dock.cpp
msgid "Filter nodes"
msgstr "Düğümleri Süzgeçden Geçir"
#: editor/groups_editor.cpp
-#, fuzzy
msgid "Nodes in Group"
-msgstr "Öbekleri Düzenle"
+msgstr "Gruptaki Düğümler"
#: editor/groups_editor.cpp
msgid "Add to Group"
@@ -3416,9 +3396,8 @@ msgid "Remove from Group"
msgstr "Öbekten Kaldır"
#: editor/groups_editor.cpp
-#, fuzzy
msgid "Manage Groups"
-msgstr "Bediz Öbekleri"
+msgstr "Grupları Düzenle"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Single Scene"
@@ -3525,30 +3504,31 @@ msgstr "Yeniden İçe Aktar"
#: editor/import_dock.cpp
msgid "Save scenes, re-import and restart"
-msgstr ""
+msgstr "Sahneleri kaydet, tekrar içe aktar ve baştan başlat"
#: editor/import_dock.cpp
msgid "Changing the type of an imported file requires editor restart."
msgstr ""
+"İçe aktarılmış dosyanın tipini değiştirmek editörü baştan başlatılmasını "
+"gerektiriyor."
#: editor/import_dock.cpp
+#, fuzzy
msgid ""
"WARNING: Assets exist that use this resource, they may stop loading properly."
-msgstr ""
+msgstr "UYARI: Bu kaynağı kullanan varlıklar mevcut, doğru yüklenemeyebililer."
#: editor/inspector_dock.cpp
msgid "Failed to load resource."
msgstr "Kaynak yükleme başarısız oldu."
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Expand All Properties"
-msgstr "Tüm özellikleri genişlet"
+msgstr "Tüm Özellikleri Genişlet"
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Collapse All Properties"
-msgstr "Tüm özellikleri daralt"
+msgstr "Tüm Özellikleri Daralt"
#: editor/inspector_dock.cpp editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -3564,9 +3544,8 @@ msgid "Paste Params"
msgstr "Parametreleri Yapıştır"
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Edit Resource Clipboard"
-msgstr "Kaynak panosu boÅŸ!"
+msgstr "Kaynak Panosunu Düzenle"
#: editor/inspector_dock.cpp
msgid "Copy Resource"
@@ -3613,9 +3592,8 @@ msgid "Object properties."
msgstr "Nesne özellikleri."
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Filter properties"
-msgstr "Düğümleri Süzgeçden Geçir"
+msgstr "Özellikleri süz"
#: editor/inspector_dock.cpp
msgid "Changes may be lost!"
@@ -3630,87 +3608,74 @@ msgid "Select a Node to edit Signals and Groups."
msgstr "Sinyalleri ve Grupları düzenlemek için bir Düğüm seçin."
#: editor/plugin_config_dialog.cpp
-#, fuzzy
msgid "Edit a Plugin"
-msgstr "Çokluyu Düzenleyin"
+msgstr "Eklentiyi Düzenleyin"
#: editor/plugin_config_dialog.cpp
-#, fuzzy
msgid "Create a Plugin"
-msgstr "C# Çözümü oluştur"
+msgstr "Eklenti OluÅŸtur"
#: editor/plugin_config_dialog.cpp
-#, fuzzy
msgid "Plugin Name:"
-msgstr "Eklentiler"
+msgstr "Eklentinin Adı:"
#: editor/plugin_config_dialog.cpp
msgid "Subfolder:"
-msgstr ""
+msgstr "Alt Klasör:"
#: editor/plugin_config_dialog.cpp
-#, fuzzy
msgid "Language:"
-msgstr "Dil"
+msgstr "Dil:"
#: editor/plugin_config_dialog.cpp
-#, fuzzy
msgid "Script Name:"
-msgstr "Betik geçerli"
+msgstr "Betik Adı:"
#: editor/plugin_config_dialog.cpp
msgid "Activate now?"
-msgstr ""
+msgstr "Åžimdi etkinleÅŸtirilsin mi?"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon"
-msgstr "Çoklu Oluşturun"
+msgstr "Çokgen Oluştur"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Create points."
-msgstr "Noktaları sil"
+msgstr "Noktalar oluÅŸtur."
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid ""
"Edit points.\n"
"LMB: Move Point\n"
"RMB: Erase Point"
msgstr ""
-"Varolan çokgeni düzenle:\n"
-"FareSolTık: Noktayı Taşı.\n"
-"Ctrl+FareSolTık: Parça Ayır.\n"
-"FareSağTık: Noktayı Sil."
+"Noktaları düzenle\n"
+"Sol Fare Düğmesi: Noktayı Taşı\n"
+"Sağ Fare Düğmesi: Noktayı Sil"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/animation_blend_space_1d_editor.cpp
-#, fuzzy
msgid "Erase points."
-msgstr "RMB: Noktayı Sil."
+msgstr "Noktaları sil."
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Edit Polygon"
-msgstr "Çokluyu Düzenleyin"
+msgstr "Çokgeni Düzenle"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Insert Point"
msgstr "Nokta YerleÅŸtir"
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Edit Polygon (Remove Point)"
-msgstr "Çokluyu Düzenleyin (Noktayı Silin)"
+msgstr "Çokgeni Düzenle (Noktayı Sil)"
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Remove Polygon And Point"
-msgstr "Çokluyu ve Noktayı Kaldır"
+msgstr "Çokgeni ve Noktayı Kaldır"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3724,52 +3689,48 @@ msgstr "Animasyon Ekle"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Load..."
-msgstr "Yükle"
+msgstr "Yükle..."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Move Node Point"
-msgstr "Noktayı Taşı"
+msgstr "Düğüm Noktasını Taşı"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#, fuzzy
msgid "Change BlendSpace1D Limits"
-msgstr "Karışım Süresini Değiştir"
+msgstr "BlendSpace1D'nin Sınırlarını Değiştir"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#, fuzzy
msgid "Change BlendSpace1D Labels"
-msgstr "Karışım Süresini Değiştir"
+msgstr "BlendSpace1D'nin Etiketlerini DeÄŸiÅŸtir"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_state_machine_editor.cpp
msgid "This type of node can't be used. Only root nodes are allowed."
-msgstr ""
+msgstr "Bu tipte bir düğüm kullanılamaz. Sadece kök düğümlere izin verilir."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Add Node Point"
-msgstr "Düğüm Ekle"
+msgstr "Düğüm Noktası Ekle"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Add Animation Point"
-msgstr "Animasyon Ekle"
+msgstr "Animasyon Noktası Ekle"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#, fuzzy
msgid "Remove BlendSpace1D Point"
-msgstr "Yol Noktasını Kaldır"
+msgstr "BlendSpace1D Noktasını Kaldır"
#: editor/plugins/animation_blend_space_1d_editor.cpp
msgid "Move BlendSpace1D Node Point"
-msgstr ""
+msgstr "BlendSpace1D Düğüm Noktasını Taşı"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
@@ -3779,73 +3740,75 @@ msgid ""
"AnimationTree is inactive.\n"
"Activate to enable playback, check node warnings if activation fails."
msgstr ""
+"AnimationTree etkin deÄŸil.\n"
+"Pleybeki aktifleştirmek için etkin hale getirin. Etkin hale gelmediği "
+"taktirde düğüm uyarılarını kontrol edin."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
+#, fuzzy
msgid "Set the blending position within the space"
-msgstr ""
+msgstr "Harmanlama konumunu uzay içinde ayarla"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Select and move points, create points with RMB."
-msgstr ""
+msgstr "Noktaları seç ve taşı. Sağ fare düğmesi ile yeni noktalar oluştur."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp scene/gui/graph_edit.cpp
msgid "Enable snap and show grid."
-msgstr ""
+msgstr "Yapıştırmayı etkinleştir ve ızgarayı göster."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Point"
-msgstr "Noktayı Taşı"
+msgstr "Nokta"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Open Animation Node"
-msgstr "Animasyon Düğümü"
+msgstr "Animasyon Düğümünü Aç"
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Triangle already exists"
-msgstr "Ä°ÅŸlem '%s' zaten var!"
+msgstr "Üçgen zaten var"
#: editor/plugins/animation_blend_space_2d_editor.cpp
-#, fuzzy
msgid "Add Triangle"
-msgstr "DeÄŸiÅŸken Ekle"
+msgstr "Üçgen Ekle"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#, fuzzy
msgid "Change BlendSpace2D Limits"
-msgstr "Karışım Süresini Değiştir"
+msgstr "BlendSpace2D Sınırlarını Değiştir"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#, fuzzy
msgid "Change BlendSpace2D Labels"
-msgstr "Karışım Süresini Değiştir"
+msgstr "BlendSpace2D Etiketlerini DeÄŸiÅŸtir"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#, fuzzy
msgid "Remove BlendSpace2D Point"
-msgstr "Yol Noktasını Kaldır"
+msgstr "BlendSpace2D Noktasını Kaldır"
#: editor/plugins/animation_blend_space_2d_editor.cpp
#, fuzzy
msgid "Remove BlendSpace2D Triangle"
-msgstr "Değişkeni Kaldır"
+msgstr "BlendSpace2D Üçgenini Kaldır"
#: editor/plugins/animation_blend_space_2d_editor.cpp
+#, fuzzy
msgid "BlendSpace2D does not belong to an AnimationTree node."
-msgstr ""
+msgstr "BlendSpace2D, bir AnimationTree düğümüne ait değil."
#: editor/plugins/animation_blend_space_2d_editor.cpp
+#, fuzzy
msgid "No triangles exist, so no blending can take place."
-msgstr ""
+msgstr "Herhangi bir üçgen bulunmuyor, harmanlama işlemi yapılamaz."
#: editor/plugins/animation_blend_space_2d_editor.cpp
#, fuzzy
diff --git a/editor/translations/uk.po b/editor/translations/uk.po
index 637c1ffac4..15d169313b 100644
--- a/editor/translations/uk.po
+++ b/editor/translations/uk.po
@@ -15,7 +15,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ukrainian (Godot Engine)\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2019-03-30 20:04+0000\n"
+"PO-Revision-Date: 2019-04-29 08:48+0000\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/godot-engine/"
"godot/uk/>\n"
@@ -25,7 +25,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 3.6-dev\n"
+"X-Generator: Weblate 3.6.1\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -163,14 +163,20 @@ msgid "Animation Playback Track"
msgstr "Доріжка Ð²Ñ–Ð´Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð°Ð½Ñ–Ð¼Ð°Ñ†Ñ–Ñ—"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "Додати доріжку"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "ТриваліÑÑ‚ÑŒ анімації (у Ñекундах)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "ТриваліÑÑ‚ÑŒ анімації (у Ñекундах)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "Додати доріжку"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "ЦиклічніÑÑ‚ÑŒ анімації"
@@ -425,9 +431,8 @@ msgstr ""
"Групувати доріжки за вузлами або показувати Ñ—Ñ… у форматі проÑтого ÑпиÑку."
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "ПрилипаннÑ"
+msgstr "ПрилипаннÑ:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -435,7 +440,7 @@ msgstr "Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ ÐºÑ€Ð¾ÐºÑƒ анімації."
#: editor/animation_track_editor.cpp
msgid "Seconds"
-msgstr ""
+msgstr "Секунди"
#: editor/animation_track_editor.cpp
msgid "FPS"
@@ -4811,20 +4816,19 @@ msgstr "Макет"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
-msgstr ""
+msgstr "МаÑка перенеÑÐµÐ½Ð½Ñ Ð´Ð»Ñ Ð²ÑтавлÑÐ½Ð½Ñ ÐºÐ»ÑŽÑ‡Ð¾Ð²Ð¸Ñ… кадрів."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation mask for inserting keys."
-msgstr ""
+msgstr "МаÑка Ð¾Ð±ÐµÑ€Ñ‚Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ð²ÑтавлÑÐ½Ð½Ñ ÐºÐ»ÑŽÑ‡Ð¾Ð²Ð¸Ñ… кадрів."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Scale mask for inserting keys."
-msgstr ""
+msgstr "МаÑка маÑÑˆÑ‚Ð°Ð±ÑƒÐ²Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ð²ÑтавлÑÐ½Ð½Ñ ÐºÐ»ÑŽÑ‡Ð¾Ð²Ð¸Ñ… кадрів."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert keys (based on mask)."
-msgstr "Ð’Ñтавити ключ (Ñ–Ñнуючі доріжки)"
+msgstr "Ð’Ñтавити ключові кадри (на оÑнові маÑки)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -4833,11 +4837,15 @@ msgid ""
"Keys are only added to existing tracks, no new tracks will be created.\n"
"Keys must be inserted manually for the first time."
msgstr ""
+"Ðвтоматично вÑтавлÑти ключові кадри при перенеÑенні, обертанні або "
+"маÑштабуванні об'єктів (на оÑнові маÑки).\n"
+"Ключові кадри додаватимутьÑÑ Ð»Ð¸ÑˆÐµ до наÑвних доріжок, нові доріжки не "
+"ÑтворюватимутьÑÑ.\n"
+"Спершу ключові кадри Ñлід додати вручну."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Ð’Ñтавити ключ анімації"
+msgstr "ÐвтовÑÑ‚Ð°Ð²Ð»ÐµÐ½Ð½Ñ ÐºÐ»ÑŽÑ‡Ð¾Ð²Ð¾Ð³Ð¾ кадру"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -5826,9 +5834,8 @@ msgid "Save Theme As..."
msgstr "Зберегти тему Ñк..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "%s Class Reference"
-msgstr " ПоÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð½Ð° клаÑ"
+msgstr "Довідник з клаÑу %s"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle alphabetical sorting of the method list."
@@ -6653,24 +6660,20 @@ msgid "Nameless gizmo"
msgstr "Штука без назви"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Mesh2D"
-msgstr "Створити плоÑку Ñітку"
+msgstr "Створити Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon2D"
-msgstr "Створити Polygon3D"
+msgstr "Створити Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D"
-msgstr "Створити полігон зіткненнÑ"
+msgstr "Створити CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D"
-msgstr "Створено затінювальний полігон"
+msgstr "Створити LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite is empty!"
@@ -6687,43 +6690,36 @@ msgid "Invalid geometry, can't replace by mesh."
msgstr "Ðекоректна геометріÑ, неможливо замінити Ñіткою."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create polygon."
-msgstr "Ðекоректна геометріÑ, неможливо замінити Ñіткою."
+msgstr "Ðекоректна геометріÑ, неможливо Ñтворити багатокутник."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create collision polygon."
-msgstr "Ðекоректна геометріÑ, неможливо замінити Ñіткою."
+msgstr "Ðекоректна геометріÑ, неможливо Ñтворити багатокутник зіткненнÑ."
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Invalid geometry, can't create light occluder."
-msgstr "Ðекоректна геометріÑ, неможливо замінити Ñіткою."
+msgstr "Ðекоректна геометріÑ, неможливо Ñтворити перешкоду Ñвітла."
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Sprite"
msgstr "Спрайт"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Mesh2D"
-msgstr "Перетворити на плоÑку Ñітку"
+msgstr "Перетворити на Mesh2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Convert to Polygon2D"
-msgstr "ПереміÑтити полігон"
+msgstr "Перетворити на Polygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create CollisionPolygon2D Sibling"
-msgstr "Створити полігон зіткненнÑ"
+msgstr "Створити близнюк CollisionPolygon2D"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Create LightOccluder2D Sibling"
-msgstr "Створено затінювальний полігон"
+msgstr "Створити близнюка LightOccluder2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Simplification: "
@@ -7312,9 +7308,8 @@ msgid "Duplicate Nodes"
msgstr "Дублювати вузли"
#: editor/plugins/visual_shader_editor_plugin.cpp
-#, fuzzy
msgid "Delete Nodes"
-msgstr "Вилучити вузол"
+msgstr "Вилучити вузли"
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Visual Shader Input Type Changed"
diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po
index cf4d0fe630..6a737994a5 100644
--- a/editor/translations/ur_PK.po
+++ b/editor/translations/ur_PK.po
@@ -158,11 +158,15 @@ msgid "Animation Playback Track"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Add Track"
+msgid "Animation length (frames)"
msgstr ""
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
+msgstr ""
+
+#: editor/animation_track_editor.cpp
+msgid "Add Track"
msgstr ""
#: editor/animation_track_editor.cpp
diff --git a/editor/translations/vi.po b/editor/translations/vi.po
index d18046ad52..49201d2c9f 100644
--- a/editor/translations/vi.po
+++ b/editor/translations/vi.po
@@ -164,16 +164,21 @@ msgstr "Ngưng chạy animation. (S)"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "Thêm Track Animation"
+msgid "Animation length (frames)"
+msgstr "Äá»™ dài Animation (giây)."
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "Äá»™ dài Animation (giây)."
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "Thêm Track Animation"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "Phóng Animation."
diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po
index 3e03b0e8ff..f087c45047 100644
--- a/editor/translations/zh_CN.po
+++ b/editor/translations/zh_CN.po
@@ -44,12 +44,14 @@
# simano clio <sim2cle@gmail.com>, 2019.
# ByonkoGalilei <byonko@qq.com>, 2019.
# qjyqjyqjyqjy <qjyqjyqjyqjy@sina.com.cn>, 2019.
+# liushuyu011 <liushuyu011@gmail.com>, 2019.
+# DS <dseqrasd@126.com>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified) (Godot Engine)\n"
"POT-Creation-Date: 2018-01-20 12:15+0200\n"
-"PO-Revision-Date: 2019-04-23 15:48+0000\n"
-"Last-Translator: qjyqjyqjyqjy <qjyqjyqjyqjy@sina.com.cn>\n"
+"PO-Revision-Date: 2019-05-16 18:48+0000\n"
+"Last-Translator: DS <dseqrasd@126.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"godot-engine/godot/zh_Hans/>\n"
"Language: zh_CN\n"
@@ -193,14 +195,20 @@ msgid "Animation Playback Track"
msgstr "动画回放轨é“"
#: editor/animation_track_editor.cpp
-msgid "Add Track"
-msgstr "添加轨é“"
+#, fuzzy
+msgid "Animation length (frames)"
+msgstr "动画时长(秒)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "动画时长(秒)"
#: editor/animation_track_editor.cpp
+msgid "Add Track"
+msgstr "添加轨é“"
+
+#: editor/animation_track_editor.cpp
msgid "Animation Looping"
msgstr "动画循环"
@@ -450,9 +458,8 @@ msgid "Group tracks by node or display them as plain list."
msgstr "按节点分组或将它们显示为普通列表。"
#: editor/animation_track_editor.cpp
-#, fuzzy
msgid "Snap:"
-msgstr "å¸é™„"
+msgstr "å¸é™„:"
#: editor/animation_track_editor.cpp
msgid "Animation step value."
@@ -7953,7 +7960,7 @@ msgstr "编辑器需è¦é‡å¯ä»¥è®©ä¿®æ”¹ç”Ÿæ•ˆ"
#: editor/project_settings_editor.cpp
msgid "Input Map"
-msgstr "事件表"
+msgstr "é”®ä½æ˜ å°„"
#: editor/project_settings_editor.cpp
msgid "Action:"
diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po
index 45b43c3ce6..418c8c2987 100644
--- a/editor/translations/zh_HK.po
+++ b/editor/translations/zh_HK.po
@@ -163,16 +163,21 @@ msgstr ""
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "新增動畫軌跡"
+msgid "Animation length (frames)"
+msgstr "時長(秒)。"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Animation Length Time (seconds)"
+msgid "Animation length (seconds)"
msgstr "時長(秒)。"
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "新增動畫軌跡"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "動畫縮放。"
diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po
index 6f858474a2..a6bac6efe4 100644
--- a/editor/translations/zh_TW.po
+++ b/editor/translations/zh_TW.po
@@ -166,15 +166,21 @@ msgstr "動畫回放軌é“"
#: editor/animation_track_editor.cpp
#, fuzzy
-msgid "Add Track"
-msgstr "添加動畫軌"
+msgid "Animation length (frames)"
+msgstr "動畫長度(秒)"
#: editor/animation_track_editor.cpp
-msgid "Animation Length Time (seconds)"
+#, fuzzy
+msgid "Animation length (seconds)"
msgstr "動畫長度(秒)"
#: editor/animation_track_editor.cpp
#, fuzzy
+msgid "Add Track"
+msgstr "添加動畫軌"
+
+#: editor/animation_track_editor.cpp
+#, fuzzy
msgid "Animation Looping"
msgstr "動畫空間。"
diff --git a/main/main.cpp b/main/main.cpp
index fc9ec3b2d9..fdb5bca624 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -247,6 +247,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(").\n");
OS::get_singleton()->print("\n");
+#ifndef SERVER_ENABLED
OS::get_singleton()->print("Display options:\n");
OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
@@ -257,14 +258,15 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS and Windows only).\n");
OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
OS::get_singleton()->print("\n");
+#endif
OS::get_singleton()->print("Debug options:\n");
OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n");
OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n");
OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n");
OS::get_singleton()->print(" --remote-debug <address> Remote debug (<host/IP>:<port> address).\n");
-#ifdef DEBUG_ENABLED
- OS::get_singleton()->print(" --debug-collisions Show collisions shapes when running the scene.\n");
+#if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED)
+ OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n");
OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
#endif
OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
@@ -429,6 +431,49 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
print_line(get_full_version_string());
goto error;
+ } else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
+
+ OS::get_singleton()->_verbose_stdout = true;
+ } else if (I->get() == "--quiet") { // quieter output
+
+ quiet_stdout = true;
+
+ } else if (I->get() == "--audio-driver") { // audio driver
+
+ if (I->next()) {
+
+ audio_driver = I->next()->get();
+ N = I->next()->next();
+ } else {
+ OS::get_singleton()->print("Missing audio driver argument, aborting.\n");
+ goto error;
+ }
+
+ } else if (I->get() == "--video-driver") { // force video driver
+
+ if (I->next()) {
+
+ video_driver = I->next()->get();
+ N = I->next()->next();
+ } else {
+ OS::get_singleton()->print("Missing video driver argument, aborting.\n");
+ goto error;
+ }
+#ifndef SERVER_ENABLED
+ } else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
+
+ init_fullscreen = true;
+ } else if (I->get() == "-m" || I->get() == "--maximized") { // force maximized window
+
+ init_maximized = true;
+ video_mode.maximized = true;
+
+ } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
+
+ init_windowed = true;
+ } else if (I->get() == "-t" || I->get() == "--always-on-top") { // force always-on-top window
+
+ init_always_on_top = true;
} else if (I->get() == "--resolution") { // force resolution
if (I->next()) {
@@ -459,6 +504,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing resolution argument, aborting.\n");
goto error;
}
+
} else if (I->get() == "--position") { // set window position
if (I->next()) {
@@ -483,29 +529,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
goto error;
}
- } else if (I->get() == "-m" || I->get() == "--maximized") { // force maximized window
-
- init_maximized = true;
- video_mode.maximized = true;
- } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
+ } else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
- init_windowed = true;
- } else if (I->get() == "-t" || I->get() == "--always-on-top") { // force always-on-top window
+ force_lowdpi = true;
+ } else if (I->get() == "--no-window") { // disable window creation (Windows only)
- init_always_on_top = true;
+ OS::get_singleton()->set_no_window_mode(true);
+#endif
} else if (I->get() == "--profiling") { // enable profiling
use_debug_profiler = true;
- } else if (I->get() == "--video-driver") { // force video driver
-
- if (I->next()) {
- video_driver = I->next()->get();
- N = I->next()->next();
- } else {
- OS::get_singleton()->print("Missing video driver argument, aborting.\n");
- goto error;
- }
} else if (I->get() == "-l" || I->get() == "--language") { // language
if (I->next()) {
@@ -516,9 +550,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing language argument, aborting.\n");
goto error;
}
- } else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
- force_lowdpi = true;
} else if (I->get() == "--remote-fs") { // remote filesystem
if (I->next()) {
@@ -555,22 +587,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing render thread mode argument, aborting.\n");
goto error;
}
-
- } else if (I->get() == "--audio-driver") { // audio driver
-
- if (I->next()) {
-
- audio_driver = I->next()->get();
- N = I->next()->next();
- } else {
- OS::get_singleton()->print("Missing audio driver argument, aborting.\n");
- goto error;
- }
-
- } else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
-
- //video_mode.fullscreen=false;
- init_fullscreen = true;
#ifdef TOOLS_ENABLED
} else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
@@ -583,14 +599,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
auto_build_solutions = true;
editor = true;
#endif
- } else if (I->get() == "--no-window") { // disable window creation, Windows only
-
- OS::get_singleton()->set_no_window_mode(true);
- } else if (I->get() == "--quiet") { // quieter output
-
- quiet_stdout = true;
- } else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
- OS::get_singleton()->_verbose_stdout = true;
} else if (I->get() == "--path") { // set path of project to start or edit
if (I->next()) {
@@ -674,7 +682,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-d" || I->get() == "--debug") {
debug_mode = "local";
-#ifdef DEBUG_ENABLED
+#if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED)
} else if (I->get() == "--debug-collisions") {
debug_collisions = true;
} else if (I->get() == "--debug-navigation") {
@@ -1027,7 +1035,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false));
- OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(GLOBAL_DEF("application/run/low_processor_mode_sleep_usec", 8000));
+ OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(GLOBAL_DEF("application/run/low_processor_mode_sleep_usec", 6900)); // Roughly 144 FPS
ProjectSettings::get_singleton()->set_custom_property_info("application/run/low_processor_mode_sleep_usec", PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater")); // No negative numbers
Engine::get_singleton()->set_frame_delay(frame_delay);
@@ -1189,6 +1197,12 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
GLOBAL_DEF("application/config/icon", String());
ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp"));
+ GLOBAL_DEF("application/config/macos_native_icon", String());
+ ProjectSettings::get_singleton()->set_custom_property_info("application/config/macos_native_icon", PropertyInfo(Variant::STRING, "application/config/macos_native_icon", PROPERTY_HINT_FILE, "*.icns"));
+
+ GLOBAL_DEF("application/config/windows_native_icon", String());
+ ProjectSettings::get_singleton()->set_custom_property_info("application/config/windows_native_icon", PropertyInfo(Variant::STRING, "application/config/windows_native_icon", PROPERTY_HINT_FILE, "*.ico"));
+
InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
if (id) {
if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) && !(editor || project_manager)) {
@@ -1739,8 +1753,24 @@ bool Main::start() {
ERR_FAIL_COND_V(!scene, false)
sml->add_current_scene(scene);
+#ifdef OSX_ENABLED
+ String mac_iconpath = GLOBAL_DEF("application/config/macos_native_icon", "Variant()");
+ if (mac_iconpath != "") {
+ OS::get_singleton()->set_native_icon(mac_iconpath);
+ hasicon = true;
+ }
+#endif
+
+#ifdef WINDOWS_ENABLED
+ String win_iconpath = GLOBAL_DEF("application/config/windows_native_icon", "Variant()");
+ if (win_iconpath != "") {
+ OS::get_singleton()->set_native_icon(win_iconpath);
+ hasicon = true;
+ }
+#endif
+
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
- if (iconpath != "") {
+ if ((iconpath != "") && (!hasicon)) {
Ref<Image> icon;
icon.instance();
if (ImageLoader::load_image(iconpath, icon) == OK) {
@@ -1949,7 +1979,7 @@ bool Main::iteration() {
return exit;
if (OS::get_singleton()->is_in_low_processor_usage_mode() || !OS::get_singleton()->can_draw())
- OS::get_singleton()->delay_usec(OS::get_singleton()->get_low_processor_usage_mode_sleep_usec()); //apply some delay to force idle time (results in about 60 FPS max)
+ OS::get_singleton()->delay_usec(OS::get_singleton()->get_low_processor_usage_mode_sleep_usec()); //apply some delay to force idle time
else {
uint32_t frame_delay = Engine::get_singleton()->get_frame_delay();
if (frame_delay)
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index dcbb930d1b..531887a452 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -33,6 +33,7 @@
//#include "core/math/math_funcs.h"
#include "core/io/ip_address.h"
#include "core/os/os.h"
+#include "modules/regex/regex.h"
#include <stdio.h>
#include "test_string.h"
@@ -429,9 +430,20 @@ bool test_25() {
bool test_26() {
- //TODO: Do replacement RegEx test
- return true;
-};
+ OS::get_singleton()->print("\n\nTest 26: RegEx substitution\n");
+
+ String s = "Double all the vowels.";
+
+ OS::get_singleton()->print("\tString: %ls\n", s.c_str());
+ OS::get_singleton()->print("\tRepeating instances of 'aeiou' once\n");
+
+ RegEx re("(?<vowel>[aeiou])");
+ s = re.sub(s, "$0$vowel", true);
+
+ OS::get_singleton()->print("\tResult: %ls\n", s.c_str());
+
+ return (s == "Doouublee aall thee vooweels.");
+}
struct test_27_data {
char const *data;
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
index 569033d93c..b375293ca6 100644
--- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
@@ -352,7 +352,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
COPY_PHASE_STRIP = NO;
ENABLE_BITCODE = NO;
- "FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary";
+ "FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary/**";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -395,7 +395,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";
COPY_PHASE_STRIP = YES;
ENABLE_BITCODE = NO;
- "FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary";
+ "FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary/**";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh
index ee4d0b2a10..5463a6cedf 100755
--- a/misc/travis/clang-format.sh
+++ b/misc/travis/clang-format.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-CLANG_FORMAT=clang-format-6.0
+CLANG_FORMAT=clang-format-8
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Check the whole commit range against $TRAVIS_BRANCH, the base merge branch
diff --git a/modules/assimp/SCsub b/modules/assimp/SCsub
index 61a357809a..0da7e432e2 100644
--- a/modules/assimp/SCsub
+++ b/modules/assimp/SCsub
@@ -4,19 +4,19 @@ Import('env')
Import('env_modules')
env_assimp = env_modules.Clone()
-env_assimp.Append(CPPPATH=['#thirdparty/assimp'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/include'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
-env_assimp.Append(CPPPATH=['#thirdparty/misc'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/'])
-env_assimp.Append(CPPPATH=['#thirdparty/zlib/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
-env_assimp.Append(CPPPATH=['.'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/misc'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/zlib/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
+env_assimp.Prepend(CPPPATH=['.'])
#env_assimp.Append(CPPFLAGS=['-DASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_BOOST_WORKAROUND'])
env_assimp.Append(CPPFLAGS=['-DOPENDDLPARSER_BUILD'])
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp
index 8d82fb2eeb..8c3c04674b 100644
--- a/modules/assimp/editor_scene_importer_assimp.cpp
+++ b/modules/assimp/editor_scene_importer_assimp.cpp
@@ -310,8 +310,8 @@ void EditorSceneImporterAssimp::_generate_bone_groups(ImportState &state, const
const aiBone *bone = mesh->mBones[j];
String name = _assimp_get_string(bone->mName);
ownership[name] = owned_by;
- //store the actuall full path for the bone transform
- //when skeleton finds it's place in the tree, it will be restored
+ //store the actual full path for the bone transform
+ //when skeleton finds its place in the tree, it will be restored
bind_xforms[name] = mesh_offset * _assimp_matrix_transform(bone->mOffsetMatrix);
}
}
@@ -855,9 +855,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta
Ref<Texture> texture = _load_texture(state, path);
if (texture != NULL) {
- if (map_mode != NULL) {
- _set_texture_mapping_mode(map_mode, texture);
- }
+ _set_texture_mapping_mode(map_mode, texture);
mat->set_feature(SpatialMaterial::Feature::FEATURE_NORMAL_MAPPING, true);
mat->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
}
@@ -1460,7 +1458,7 @@ void EditorSceneImporterAssimp::_generate_node(ImportState &state, const aiNode
int mesh_index = p_assimp_node->mMeshes[i];
surface_indices.push_back(mesh_index);
- //take the chane and attempt to find the skeleton from the bones
+ //take the chance and attempt to find the skeleton from the bones
if (!skeleton) {
aiMesh *ai_mesh = state.assimp_scene->mMeshes[p_assimp_node->mMeshes[i]];
for (uint32_t j = 0; j < ai_mesh->mNumBones; j++) {
@@ -1598,7 +1596,7 @@ void EditorSceneImporterAssimp::_generate_node(ImportState &state, const aiNode
skeleton->localize_rests();
node_name = "Skeleton"; //don't use the bone root name
- node_transform = Transform(); //dont transform
+ node_transform = Transform(); //don't transform
new_node = skeleton;
} else {
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index e7c2fff54c..16d694c238 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -186,7 +186,7 @@ if env['builtin_bullet']:
thirdparty_sources = [thirdparty_dir + file for file in bullet2_src]
- env_bullet.Append(CPPPATH=[thirdparty_dir])
+ env_bullet.Prepend(CPPPATH=[thirdparty_dir])
# if env['target'] == "debug" or env['target'] == "release_debug":
# env_bullet.Append(CPPFLAGS=['-DBT_DEBUG'])
diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp
index b902d08eca..b60d6ba693 100644
--- a/modules/bullet/btRayShape.cpp
+++ b/modules/bullet/btRayShape.cpp
@@ -54,6 +54,11 @@ void btRayShape::setLength(btScalar p_length) {
reload_cache();
}
+void btRayShape::setMargin(btScalar margin) {
+ btConvexInternalShape::setMargin(margin);
+ reload_cache();
+}
+
void btRayShape::setSlipsOnSlope(bool p_slipsOnSlope) {
slipsOnSlope = p_slipsOnSlope;
@@ -77,10 +82,9 @@ void btRayShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVecto
}
void btRayShape::getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const {
-#define MARGIN_BROADPHASE 0.1
btVector3 localAabbMin(0, 0, 0);
- btVector3 localAabbMax(m_shapeAxis * (m_cacheScaledLength + m_collisionMargin));
- btTransformAabb(localAabbMin, localAabbMax, MARGIN_BROADPHASE, t, aabbMin, aabbMax);
+ btVector3 localAabbMax(m_shapeAxis * m_cacheScaledLength);
+ btTransformAabb(localAabbMin, localAabbMax, m_collisionMargin, t, aabbMin, aabbMax);
}
void btRayShape::calculateLocalInertia(btScalar mass, btVector3 &inertia) const {
@@ -100,5 +104,5 @@ void btRayShape::reload_cache() {
m_cacheScaledLength = m_length * m_localScaling[2];
m_cacheSupportPoint.setIdentity();
- m_cacheSupportPoint.setOrigin(m_shapeAxis * (m_cacheScaledLength + m_collisionMargin));
+ m_cacheSupportPoint.setOrigin(m_shapeAxis * m_cacheScaledLength);
}
diff --git a/modules/bullet/btRayShape.h b/modules/bullet/btRayShape.h
index 7fedb74083..7f3229b3e8 100644
--- a/modules/bullet/btRayShape.h
+++ b/modules/bullet/btRayShape.h
@@ -60,6 +60,8 @@ public:
void setLength(btScalar p_length);
btScalar getLength() const { return m_length; }
+ virtual void setMargin(btScalar margin);
+
void setSlipsOnSlope(bool p_slipOnSlope);
bool getSlipsOnSlope() const { return slipsOnSlope; }
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 44ea061f51..be4e0b88e8 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -279,14 +279,14 @@ PhysicsServer::AreaSpaceOverrideMode BulletPhysicsServer::area_get_space_overrid
return area->get_spOv_mode();
}
-void BulletPhysicsServer::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform) {
+void BulletPhysicsServer::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) {
AreaBullet *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
ShapeBullet *shape = shape_owner.get(p_shape);
ERR_FAIL_COND(!shape);
- area->add_shape(shape, p_transform);
+ area->add_shape(shape, p_transform, p_disabled);
}
void BulletPhysicsServer::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
@@ -348,13 +348,13 @@ void BulletPhysicsServer::area_set_shape_disabled(RID p_area, int p_shape_idx, b
area->set_shape_disabled(p_shape_idx, p_disabled);
}
-void BulletPhysicsServer::area_attach_object_instance_id(RID p_area, ObjectID p_ID) {
+void BulletPhysicsServer::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
if (space_owner.owns(p_area)) {
return;
}
AreaBullet *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- area->set_instance_id(p_ID);
+ area->set_instance_id(p_id);
}
ObjectID BulletPhysicsServer::area_get_object_instance_id(RID p_area) const {
@@ -498,7 +498,7 @@ PhysicsServer::BodyMode BulletPhysicsServer::body_get_mode(RID p_body) const {
return body->get_mode();
}
-void BulletPhysicsServer::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform) {
+void BulletPhysicsServer::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
@@ -506,7 +506,7 @@ void BulletPhysicsServer::body_add_shape(RID p_body, RID p_shape, const Transfor
ShapeBullet *shape = shape_owner.get(p_shape);
ERR_FAIL_COND(!shape);
- body->add_shape(shape, p_transform);
+ body->add_shape(shape, p_transform, p_disabled);
}
void BulletPhysicsServer::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
@@ -569,11 +569,11 @@ void BulletPhysicsServer::body_clear_shapes(RID p_body) {
body->remove_all_shapes();
}
-void BulletPhysicsServer::body_attach_object_instance_id(RID p_body, uint32_t p_ID) {
+void BulletPhysicsServer::body_attach_object_instance_id(RID p_body, uint32_t p_id) {
CollisionObjectBullet *body = get_collisin_object(p_body);
ERR_FAIL_COND(!body);
- body->set_instance_id(p_ID);
+ body->set_instance_id(p_id);
}
uint32_t BulletPhysicsServer::body_get_object_instance_id(RID p_body) const {
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index 1b74cbf3fc..0b8ad53658 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -133,7 +133,7 @@ public:
virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode);
virtual AreaSpaceOverrideMode area_get_space_override_mode(RID p_area) const;
- virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform());
+ virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape);
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform);
virtual int area_get_shape_count(RID p_area) const;
@@ -142,7 +142,7 @@ public:
virtual void area_remove_shape(RID p_area, int p_shape_idx);
virtual void area_clear_shapes(RID p_area);
virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled);
- virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID);
+ virtual void area_attach_object_instance_id(RID p_area, ObjectID p_id);
virtual ObjectID area_get_object_instance_id(RID p_area) const;
/// If you pass as p_area the SpaceBullet you can set some parameters as specified below
@@ -174,7 +174,7 @@ public:
virtual void body_set_mode(RID p_body, BodyMode p_mode);
virtual BodyMode body_get_mode(RID p_body) const;
- virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform());
+ virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
// Not supported, Please remove and add new shape
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape);
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform);
@@ -189,7 +189,7 @@ public:
virtual void body_clear_shapes(RID p_body);
// Used for Rigid and Soft Bodies
- virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID);
+ virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id);
virtual uint32_t body_get_object_instance_id(RID p_body) const;
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable);
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp
index ef5f21fc21..166d7e6158 100644
--- a/modules/bullet/collision_object_bullet.cpp
+++ b/modules/bullet/collision_object_bullet.cpp
@@ -43,7 +43,9 @@
@author AndreaCatania
*/
-#define enableDynamicAabbTree false
+// We enable dynamic AABB tree so that we can actually perform a broadphase on bodies with compound collision shapes.
+// This is crucial for the performance of kinematic bodies and for bodies with transforming shapes.
+#define enableDynamicAabbTree true
CollisionObjectBullet::ShapeWrapper::~ShapeWrapper() {}
@@ -57,6 +59,25 @@ void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_tra
transform = p_transform;
}
+btTransform CollisionObjectBullet::ShapeWrapper::get_adjusted_transform() const {
+ if (shape->get_type() == PhysicsServer::SHAPE_HEIGHTMAP) {
+ const HeightMapShapeBullet *hm_shape = (const HeightMapShapeBullet *)shape; // should be safe to cast now
+ btTransform adjusted_transform;
+
+ // Bullet centers our heightmap:
+ // https://github.com/bulletphysics/bullet3/blob/master/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h#L33
+ // This is really counter intuitive so we're adjusting for it
+
+ adjusted_transform.setIdentity();
+ adjusted_transform.setOrigin(btVector3(0.0, hm_shape->min_height + ((hm_shape->max_height - hm_shape->min_height) * 0.5), 0.0));
+ adjusted_transform *= transform;
+
+ return adjusted_transform;
+ } else {
+ return transform;
+ }
+}
+
void CollisionObjectBullet::ShapeWrapper::claim_bt_shape(const btVector3 &body_scale) {
if (!bt_shape) {
if (active)
@@ -216,8 +237,8 @@ RigidCollisionObjectBullet::~RigidCollisionObjectBullet() {
}
}
-void RigidCollisionObjectBullet::add_shape(ShapeBullet *p_shape, const Transform &p_transform) {
- shapes.push_back(ShapeWrapper(p_shape, p_transform, true));
+void RigidCollisionObjectBullet::add_shape(ShapeBullet *p_shape, const Transform &p_transform, bool p_disabled) {
+ shapes.push_back(ShapeWrapper(p_shape, p_transform, !p_disabled));
p_shape->add_owner(this);
reload_shapes();
}
@@ -284,7 +305,6 @@ void RigidCollisionObjectBullet::set_shape_transform(int p_index, const Transfor
ERR_FAIL_INDEX(p_index, get_shape_count());
shapes.write[p_index].set_transform(p_transform);
- // Note, enableDynamicAabbTree is false because on transform change compound is destroyed
reload_shapes();
}
@@ -299,6 +319,8 @@ Transform RigidCollisionObjectBullet::get_shape_transform(int p_index) const {
}
void RigidCollisionObjectBullet::set_shape_disabled(int p_index, bool p_disabled) {
+ if (shapes[p_index].active != p_disabled)
+ return;
shapes.write[p_index].active = !p_disabled;
shape_changed(p_index);
}
@@ -342,7 +364,8 @@ void RigidCollisionObjectBullet::reload_shapes() {
// Try to optimize by not using compound
if (1 == shape_count) {
shpWrapper = &shapes.write[0];
- if (shpWrapper->transform.getOrigin().isZero() && shpWrapper->transform.getBasis() == shpWrapper->transform.getBasis().getIdentity()) {
+ btTransform transform = shpWrapper->get_adjusted_transform();
+ if (transform.getOrigin().isZero() && transform.getBasis() == transform.getBasis().getIdentity()) {
shpWrapper->claim_bt_shape(body_scale);
mainShape = shpWrapper->bt_shape;
main_shape_changed();
@@ -356,7 +379,7 @@ void RigidCollisionObjectBullet::reload_shapes() {
for (int i(0); i < shape_count; ++i) {
shpWrapper = &shapes.write[i];
shpWrapper->claim_bt_shape(body_scale);
- btTransform scaled_shape_transform(shpWrapper->transform);
+ btTransform scaled_shape_transform(shpWrapper->get_adjusted_transform());
scaled_shape_transform.getOrigin() *= body_scale;
compoundShape->addChildShape(scaled_shape_transform, shpWrapper->bt_shape);
}
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index 2d4e5c4f1a..c9430bec18 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -109,6 +109,7 @@ public:
void set_transform(const Transform &p_transform);
void set_transform(const btTransform &p_transform);
+ btTransform get_adjusted_transform() const;
void claim_bt_shape(const btVector3 &body_scale);
};
@@ -224,7 +225,7 @@ public:
_FORCE_INLINE_ btCollisionShape *get_main_shape() const { return mainShape; }
- void add_shape(ShapeBullet *p_shape, const Transform &p_transform = Transform());
+ void add_shape(ShapeBullet *p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
void set_shape(int p_index, ShapeBullet *p_shape);
int get_shape_count() const;
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp
index 3e06239453..2ba75b9a98 100644
--- a/modules/bullet/godot_ray_world_algorithm.cpp
+++ b/modules/bullet/godot_ray_world_algorithm.cpp
@@ -39,6 +39,9 @@
@author AndreaCatania
*/
+// Epsilon to account for floating point inaccuracies
+#define RAY_PENETRATION_DEPTH_EPSILON 0.01
+
GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) :
m_world(world) {}
@@ -100,8 +103,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo
btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1));
- if (depth >= -ray_shape->getMargin() * 0.5)
- depth = 0;
+ if (depth > -RAY_PENETRATION_DEPTH_EPSILON)
+ depth = 0.0;
if (ray_shape->getSlipsOnSlope())
resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth);
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index e5f70a0b34..733a900396 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -741,22 +741,20 @@ void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) {
if (p_enable) {
// This threshold enable CCD if the object moves more than
// 1 meter in one simulation frame
- btBody->setCcdMotionThreshold(0.1);
+ btBody->setCcdMotionThreshold(1e-7);
/// Calculate using the rule writte below the CCD swept sphere radius
/// CCD works on an embedded sphere of radius, make sure this radius
/// is embedded inside the convex objects, preferably smaller:
/// for an object of dimensions 1 meter, try 0.2
- btScalar radius;
+ btScalar radius(1.0);
if (btBody->getCollisionShape()) {
btVector3 center;
btBody->getCollisionShape()->getBoundingSphere(center, radius);
- } else {
- radius = 0;
}
btBody->setCcdSweptSphereRadius(radius * 0.2);
} else {
- btBody->setCcdMotionThreshold(0.);
+ btBody->setCcdMotionThreshold(10000.0);
btBody->setCcdSweptSphereRadius(0.);
}
}
@@ -834,7 +832,7 @@ void RigidBodyBullet::reload_shapes() {
btBody->updateInertiaTensor();
reload_kinematic_shapes();
-
+ set_continuous_collision_detection(btBody->getCcdMotionThreshold() < 9998.0);
reload_body();
}
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index b590d63167..f15bcec914 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -148,7 +148,13 @@ btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(PoolVector<rea
const bool flipQuadEdges = false;
const void *heightsPtr = p_heights.read().ptr();
- return bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges));
+ btHeightfieldTerrainShape *heightfield = bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges));
+
+ // The shape can be created without params when you do PhysicsServer.shape_create(PhysicsServer.SHAPE_HEIGHTMAP)
+ if (heightsPtr)
+ heightfield->buildAccelerator(16);
+
+ return heightfield;
}
btRayShape *ShapeBullet::create_shape_ray(real_t p_length, bool p_slips_on_slope) {
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 8fb8eba057..738b415d16 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -1043,23 +1043,16 @@ int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p
btVector3 recover_motion(0, 0, 0);
int rays_found = 0;
+ int rays_found_this_round = 0;
for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) {
- int last_ray_index = recover_from_penetration_ray(p_body, body_transform, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, p_result_max, recover_motion, r_results);
+ PhysicsServer::SeparationResult *next_results = &r_results[rays_found];
+ rays_found_this_round = recover_from_penetration_ray(p_body, body_transform, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, p_result_max - rays_found, recover_motion, next_results);
- rays_found = MAX(last_ray_index, rays_found);
- if (!rays_found) {
- break;
- } else {
+ rays_found += rays_found_this_round;
+ if (rays_found_this_round == 0) {
body_transform.getOrigin() += recover_motion;
- }
- }
-
- //optimize results (remove non colliding)
- for (int i = 0; i < rays_found; i++) {
- if (r_results[i].collision_depth >= 0) {
- rays_found--;
- SWAP(r_results[i], r_results[rays_found]);
+ break;
}
}
@@ -1069,18 +1062,47 @@ int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p
struct RecoverPenetrationBroadPhaseCallback : public btBroadphaseAabbCallback {
private:
+ btDbvtVolume bounds;
+
const btCollisionObject *self_collision_object;
uint32_t collision_layer;
uint32_t collision_mask;
+ struct CompoundLeafCallback : btDbvt::ICollide {
+ private:
+ RecoverPenetrationBroadPhaseCallback *parent_callback;
+ btCollisionObject *collision_object;
+
+ public:
+ CompoundLeafCallback(RecoverPenetrationBroadPhaseCallback *p_parent_callback, btCollisionObject *p_collision_object) :
+ parent_callback(p_parent_callback),
+ collision_object(p_collision_object) {
+ }
+
+ void Process(const btDbvtNode *leaf) {
+ BroadphaseResult result;
+ result.collision_object = collision_object;
+ result.compound_child_index = leaf->dataAsInt;
+ parent_callback->results.push_back(result);
+ }
+ };
+
public:
- Vector<btCollisionObject *> result_collision_objects;
+ struct BroadphaseResult {
+ btCollisionObject *collision_object;
+ int compound_child_index;
+ };
+
+ Vector<BroadphaseResult> results;
public:
- RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask) :
+ RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask, btVector3 p_aabb_min, btVector3 p_aabb_max) :
self_collision_object(p_self_collision_object),
collision_layer(p_collision_layer),
- collision_mask(p_collision_mask) {}
+ collision_mask(p_collision_mask) {
+
+ bounds = btDbvtVolume::FromMM(p_aabb_min, p_aabb_max);
+ }
virtual ~RecoverPenetrationBroadPhaseCallback() {}
@@ -1089,35 +1111,98 @@ public:
btCollisionObject *co = static_cast<btCollisionObject *>(proxy->m_clientObject);
if (co->getInternalType() <= btCollisionObject::CO_RIGID_BODY) {
if (self_collision_object != proxy->m_clientObject && GodotFilterCallback::test_collision_filters(collision_layer, collision_mask, proxy->m_collisionFilterGroup, proxy->m_collisionFilterMask)) {
- result_collision_objects.push_back(co);
+ if (co->getCollisionShape()->isCompound()) {
+ const btCompoundShape *cs = static_cast<btCompoundShape *>(co->getCollisionShape());
+
+ if (cs->getNumChildShapes() > 1) {
+ const btDbvt *tree = cs->getDynamicAabbTree();
+ ERR_FAIL_COND_V(tree == NULL, true);
+
+ // Transform bounds into compound shape local space
+ const btTransform other_in_compound_space = co->getWorldTransform().inverse();
+ const btMatrix3x3 abs_b = other_in_compound_space.getBasis().absolute();
+ const btVector3 local_center = other_in_compound_space(bounds.Center());
+ const btVector3 local_extent = bounds.Extents().dot3(abs_b[0], abs_b[1], abs_b[2]);
+ const btVector3 local_aabb_min = local_center - local_extent;
+ const btVector3 local_aabb_max = local_center + local_extent;
+ const btDbvtVolume local_bounds = btDbvtVolume::FromMM(local_aabb_min, local_aabb_max);
+
+ // Test collision against compound child shapes using its AABB tree
+ CompoundLeafCallback compound_leaf_callback(this, co);
+ tree->collideTV(tree->m_root, local_bounds, compound_leaf_callback);
+ } else {
+ // If there's only a single child shape then there's no need to search any more, we know which child overlaps
+ BroadphaseResult result;
+ result.collision_object = co;
+ result.compound_child_index = 0;
+ results.push_back(result);
+ }
+ } else {
+ BroadphaseResult result;
+ result.collision_object = co;
+ result.compound_child_index = -1;
+ results.push_back(result);
+ }
return true;
}
}
return false;
}
-
- void reset() {
- result_collision_objects.clear();
- }
};
bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result) {
- RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask());
+ // Calculate the cumulative AABB of all shapes of the kinematic body
+ btVector3 aabb_min, aabb_max;
+ bool shapes_found = false;
+
+ for (int kinIndex = p_body->get_kinematic_utilities()->shapes.size() - 1; 0 <= kinIndex; --kinIndex) {
+
+ const RigidBodyBullet::KinematicShape &kin_shape(p_body->get_kinematic_utilities()->shapes[kinIndex]);
+ if (!kin_shape.is_active()) {
+ continue;
+ }
+
+ if (kin_shape.shape->getShapeType() == CUSTOM_CONVEX_SHAPE_TYPE) {
+ // Skip rayshape in order to implement custom separation process
+ continue;
+ }
+
+ btTransform shape_transform = p_body_position * kin_shape.transform;
+ shape_transform.getOrigin() += r_delta_recover_movement;
+
+ btVector3 shape_aabb_min, shape_aabb_max;
+ kin_shape.shape->getAabb(shape_transform, shape_aabb_min, shape_aabb_max);
+
+ if (!shapes_found) {
+ aabb_min = shape_aabb_min;
+ aabb_max = shape_aabb_max;
+ shapes_found = true;
+ } else {
+ aabb_min.setX((aabb_min.x() < shape_aabb_min.x()) ? aabb_min.x() : shape_aabb_min.x());
+ aabb_min.setY((aabb_min.y() < shape_aabb_min.y()) ? aabb_min.y() : shape_aabb_min.y());
+ aabb_min.setZ((aabb_min.z() < shape_aabb_min.z()) ? aabb_min.z() : shape_aabb_min.z());
+
+ aabb_max.setX((aabb_max.x() > shape_aabb_max.x()) ? aabb_max.x() : shape_aabb_max.x());
+ aabb_max.setY((aabb_max.y() > shape_aabb_max.y()) ? aabb_max.y() : shape_aabb_max.y());
+ aabb_max.setZ((aabb_max.z() > shape_aabb_max.z()) ? aabb_max.z() : shape_aabb_max.z());
+ }
+ }
- btTransform body_shape_position;
- btTransform body_shape_position_recovered;
+ // If there are no shapes then there is no penetration either
+ if (!shapes_found) {
+ return false;
+ }
- // Broad phase support
- btVector3 minAabb, maxAabb;
+ // Perform broadphase test
+ RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask(), aabb_min, aabb_max);
+ dynamicsWorld->getBroadphase()->aabbTest(aabb_min, aabb_max, recover_broad_result);
bool penetration = false;
- // For each shape
+ // Perform narrowphase per shape
for (int kinIndex = p_body->get_kinematic_utilities()->shapes.size() - 1; 0 <= kinIndex; --kinIndex) {
- recover_broad_result.reset();
-
const RigidBodyBullet::KinematicShape &kin_shape(p_body->get_kinematic_utilities()->shapes[kinIndex]);
if (!kin_shape.is_active()) {
continue;
@@ -1128,15 +1213,11 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
continue;
}
- body_shape_position = p_body_position * kin_shape.transform;
- body_shape_position_recovered = body_shape_position;
- body_shape_position_recovered.getOrigin() += r_delta_recover_movement;
+ btTransform shape_transform = p_body_position * kin_shape.transform;
+ shape_transform.getOrigin() += r_delta_recover_movement;
- kin_shape.shape->getAabb(body_shape_position_recovered, minAabb, maxAabb);
- dynamicsWorld->getBroadphase()->aabbTest(minAabb, maxAabb, recover_broad_result);
-
- for (int i = recover_broad_result.result_collision_objects.size() - 1; 0 <= i; --i) {
- btCollisionObject *otherObject = recover_broad_result.result_collision_objects[i];
+ for (int i = recover_broad_result.results.size() - 1; 0 <= i; --i) {
+ btCollisionObject *otherObject = recover_broad_result.results[i].collision_object;
if (p_infinite_inertia && !otherObject->isStaticOrKinematicObject()) {
otherObject->activate(); // Force activation of hitten rigid, soft body
continue;
@@ -1144,30 +1225,28 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
continue;
if (otherObject->getCollisionShape()->isCompound()) {
+ const btCompoundShape *cs = static_cast<const btCompoundShape *>(otherObject->getCollisionShape());
+ int shape_idx = recover_broad_result.results[i].compound_child_index;
+ ERR_FAIL_COND_V(shape_idx < 0 || shape_idx >= cs->getNumChildShapes(), false);
- // Each convex shape
- btCompoundShape *cs = static_cast<btCompoundShape *>(otherObject->getCollisionShape());
- for (int x = cs->getNumChildShapes() - 1; 0 <= x; --x) {
-
- if (cs->getChildShape(x)->isConvex()) {
- if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), otherObject, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
+ if (cs->getChildShape(shape_idx)->isConvex()) {
+ if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(shape_idx)), otherObject, shape_idx, shape_transform, otherObject->getWorldTransform() * cs->getChildTransform(shape_idx), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
- penetration = true;
- }
- } else {
- if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
+ penetration = true;
+ }
+ } else {
+ if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(shape_idx), p_body->get_bt_collision_object(), otherObject, kinIndex, shape_idx, shape_transform, otherObject->getWorldTransform() * cs->getChildTransform(shape_idx), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
- penetration = true;
- }
+ penetration = true;
}
}
} else if (otherObject->getCollisionShape()->isConvex()) { /// Execute GJK test against object shape
- if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, body_shape_position, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
+ if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, shape_transform, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
penetration = true;
}
} else {
- if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
+ if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, shape_transform, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) {
penetration = true;
}
@@ -1183,7 +1262,6 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt
// Initialize GJK input
btGjkPairDetector::ClosestPointInput gjk_input;
gjk_input.m_transformA = p_transformA;
- gjk_input.m_transformA.getOrigin() += r_delta_recover_movement;
gjk_input.m_transformB = p_transformB;
// Perform GJK test
@@ -1214,7 +1292,6 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC
/// Contact test
btTransform tA(p_transformA);
- tA.getOrigin() += r_delta_recover_movement;
btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, tA, -1, p_shapeId_A);
btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
@@ -1246,39 +1323,81 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC
return false;
}
-void SpaceBullet::convert_to_separation_result(PhysicsServer::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const {
+int SpaceBullet::add_separation_result(PhysicsServer::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const {
+
+ // optimize results (ignore non-colliding)
+ if (p_recover_result.penetration_distance < 0.0) {
+ const btRigidBody *btRigid = static_cast<const btRigidBody *>(p_other_object);
+ CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(p_other_object->getUserPointer());
- const btRigidBody *btRigid = static_cast<const btRigidBody *>(p_other_object);
- CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(p_other_object->getUserPointer());
+ r_result->collision_depth = p_recover_result.penetration_distance;
+ B_TO_G(p_recover_result.pointWorld, r_result->collision_point);
+ B_TO_G(p_recover_result.normal, r_result->collision_normal);
+ B_TO_G(btRigid->getVelocityInLocalPoint(p_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity);
+ r_result->collision_local_shape = p_shape_id;
+ r_result->collider_id = collisionObject->get_instance_id();
+ r_result->collider = collisionObject->get_self();
+ r_result->collider_shape = p_recover_result.other_compound_shape_index;
- r_result->collision_depth = p_recover_result.penetration_distance;
- B_TO_G(p_recover_result.pointWorld, r_result->collision_point);
- B_TO_G(p_recover_result.normal, r_result->collision_normal);
- B_TO_G(btRigid->getVelocityInLocalPoint(p_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity);
- r_result->collision_local_shape = p_shape_id;
- r_result->collider_id = collisionObject->get_instance_id();
- r_result->collider = collisionObject->get_self();
- r_result->collider_shape = p_recover_result.other_compound_shape_index;
+ return 1;
+ } else {
+ return 0;
+ }
}
int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer::SeparationResult *r_results) {
- RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask());
+ // Calculate the cumulative AABB of all shapes of the kinematic body
+ btVector3 aabb_min, aabb_max;
+ bool shapes_found = false;
+
+ for (int kinIndex = p_body->get_kinematic_utilities()->shapes.size() - 1; 0 <= kinIndex; --kinIndex) {
+
+ const RigidBodyBullet::KinematicShape &kin_shape(p_body->get_kinematic_utilities()->shapes[kinIndex]);
+ if (!kin_shape.is_active()) {
+ continue;
+ }
+
+ if (kin_shape.shape->getShapeType() != CUSTOM_CONVEX_SHAPE_TYPE) {
+ continue;
+ }
+
+ btTransform shape_transform = p_body_position * kin_shape.transform;
+ shape_transform.getOrigin() += r_delta_recover_movement;
- btTransform body_shape_position;
- btTransform body_shape_position_recovered;
+ btVector3 shape_aabb_min, shape_aabb_max;
+ kin_shape.shape->getAabb(shape_transform, shape_aabb_min, shape_aabb_max);
- // Broad phase support
- btVector3 minAabb, maxAabb;
+ if (!shapes_found) {
+ aabb_min = shape_aabb_min;
+ aabb_max = shape_aabb_max;
+ shapes_found = true;
+ } else {
+ aabb_min.setX((aabb_min.x() < shape_aabb_min.x()) ? aabb_min.x() : shape_aabb_min.x());
+ aabb_min.setY((aabb_min.y() < shape_aabb_min.y()) ? aabb_min.y() : shape_aabb_min.y());
+ aabb_min.setZ((aabb_min.z() < shape_aabb_min.z()) ? aabb_min.z() : shape_aabb_min.z());
- int ray_index = 0;
+ aabb_max.setX((aabb_max.x() > shape_aabb_max.x()) ? aabb_max.x() : shape_aabb_max.x());
+ aabb_max.setY((aabb_max.y() > shape_aabb_max.y()) ? aabb_max.y() : shape_aabb_max.y());
+ aabb_max.setZ((aabb_max.z() > shape_aabb_max.z()) ? aabb_max.z() : shape_aabb_max.z());
+ }
+ }
- // For each shape
- for (int kinIndex = p_body->get_kinematic_utilities()->shapes.size() - 1; 0 <= kinIndex; --kinIndex) {
+ // If there are no shapes then there is no penetration either
+ if (!shapes_found) {
+ return 0;
+ }
+
+ // Perform broadphase test
+ RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask(), aabb_min, aabb_max);
+ dynamicsWorld->getBroadphase()->aabbTest(aabb_min, aabb_max, recover_broad_result);
- recover_broad_result.reset();
+ int ray_count = 0;
+
+ // Perform narrowphase per shape
+ for (int kinIndex = p_body->get_kinematic_utilities()->shapes.size() - 1; 0 <= kinIndex; --kinIndex) {
- if (ray_index >= p_result_max) {
+ if (ray_count >= p_result_max) {
break;
}
@@ -1291,15 +1410,11 @@ int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btT
continue;
}
- body_shape_position = p_body_position * kin_shape.transform;
- body_shape_position_recovered = body_shape_position;
- body_shape_position_recovered.getOrigin() += r_delta_recover_movement;
+ btTransform shape_transform = p_body_position * kin_shape.transform;
+ shape_transform.getOrigin() += r_delta_recover_movement;
- kin_shape.shape->getAabb(body_shape_position_recovered, minAabb, maxAabb);
- dynamicsWorld->getBroadphase()->aabbTest(minAabb, maxAabb, recover_broad_result);
-
- for (int i = recover_broad_result.result_collision_objects.size() - 1; 0 <= i; --i) {
- btCollisionObject *otherObject = recover_broad_result.result_collision_objects[i];
+ for (int i = recover_broad_result.results.size() - 1; 0 <= i; --i) {
+ btCollisionObject *otherObject = recover_broad_result.results[i].collision_object;
if (p_infinite_inertia && !otherObject->isStaticOrKinematicObject()) {
otherObject->activate(); // Force activation of hitten rigid, soft body
continue;
@@ -1307,29 +1422,25 @@ int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btT
continue;
if (otherObject->getCollisionShape()->isCompound()) {
+ const btCompoundShape *cs = static_cast<const btCompoundShape *>(otherObject->getCollisionShape());
+ int shape_idx = recover_broad_result.results[i].compound_child_index;
+ ERR_FAIL_COND_V(shape_idx < 0 || shape_idx >= cs->getNumChildShapes(), false);
- // Each convex shape
- btCompoundShape *cs = static_cast<btCompoundShape *>(otherObject->getCollisionShape());
- for (int x = cs->getNumChildShapes() - 1; 0 <= x; --x) {
-
- RecoverResult recover_result;
- if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_delta_recover_movement, &recover_result)) {
+ RecoverResult recover_result;
+ if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(shape_idx), p_body->get_bt_collision_object(), otherObject, kinIndex, shape_idx, shape_transform, otherObject->getWorldTransform() * cs->getChildTransform(shape_idx), p_recover_movement_scale, r_delta_recover_movement, &recover_result)) {
- convert_to_separation_result(&r_results[ray_index], recover_result, kinIndex, otherObject);
- }
+ ray_count = add_separation_result(&r_results[ray_count], recover_result, kinIndex, otherObject);
}
} else {
RecoverResult recover_result;
- if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, &recover_result)) {
+ if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, shape_transform, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, &recover_result)) {
- convert_to_separation_result(&r_results[ray_index], recover_result, kinIndex, otherObject);
+ ray_count = add_separation_result(&r_results[ray_count], recover_result, kinIndex, otherObject);
}
}
}
-
- ++ray_index;
}
- return ray_index;
+ return ray_count;
}
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index 7bf6a216b5..6b3d65edf6 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -212,7 +212,7 @@ private:
/// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm
bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
- void convert_to_separation_result(PhysicsServer::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const;
+ int add_separation_result(PhysicsServer::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const;
int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer::SeparationResult *r_results);
};
#endif
diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp
index 7e1cc937cd..3a61afa023 100644
--- a/modules/csg/csg.cpp
+++ b/modules/csg/csg.cpp
@@ -611,7 +611,7 @@ void CSGBrushOperation::_add_poly_points(const BuildPoly &p_poly, int p_edge, in
{
EdgeSort es;
- es.angle = 0; //wont be checked here
+ es.angle = 0; //won't be checked here
es.edge = p_edge;
es.prev_point = p_from_point;
es.edge_point = p_to_point;
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index e70773d914..1d27b9b6f4 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -2082,6 +2082,9 @@ CSGBrush *CSGPolygon::_build_brush() {
for (int i = 0; i <= splits; i++) {
float ofs = i * path_interval;
+ if (ofs > bl) {
+ ofs = bl;
+ }
if (i == splits && path_joined) {
ofs = 0.0;
}
diff --git a/modules/cvtt/SCsub b/modules/cvtt/SCsub
index fcc69d8371..142af0c800 100644
--- a/modules/cvtt/SCsub
+++ b/modules/cvtt/SCsub
@@ -14,7 +14,7 @@ if env['builtin_squish']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_cvtt.Append(CPPPATH=[thirdparty_dir])
+ env_cvtt.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_cvtt.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index a57a4b29ea..78d8d43414 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -21,7 +21,7 @@ if env['builtin_enet']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_enet.Append(CPPPATH=[thirdparty_dir])
+ env_enet.Prepend(CPPPATH=[thirdparty_dir])
env_enet.Append(CPPFLAGS=["-DGODOT_ENET"])
env_thirdparty = env_enet.Clone()
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
index 894c17c684..d3d1e58b7b 100644
--- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -110,7 +110,7 @@
Always use [code]TRANSFER_MODE_ORDERED[/code] in place of [code]TRANSFER_MODE_UNRELIABLE[/code]. This is the only way to use ordering with the RPC system.
</member>
<member name="channel_count" type="int" setter="set_channel_count" getter="get_channel_count">
- The number of channels to be used by ENet. Default: [code]3[/code]. Channels are used to separate different kinds of data. In realiable or ordered mode, for example, the packet delivery order is ensured on a per channel basis.
+ The number of channels to be used by ENet. Default: [code]3[/code]. Channels are used to separate different kinds of data. In reliable or ordered mode, for example, the packet delivery order is ensured on a per channel basis.
</member>
<member name="compression_mode" type="int" setter="set_compression_mode" getter="get_compression_mode" enum="NetworkedMultiplayerENet.CompressionMode">
The compression method used for network packets. Default is no compression. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all.
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index 492b365128..18dfe08e85 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -231,7 +231,7 @@ void NetworkedMultiplayerENet::poll() {
break;
}
- // A client joined with an invalid ID (neagtive values, 0, and 1 are reserved).
+ // A client joined with an invalid ID (negative values, 0, and 1 are reserved).
// Probably trying to exploit us.
if (server && ((int)event.data < 2 || peer_map.has((int)event.data))) {
enet_peer_reset(event.peer);
diff --git a/modules/etc/SCsub b/modules/etc/SCsub
index eb2738053b..532b97b006 100644
--- a/modules/etc/SCsub
+++ b/modules/etc/SCsub
@@ -27,7 +27,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_etc.Append(CPPPATH=[thirdparty_dir])
+env_etc.Prepend(CPPPATH=[thirdparty_dir])
# upstream uses c++11
if not env.msvc:
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index f2cd9f9a60..0ea581220e 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -61,16 +61,9 @@ if env['builtin_freetype']:
# Globally too, as freetype is used in scene (see bottom)
env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
- sfnt = thirdparty_dir + 'src/sfnt/sfnt.c'
- if env['platform'] == 'javascript':
- # Forcibly undefine this macro so SIMD is not used in this file,
- # since currently unsupported in WASM
- sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
- thirdparty_sources += [sfnt]
-
- env_freetype.Append(CPPPATH=[thirdparty_dir + "/include"])
+ env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
# Also needed in main env for scene/
- env.Append(CPPPATH=[thirdparty_dir + "/include"])
+ env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
env_freetype.Append(CPPFLAGS=['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG'])
if (env['target'] != 'release'):
@@ -78,7 +71,17 @@ if env['builtin_freetype']:
# Also requires libpng headers
if env['builtin_libpng']:
- env_freetype.Append(CPPPATH=["#thirdparty/libpng"])
+ env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"])
+
+ sfnt = thirdparty_dir + 'src/sfnt/sfnt.c'
+ # Must be done after all CPPFLAGS are being set so we can copy them.
+ if env['platform'] == 'javascript':
+ # Forcibly undefine this macro so SIMD is not used in this file,
+ # since currently unsupported in WASM
+ tmp_env = env_freetype.Clone()
+ tmp_env.Append(CPPFLAGS=['-U__OPTIMIZE__'])
+ sfnt = tmp_env.Object(sfnt)
+ thirdparty_sources += [sfnt]
env_thirdparty = env_freetype.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index 235f0b97bb..0cdd585558 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -12,7 +12,7 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp")
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
-env_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
Export('env_gdnative')
@@ -36,7 +36,7 @@ if ARGUMENTS.get('gdnative_wrapper', False):
gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code))
gd_wrapper_env = env.Clone()
- gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
+ gd_wrapper_env.Prepend(CPPPATH=['#modules/gdnative/include/'])
if gd_wrapper_env['use_lto']:
if not env.msvc:
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
index 8c602e0cba..c3f8688adb 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
@@ -222,6 +222,15 @@ void ARVRInterfaceGDNative::process() {
interface->process(data);
}
+void ARVRInterfaceGDNative::notification(int p_what) {
+ ERR_FAIL_COND(interface == NULL);
+
+ // this is only available in interfaces that implement 1.1 or later
+ if ((interface->version.major > 1) || ((interface->version.major == 1) && (interface->version.minor > 0))) {
+ interface->notification(data, p_what);
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////
// some helper callbacks
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.h b/modules/gdnative/arvr/arvr_interface_gdnative.h
index 3f966ece51..86396b067a 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.h
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.h
@@ -82,6 +82,7 @@ public:
virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect);
virtual void process();
+ virtual void notification(int p_what);
};
#endif // ARVR_INTERFACE_GDNATIVE_H
diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py
index fde7f1a6e0..7898de5523 100644
--- a/modules/gdnative/config.py
+++ b/modules/gdnative/config.py
@@ -16,7 +16,8 @@ def get_doc_classes():
"ResourceFormatLoaderVideoStreamGDNative",
"StreamPeerGDNative",
"VideoStreamGDNative",
- "WebRTCPeerGDNative",
+ "WebRTCPeerConnectionGDNative",
+ "WebRTCDataChannelGDNative",
]
def get_doc_path():
diff --git a/modules/gdnative/doc_classes/WebRTCDataChannelGDNative.xml b/modules/gdnative/doc_classes/WebRTCDataChannelGDNative.xml
new file mode 100644
index 0000000000..ac18ec6020
--- /dev/null
+++ b/modules/gdnative/doc_classes/WebRTCDataChannelGDNative.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="WebRTCDataChannelGDNative" inherits="WebRTCDataChannel" category="Core" version="3.2">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/gdnative/doc_classes/WebRTCPeerConnectionGDNative.xml b/modules/gdnative/doc_classes/WebRTCPeerConnectionGDNative.xml
new file mode 100644
index 0000000000..44cb8e5db8
--- /dev/null
+++ b/modules/gdnative/doc_classes/WebRTCPeerConnectionGDNative.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="WebRTCPeerConnectionGDNative" inherits="WebRTCPeerConnection" category="Core" version="3.2">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index e8278825bc..a27935bfe2 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -243,7 +243,7 @@ void GDNativeLibrary::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix);
ClassDB::bind_method(D_METHOD("set_reloadable", "reloadable"), &GDNativeLibrary::set_reloadable);
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "config_file", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"), "set_config_file", "get_config_file");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "config_file", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile", 0), "set_config_file", "get_config_file");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton");
@@ -404,7 +404,7 @@ bool GDNative::terminate() {
} else if (gdnatives->size() == 1) {
// we're the last one, terminate!
gdnatives->clear();
- // wew this looks scary, but all it does is remove the entry completely
+ // whew this looks scary, but all it does is remove the entry completely
GDNativeLibrary::loaded_libraries->erase(GDNativeLibrary::loaded_libraries->find(library->get_current_library_path()));
}
}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 492dc5beaa..ef57387059 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -99,16 +99,20 @@ public:
}
_FORCE_INLINE_ void set_load_once(bool p_load_once) {
+ config_file->set_value("general", "load_once", p_load_once);
load_once = p_load_once;
}
_FORCE_INLINE_ void set_singleton(bool p_singleton) {
+ config_file->set_value("general", "singleton", p_singleton);
singleton = p_singleton;
}
_FORCE_INLINE_ void set_symbol_prefix(String p_symbol_prefix) {
+ config_file->set_value("general", "symbol_prefix", p_symbol_prefix);
symbol_prefix = p_symbol_prefix;
}
_FORCE_INLINE_ void set_reloadable(bool p_reloadable) {
+ config_file->set_value("general", "reloadable", p_reloadable);
reloadable = p_reloadable;
}
diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp
index 2c6c9e2de2..fff3fc3625 100644
--- a/modules/gdnative/gdnative/dictionary.cpp
+++ b/modules/gdnative/gdnative/dictionary.cpp
@@ -55,6 +55,15 @@ void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) {
self->~Dictionary();
}
+godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep) {
+ const Dictionary *self = (const Dictionary *)p_self;
+ godot_dictionary res;
+ Dictionary *val = (Dictionary *)&res;
+ memnew_placement(val, Dictionary);
+ *val = self->duplicate(p_deep);
+ return res;
+}
+
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self) {
const Dictionary *self = (const Dictionary *)p_self;
return self->size();
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 8f0d5a2db4..ac4d5a86b2 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -518,7 +518,7 @@ void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_varia
const Variant *a = (const Variant *)p_a;
const Variant *b = (const Variant *)p_b;
Variant *ret = (Variant *)r_ret;
- Variant::evaluate(op, a, b, *ret, *r_valid);
+ Variant::evaluate(op, *a, *b, *ret, *r_valid);
}
#ifdef __cplusplus
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 9882a89794..8afe988102 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -11,7 +11,24 @@
"major": 1,
"minor": 1
},
- "next": null,
+ "next": {
+ "type": "CORE",
+ "version": {
+ "major": 1,
+ "minor": 2
+ },
+ "next": null,
+ "api": [
+ {
+ "name": "godot_dictionary_duplicate",
+ "return_type": "godot_dictionary",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"],
+ ["const godot_bool", "p_deep"]
+ ]
+ }
+ ]
+ },
"api": [
{
"name": "godot_color_to_abgr32",
@@ -6436,11 +6453,26 @@
"next": null,
"api": [
{
- "name": "godot_net_bind_webrtc_peer",
+ "name": "godot_net_set_webrtc_library",
+ "return_type": "godot_error",
+ "arguments": [
+ ["const godot_net_webrtc_library *", "p_library"]
+ ]
+ },
+ {
+ "name": "godot_net_bind_webrtc_peer_connection",
+ "return_type": "void",
+ "arguments": [
+ ["godot_object *", "p_obj"],
+ ["const godot_net_webrtc_peer_connection *", "p_interface"]
+ ]
+ },
+ {
+ "name": "godot_net_bind_webrtc_data_channel",
"return_type": "void",
"arguments": [
["godot_object *", "p_obj"],
- ["const godot_net_webrtc_peer *", "p_interface"]
+ ["const godot_net_webrtc_data_channel *", "p_interface"]
]
}
]
diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp
index 55bc16fccc..389b353a51 100644
--- a/modules/gdnative/gdnative_library_singleton_editor.cpp
+++ b/modules/gdnative/gdnative_library_singleton_editor.cpp
@@ -32,11 +32,16 @@
#include "gdnative_library_singleton_editor.h"
#include "gdnative.h"
-void GDNativeLibrarySingletonEditor::_find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list) {
+#include "editor/editor_node.h"
+
+Set<String> GDNativeLibrarySingletonEditor::_find_singletons_recursive(EditorFileSystemDirectory *p_dir) {
+
+ Set<String> file_paths;
// check children
for (int i = 0; i < p_dir->get_file_count(); i++) {
+ String file_name = p_dir->get_file(i);
String file_type = p_dir->get_file_type(i);
if (file_type != "GDNativeLibrary") {
@@ -45,23 +50,57 @@ void GDNativeLibrarySingletonEditor::_find_gdnative_singletons(EditorFileSystemD
Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i));
if (lib.is_valid() && lib->is_singleton()) {
- String path = p_dir->get_file_path(i);
- TreeItem *ti = libraries->create_item(libraries->get_root());
- ti->set_text(0, path.get_file());
- ti->set_tooltip(0, path);
- ti->set_metadata(0, path);
- ti->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
- ti->set_text(1, "Disabled,Enabled");
- bool enabled = enabled_list.has(path) ? true : false;
-
- ti->set_range(1, enabled ? 1 : 0);
- ti->set_custom_color(1, enabled ? Color(0, 1, 0) : Color(1, 0, 0));
+ file_paths.insert(p_dir->get_file_path(i));
}
}
// check subdirectories
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
- _find_gdnative_singletons(p_dir->get_subdir(i), enabled_list);
+ Set<String> paths = _find_singletons_recursive(p_dir->get_subdir(i));
+
+ for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
+ file_paths.insert(E->get());
+ }
+ }
+
+ return file_paths;
+}
+
+void GDNativeLibrarySingletonEditor::_discover_singletons() {
+
+ EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
+
+ Set<String> file_paths = _find_singletons_recursive(dir);
+
+ bool changed = false;
+ Array current_files;
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
+ current_files = ProjectSettings::get_singleton()->get("gdnative/singletons");
+ }
+ Array files;
+ for (Set<String>::Element *E = file_paths.front(); E; E = E->next()) {
+ if (!current_files.has(E->get())) {
+ changed = true;
+ }
+ files.append(E->get());
+ }
+
+ // Check for removed files
+ if (!changed) {
+ // Removed singleton
+ for (int j = 0; j < current_files.size(); j++) {
+ if (!files.has(current_files[j])) {
+ changed = true;
+ break;
+ }
+ }
+ }
+
+ if (changed) {
+
+ ProjectSettings::get_singleton()->set("gdnative/singletons", files);
+ _update_libraries(); // So singleton options (i.e. disabled) updates too
+ ProjectSettings::get_singleton()->save();
}
}
@@ -69,22 +108,40 @@ void GDNativeLibrarySingletonEditor::_update_libraries() {
updating = true;
libraries->clear();
- libraries->create_item(); //rppt
+ libraries->create_item(); // root item
- Vector<String> enabled_paths;
+ Array singletons;
if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
- enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons");
+ singletons = ProjectSettings::get_singleton()->get("gdnative/singletons");
}
- Set<String> enabled_list;
- for (int i = 0; i < enabled_paths.size(); i++) {
- enabled_list.insert(enabled_paths[i]);
+ Array singletons_disabled;
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) {
+ singletons_disabled = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled");
}
- EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem();
- if (fs) {
- _find_gdnative_singletons(fs, enabled_list);
+ Array updated_disabled;
+ for (int i = 0; i < singletons.size(); i++) {
+ bool enabled = true;
+ String path = singletons[i];
+ if (singletons_disabled.has(path)) {
+ enabled = false;
+ updated_disabled.push_back(path);
+ }
+ TreeItem *ti = libraries->create_item(libraries->get_root());
+ ti->set_text(0, path.get_file());
+ ti->set_tooltip(0, path);
+ ti->set_metadata(0, path);
+ ti->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
+ ti->set_text(1, "Disabled,Enabled");
+ ti->set_range(1, enabled ? 1 : 0);
+ ti->set_custom_color(1, enabled ? Color(0, 1, 0) : Color(1, 0, 0));
+ ti->set_editable(1, true);
}
+ // The singletons list changed, we must update the settings
+ if (updated_disabled.size() != singletons_disabled.size())
+ ProjectSettings::get_singleton()->set("gdnative/singletons_disabled", updated_disabled);
+
updating = false;
}
@@ -99,24 +156,29 @@ void GDNativeLibrarySingletonEditor::_item_edited() {
bool enabled = item->get_range(1);
String path = item->get_metadata(0);
- Vector<String> enabled_paths;
- if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
- enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons");
+ Array disabled_paths;
+ Array undo_paths;
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) {
+ disabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled");
+ // Duplicate so redo works (not a reference)
+ disabled_paths = disabled_paths.duplicate();
+ // For undo, so we can reset the property.
+ undo_paths = disabled_paths.duplicate();
}
if (enabled) {
- if (enabled_paths.find(path) == -1) {
- enabled_paths.push_back(path);
- }
+ disabled_paths.erase(path);
} else {
- enabled_paths.erase(path);
+ if (disabled_paths.find(path) == -1)
+ disabled_paths.push_back(path);
}
- if (enabled_paths.size()) {
- ProjectSettings::get_singleton()->set("gdnative/singletons", enabled_paths);
- } else {
- ProjectSettings::get_singleton()->set("gdnative/singletons", Variant());
- }
+ undo_redo->create_action(enabled ? TTR("Enabled GDNative Singleton") : TTR("Disabled GDNative Singleton"));
+ undo_redo->add_do_property(ProjectSettings::get_singleton(), "gdnative/singletons_disabled", disabled_paths);
+ undo_redo->add_do_method(this, "_update_libraries");
+ undo_redo->add_undo_property(ProjectSettings::get_singleton(), "gdnative/singletons_disabled", undo_paths);
+ undo_redo->add_undo_method(this, "_update_libraries");
+ undo_redo->commit_action();
}
void GDNativeLibrarySingletonEditor::_notification(int p_what) {
@@ -131,9 +193,12 @@ void GDNativeLibrarySingletonEditor::_notification(int p_what) {
void GDNativeLibrarySingletonEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_item_edited"), &GDNativeLibrarySingletonEditor::_item_edited);
+ ClassDB::bind_method(D_METHOD("_discover_singletons"), &GDNativeLibrarySingletonEditor::_discover_singletons);
+ ClassDB::bind_method(D_METHOD("_update_libraries"), &GDNativeLibrarySingletonEditor::_update_libraries);
}
GDNativeLibrarySingletonEditor::GDNativeLibrarySingletonEditor() {
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
libraries = memnew(Tree);
libraries->set_columns(2);
libraries->set_column_titles_visible(true);
@@ -143,6 +208,7 @@ GDNativeLibrarySingletonEditor::GDNativeLibrarySingletonEditor() {
add_margin_child(TTR("Libraries: "), libraries, true);
updating = false;
libraries->connect("item_edited", this, "_item_edited");
+ EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_discover_singletons");
}
#endif // TOOLS_ENABLED
diff --git a/modules/gdnative/gdnative_library_singleton_editor.h b/modules/gdnative/gdnative_library_singleton_editor.h
index cf5ab23501..b43080dfdb 100644
--- a/modules/gdnative/gdnative_library_singleton_editor.h
+++ b/modules/gdnative/gdnative_library_singleton_editor.h
@@ -36,18 +36,24 @@
#include "editor/project_settings_editor.h"
class GDNativeLibrarySingletonEditor : public VBoxContainer {
+ GDCLASS(GDNativeLibrarySingletonEditor, VBoxContainer);
+
+private:
Tree *libraries;
+ UndoRedo *undo_redo;
bool updating;
- void _update_libraries();
- void _find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list);
- void _item_edited();
+ static Set<String> _find_singletons_recursive(EditorFileSystemDirectory *p_dir);
protected:
void _notification(int p_what);
static void _bind_methods();
+ void _discover_singletons();
+ void _item_edited();
+ void _update_libraries();
+
public:
GDNativeLibrarySingletonEditor();
};
diff --git a/modules/gdnative/include/arvr/godot_arvr.h b/modules/gdnative/include/arvr/godot_arvr.h
index 321b471d0e..657090fa70 100644
--- a/modules/gdnative/include/arvr/godot_arvr.h
+++ b/modules/gdnative/include/arvr/godot_arvr.h
@@ -63,6 +63,7 @@ typedef struct {
void (*process)(void *);
// only in 1.1 onwards
godot_int (*get_external_texture_for_eye)(void *, godot_int);
+ void (*notification)(void *, godot_int);
} godot_arvr_interface_gdnative;
void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface);
diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h
index 14e35b4692..483cd9c4e3 100644
--- a/modules/gdnative/include/gdnative/dictionary.h
+++ b/modules/gdnative/include/gdnative/dictionary.h
@@ -63,6 +63,8 @@ void GDAPI godot_dictionary_new(godot_dictionary *r_dest);
void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_self);
+godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep);
+
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self);
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self);
diff --git a/modules/gdnative/include/net/godot_net.h b/modules/gdnative/include/net/godot_net.h
index c1bc9daab5..3a411755c1 100644
--- a/modules/gdnative/include/net/godot_net.h
+++ b/modules/gdnative/include/net/godot_net.h
@@ -111,37 +111,11 @@ typedef struct {
/* Binds a MultiplayerPeerGDNative to the provided interface */
void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_multiplayer_peer *);
-typedef struct {
- godot_gdnative_api_version version; /* version of our API */
-
- godot_object *data; /* User reference */
-
- /* This is PacketPeer */
- godot_error (*get_packet)(void *, const uint8_t **, int *);
- godot_error (*put_packet)(void *, const uint8_t *, int);
- godot_int (*get_available_packet_count)(const void *);
- godot_int (*get_max_packet_size)(const void *);
-
- /* This is WebRTCPeer */
- void (*set_write_mode)(void *, godot_int);
- godot_int (*get_write_mode)(const void *);
- bool (*was_string_packet)(const void *);
- godot_int (*get_connection_state)(const void *);
-
- godot_error (*create_offer)(void *);
- godot_error (*set_remote_description)(void *, const char *, const char *);
- godot_error (*set_local_description)(void *, const char *, const char *);
- godot_error (*add_ice_candidate)(void *, const char *, int, const char *);
- godot_error (*poll)(void *);
-
- void *next; /* For extension? */
-} godot_net_webrtc_peer;
-
-/* Binds a PacketPeerGDNative to the provided interface */
-void GDAPI godot_net_bind_webrtc_peer(godot_object *p_obj, const godot_net_webrtc_peer *);
-
#ifdef __cplusplus
}
#endif
+// WebRTC Bindings
+#include "net/godot_webrtc.h"
+
#endif /* GODOT_NATIVENET_H */
diff --git a/modules/gdnative/include/net/godot_webrtc.h b/modules/gdnative/include/net/godot_webrtc.h
new file mode 100644
index 0000000000..783f7b727d
--- /dev/null
+++ b/modules/gdnative/include/net/godot_webrtc.h
@@ -0,0 +1,122 @@
+/*************************************************************************/
+/* godot_webrtc.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GODOT_NATIVEWEBRTC_H
+#define GODOT_NATIVEWEBRTC_H
+
+#include <gdnative/gdnative.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GODOT_NET_WEBRTC_API_MAJOR 3
+#define GODOT_NET_WEBRTC_API_MINOR 2
+
+/* Library Interface (used to set default GDNative WebRTC implementation */
+typedef struct {
+ godot_gdnative_api_version version; /* version of our API */
+
+ /* Called when the library is unset as default interface via godot_net_set_webrtc_library */
+ void (*unregistered)();
+
+ /* Used by WebRTCPeerConnection create when GDNative is the default implementation. */
+ /* Takes a pointer to WebRTCPeerConnectionGDNative, should bind and return OK, failure if binding was unsuccessful. */
+ godot_error (*create_peer_connection)(godot_object *);
+
+ void *next; /* For extension */
+} godot_net_webrtc_library;
+
+/* WebRTCPeerConnection interface */
+typedef struct {
+ godot_gdnative_api_version version; /* version of our API */
+
+ godot_object *data; /* User reference */
+
+ /* This is WebRTCPeerConnection */
+ godot_int (*get_connection_state)(const void *);
+
+ godot_error (*initialize)(void *, const godot_dictionary *);
+ godot_object *(*create_data_channel)(void *, const char *p_channel_name, const godot_dictionary *);
+ godot_error (*create_offer)(void *);
+ godot_error (*create_answer)(void *); /* unused for now, should be done automatically on set_local_description */
+ godot_error (*set_remote_description)(void *, const char *, const char *);
+ godot_error (*set_local_description)(void *, const char *, const char *);
+ godot_error (*add_ice_candidate)(void *, const char *, int, const char *);
+ godot_error (*poll)(void *);
+ void (*close)(void *);
+
+ void *next; /* For extension? */
+} godot_net_webrtc_peer_connection;
+
+/* WebRTCDataChannel interface */
+typedef struct {
+ godot_gdnative_api_version version; /* version of our API */
+
+ godot_object *data; /* User reference */
+
+ /* This is PacketPeer */
+ godot_error (*get_packet)(void *, const uint8_t **, int *);
+ godot_error (*put_packet)(void *, const uint8_t *, int);
+ godot_int (*get_available_packet_count)(const void *);
+ godot_int (*get_max_packet_size)(const void *);
+
+ /* This is WebRTCDataChannel */
+ void (*set_write_mode)(void *, godot_int);
+ godot_int (*get_write_mode)(const void *);
+ bool (*was_string_packet)(const void *);
+
+ godot_int (*get_ready_state)(const void *);
+ const char *(*get_label)(const void *);
+ bool (*is_ordered)(const void *);
+ int (*get_id)(const void *);
+ int (*get_max_packet_life_time)(const void *);
+ int (*get_max_retransmits)(const void *);
+ const char *(*get_protocol)(const void *);
+ bool (*is_negotiated)(const void *);
+
+ godot_error (*poll)(void *);
+ void (*close)(void *);
+
+ void *next; /* For extension? */
+} godot_net_webrtc_data_channel;
+
+/* Set the default GDNative library */
+godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *);
+/* Binds a WebRTCPeerConnectionGDNative to the provided interface */
+void GDAPI godot_net_bind_webrtc_peer_connection(godot_object *p_obj, const godot_net_webrtc_peer_connection *);
+/* Binds a WebRTCDataChannelGDNative to the provided interface */
+void GDAPI godot_net_bind_webrtc_data_channel(godot_object *p_obj, const godot_net_webrtc_data_channel *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 4577c7327a..e0cf990f83 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -139,6 +139,34 @@ static String get_type_name(const PropertyInfo &info) {
}
/*
+ * Some comparison helper functions we need
+ */
+
+struct MethodInfoComparator {
+ StringName::AlphCompare compare;
+ bool operator()(const MethodInfo &p_a, const MethodInfo &p_b) const {
+
+ return compare(p_a.name, p_b.name);
+ }
+};
+
+struct PropertyInfoComparator {
+ StringName::AlphCompare compare;
+ bool operator()(const PropertyInfo &p_a, const PropertyInfo &p_b) const {
+
+ return compare(p_a.name, p_b.name);
+ }
+};
+
+struct ConstantAPIComparator {
+ NoCaseComparator compare;
+ bool operator()(const ConstantAPI &p_a, const ConstantAPI &p_b) const {
+
+ return compare(p_a.constant_name, p_b.constant_name);
+ }
+};
+
+/*
* Reads the entire Godot API to a list
*/
List<ClassAPI> generate_c_api_classes() {
@@ -147,6 +175,7 @@ List<ClassAPI> generate_c_api_classes() {
List<StringName> classes;
ClassDB::get_class_list(&classes);
+ classes.sort_custom<StringName::AlphCompare>();
// Register global constants as a fake GlobalConstants singleton class
{
@@ -162,6 +191,7 @@ List<ClassAPI> generate_c_api_classes() {
constant_api.constant_value = GlobalConstants::get_global_constant_value(i);
global_constants_api.constants.push_back(constant_api);
}
+ global_constants_api.constants.sort_custom<ConstantAPIComparator>();
api.push_back(global_constants_api);
}
@@ -193,6 +223,7 @@ List<ClassAPI> generate_c_api_classes() {
{
List<String> constant;
ClassDB::get_integer_constant_list(class_name, &constant, true);
+ constant.sort_custom<NoCaseComparator>();
for (List<String>::Element *c = constant.front(); c != NULL; c = c->next()) {
ConstantAPI constant_api;
constant_api.constant_name = c->get();
@@ -206,6 +237,7 @@ List<ClassAPI> generate_c_api_classes() {
{
List<MethodInfo> signals_;
ClassDB::get_signal_list(class_name, &signals_, true);
+ signals_.sort_custom<MethodInfoComparator>();
for (int i = 0; i < signals_.size(); i++) {
SignalAPI signal;
@@ -245,6 +277,7 @@ List<ClassAPI> generate_c_api_classes() {
{
List<PropertyInfo> properties;
ClassDB::get_property_list(class_name, &properties, true);
+ properties.sort_custom<PropertyInfoComparator>();
for (List<PropertyInfo>::Element *p = properties.front(); p != NULL; p = p->next()) {
PropertyAPI property_api;
@@ -272,6 +305,7 @@ List<ClassAPI> generate_c_api_classes() {
{
List<MethodInfo> methods;
ClassDB::get_method_list(class_name, &methods, true);
+ methods.sort_custom<MethodInfoComparator>();
for (List<MethodInfo>::Element *m = methods.front(); m != NULL; m = m->next()) {
MethodAPI method_api;
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 5cf144d4fe..f30c9da4c1 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -32,6 +32,7 @@
#include "gdnative/gdnative.h"
+#include "core/core_string_names.h"
#include "core/global_constants.h"
#include "core/io/file_access_encrypted.h"
#include "core/os/file_access.h"
@@ -771,6 +772,27 @@ void NativeScriptInstance::notification(int p_notification) {
call_multilevel("_notification", args, 1);
}
+String NativeScriptInstance::to_string(bool *r_valid) {
+ if (has_method(CoreStringNames::get_singleton()->_to_string)) {
+ Variant::CallError ce;
+ Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
+ if (ce.error == Variant::CallError::CALL_OK) {
+ if (ret.get_type() != Variant::STRING) {
+ if (r_valid)
+ *r_valid = false;
+ ERR_EXPLAIN("Wrong type for " + CoreStringNames::get_singleton()->_to_string + ", must be a String.");
+ ERR_FAIL_V(String());
+ }
+ if (r_valid)
+ *r_valid = true;
+ return ret.operator String();
+ }
+ }
+ if (r_valid)
+ *r_valid = false;
+ return String();
+}
+
void NativeScriptInstance::refcount_incremented() {
Variant::CallError err;
call("_refcount_incremented", NULL, 0, err);
@@ -1309,7 +1331,7 @@ void NativeScriptLanguage::unregister_binding_functions(int p_idx) {
for (Set<Vector<void *> *>::Element *E = binding_instances.front(); E; E = E->next()) {
Vector<void *> &binding_data = *E->get();
- if (binding_data[p_idx] && binding_functions[p_idx].second.free_instance_binding_data)
+ if (p_idx < binding_data.size() && binding_data[p_idx] && binding_functions[p_idx].second.free_instance_binding_data)
binding_functions[p_idx].second.free_instance_binding_data(binding_functions[p_idx].second.data, binding_data[p_idx]);
}
@@ -1345,7 +1367,7 @@ void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_objec
if (!(*binding_data)[p_idx]) {
- const void *global_type_tag = global_type_tags[p_idx].get(p_object->get_class_name());
+ const void *global_type_tag = get_global_type_tag(p_idx, p_object->get_class_name());
// no binding data yet, soooooo alloc new one \o/
(*binding_data).write[p_idx] = binding_functions[p_idx].second.alloc_instance_binding_data(binding_functions[p_idx].second.data, global_type_tag, (godot_object *)p_object);
@@ -1454,6 +1476,9 @@ const void *NativeScriptLanguage::get_global_type_tag(int p_idx, StringName p_cl
const HashMap<StringName, const void *> &tags = global_type_tags[p_idx];
+ if (!tags.has(p_class_name))
+ return NULL;
+
const void *tag = tags.get(p_class_name);
return tag;
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index a6865c6243..be1c499714 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -208,6 +208,7 @@ public:
virtual bool has_method(const StringName &p_method) const;
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
virtual void notification(int p_notification);
+ String to_string(bool *r_valid);
virtual Ref<Script> get_script() const;
virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
diff --git a/modules/gdnative/net/webrtc_peer_gdnative.cpp b/modules/gdnative/net/webrtc_gdnative.cpp
index 60b1ed4fe4..d77fa057c5 100644
--- a/modules/gdnative/net/webrtc_peer_gdnative.cpp
+++ b/modules/gdnative/net/webrtc_gdnative.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* packet_peer_gdnative.cpp */
+/* webrtc_gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -32,14 +32,29 @@
#include "modules/gdnative/include/net/godot_net.h"
#ifdef WEBRTC_GDNATIVE_ENABLED
-#include "modules/webrtc/webrtc_peer_gdnative.h"
+#include "modules/webrtc/webrtc_data_channel_gdnative.h"
+#include "modules/webrtc/webrtc_peer_connection_gdnative.h"
#endif
extern "C" {
-void GDAPI godot_net_bind_webrtc_peer(godot_object *p_obj, const godot_net_webrtc_peer *p_impl) {
+void GDAPI godot_net_bind_webrtc_peer_connection(godot_object *p_obj, const godot_net_webrtc_peer_connection *p_impl) {
#ifdef WEBRTC_GDNATIVE_ENABLED
- ((WebRTCPeerGDNative *)p_obj)->set_native_webrtc_peer(p_impl);
+ ((WebRTCPeerConnectionGDNative *)p_obj)->set_native_webrtc_peer_connection(p_impl);
+#endif
+}
+
+void GDAPI godot_net_bind_webrtc_data_channel(godot_object *p_obj, const godot_net_webrtc_data_channel *p_impl) {
+#ifdef WEBRTC_GDNATIVE_ENABLED
+ ((WebRTCDataChannelGDNative *)p_obj)->set_native_webrtc_data_channel(p_impl);
+#endif
+}
+
+godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *p_lib) {
+#ifdef WEBRTC_GDNATIVE_ENABLED
+ return (godot_error)WebRTCPeerConnectionGDNative::set_default_library(p_lib);
+#else
+ return ERR_UNAVAILABLE;
#endif
}
}
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h
index b279fdad8b..381c334231 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.h
+++ b/modules/gdnative/pluginscript/pluginscript_instance.h
@@ -62,7 +62,7 @@ public:
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
#if 0
// Rely on default implementations provided by ScriptInstance for the moment.
- // Note that multilevel call could be removed in 3.0 release, so stay tunned
+ // Note that multilevel call could be removed in 3.0 release, so stay tuned
// (see https://godotengine.org/qa/9244/can-override-the-_ready-and-_process-functions-child-classes)
virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount);
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 2094dca6e4..55d44ceec8 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -50,97 +50,6 @@
#include "editor/editor_node.h"
#include "gdnative_library_editor_plugin.h"
#include "gdnative_library_singleton_editor.h"
-// Class used to discover singleton gdnative files
-
-static void actual_discoverer_handler();
-
-class GDNativeSingletonDiscover : public Object {
- // GDCLASS(GDNativeSingletonDiscover, Object)
-
- virtual String get_class() const {
- // okay, this is a really dirty hack.
- // We're overriding get_class so we can connect it to a signal
- // This works because get_class is a virtual method, so we don't
- // need to register a new class to ClassDB just for this one
- // little signal.
-
- actual_discoverer_handler();
-
- return "Object";
- }
-};
-
-static Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
-
- Set<String> file_paths;
-
- // check children
-
- for (int i = 0; i < p_dir->get_file_count(); i++) {
- String file_name = p_dir->get_file(i);
- String file_type = p_dir->get_file_type(i);
-
- if (file_type != "GDNativeLibrary") {
- continue;
- }
-
- Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i));
- if (lib.is_valid() && lib->is_singleton()) {
- file_paths.insert(p_dir->get_file_path(i));
- }
- }
-
- // check subdirectories
- for (int i = 0; i < p_dir->get_subdir_count(); i++) {
- Set<String> paths = get_gdnative_singletons(p_dir->get_subdir(i));
-
- for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
- file_paths.insert(E->get());
- }
- }
-
- return file_paths;
-}
-
-static void actual_discoverer_handler() {
-
- EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
-
- Set<String> file_paths = get_gdnative_singletons(dir);
-
- bool changed = false;
- Array current_files;
- if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
- current_files = ProjectSettings::get_singleton()->get("gdnative/singletons");
- }
- Array files;
- files.resize(file_paths.size());
- int i = 0;
- for (Set<String>::Element *E = file_paths.front(); E; i++, E = E->next()) {
- if (!current_files.has(E->get())) {
- changed = true;
- }
- files.set(i, E->get());
- }
-
- // Check for removed files
- if (!changed) {
- for (int j = 0; j < current_files.size(); j++) {
- if (!file_paths.has(current_files[j])) {
- changed = true;
- break;
- }
- }
- }
-
- if (changed) {
-
- ProjectSettings::get_singleton()->set("gdnative/singletons", files);
- ProjectSettings::get_singleton()->save();
- }
-}
-
-static GDNativeSingletonDiscover *discoverer = NULL;
class GDNativeExportPlugin : public EditorExportPlugin {
@@ -275,9 +184,6 @@ static void editor_init_callback() {
library_editor->set_name(TTR("GDNative"));
ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(library_editor);
- discoverer = memnew(GDNativeSingletonDiscover);
- EditorFileSystem::get_singleton()->connect("filesystem_changed", discoverer, "get_class");
-
Ref<GDNativeExportPlugin> export_plugin;
export_plugin.instance();
@@ -335,30 +241,36 @@ void register_gdnative_types() {
if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
singletons = ProjectSettings::get_singleton()->get("gdnative/singletons");
}
-
- singleton_gdnatives.resize(singletons.size());
+ Array excluded = Array();
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) {
+ excluded = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled");
+ }
for (int i = 0; i < singletons.size(); i++) {
String path = singletons[i];
- Ref<GDNativeLibrary> lib = ResourceLoader::load(path);
+ if (excluded.has(path))
+ continue;
- singleton_gdnatives.write[i].instance();
- singleton_gdnatives.write[i]->set_library(lib);
+ Ref<GDNativeLibrary> lib = ResourceLoader::load(path);
+ Ref<GDNative> singleton;
+ singleton.instance();
+ singleton->set_library(lib);
- if (!singleton_gdnatives.write[i]->initialize()) {
+ if (!singleton->initialize()) {
// Can't initialize. Don't make a native_call then
continue;
}
void *proc_ptr;
- Error err = singleton_gdnatives[i]->get_symbol(
+ Error err = singleton->get_symbol(
lib->get_symbol_prefix() + "gdnative_singleton",
proc_ptr);
if (err != OK) {
- ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_current_library_path()) + "\" found").utf8().get_data());
+ ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton->get_library()->get_current_library_path()) + "\" found").utf8().get_data());
} else {
+ singleton_gdnatives.push_back(singleton);
((void (*)())proc_ptr)();
}
}
@@ -388,12 +300,6 @@ void unregister_gdnative_types() {
memdelete(GDNativeCallRegistry::singleton);
-#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint() && discoverer != NULL) {
- memdelete(discoverer);
- }
-#endif
-
ResourceLoader::remove_resource_format_loader(resource_loader_gdnlib);
resource_loader_gdnlib.unref();
diff --git a/modules/gdnative/videodecoder/SCsub b/modules/gdnative/videodecoder/SCsub
index 8d9c1ff50e..04cc8ed604 100644
--- a/modules/gdnative/videodecoder/SCsub
+++ b/modules/gdnative/videodecoder/SCsub
@@ -5,5 +5,5 @@ Import('env_modules')
env_vsdecoder_gdnative = env_modules.Clone()
-env_vsdecoder_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_vsdecoder_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp')
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index 9bb1186269..be131c5402 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -146,23 +146,25 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
ERR_FAIL_COND(interface == NULL);
interface->update(data_struct, p_delta);
- if (pcm_write_idx >= 0) {
- // Previous remains
- int mixed = mix_callback(mix_udata, pcm, samples_decoded);
- if (mixed == samples_decoded) {
- pcm_write_idx = -1;
- } else {
- samples_decoded -= mixed;
- pcm_write_idx += mixed;
+ if (mix_callback) {
+ if (pcm_write_idx >= 0) {
+ // Previous remains
+ int mixed = mix_callback(mix_udata, pcm, samples_decoded);
+ if (mixed == samples_decoded) {
+ pcm_write_idx = -1;
+ } else {
+ samples_decoded -= mixed;
+ pcm_write_idx += mixed;
+ }
}
- }
- if (pcm_write_idx < 0) {
- samples_decoded = interface->get_audioframe(data_struct, pcm, AUX_BUFFER_SIZE);
- pcm_write_idx = mix_callback(mix_udata, pcm, samples_decoded);
- if (pcm_write_idx == samples_decoded) {
- pcm_write_idx = -1;
- } else {
- samples_decoded -= pcm_write_idx;
+ if (pcm_write_idx < 0) {
+ samples_decoded = interface->get_audioframe(data_struct, pcm, AUX_BUFFER_SIZE);
+ pcm_write_idx = mix_callback(mix_udata, pcm, samples_decoded);
+ if (pcm_write_idx == samples_decoded) {
+ pcm_write_idx = -1;
+ } else {
+ samples_decoded -= pcm_write_idx;
+ }
}
}
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 4f59b06ae6..060a9d6c91 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -330,7 +330,7 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_
return color_map;
}
-String GDScriptSyntaxHighlighter::get_name() {
+String GDScriptSyntaxHighlighter::get_name() const {
return "GDScript";
}
diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h
index 9dc10a5d1b..9ba2c80552 100644
--- a/modules/gdscript/editor/gdscript_highlighter.h
+++ b/modules/gdscript/editor/gdscript_highlighter.h
@@ -65,7 +65,7 @@ public:
virtual void _update_cache();
virtual Map<int, TextEdit::HighlighterInfo> _get_line_syntax_highlighting(int p_line);
- virtual String get_name();
+ virtual String get_name() const;
virtual List<String> get_supported_languages();
};
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index eada389c51..3fb9268702 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -30,6 +30,7 @@
#include "gdscript.h"
+#include "core/core_string_names.h"
#include "core/engine.h"
#include "core/global_constants.h"
#include "core/io/file_access_encrypted.h"
@@ -226,7 +227,7 @@ void GDScript::get_script_method_list(List<MethodInfo> *p_list) const {
const GDScript *current = this;
while (current) {
- for (const Map<StringName, GDScriptFunction *>::Element *E = member_functions.front(); E; E = E->next()) {
+ for (const Map<StringName, GDScriptFunction *>::Element *E = current->member_functions.front(); E; E = E->next()) {
GDScriptFunction *func = E->get();
MethodInfo mi;
mi.name = E->key();
@@ -1064,7 +1065,7 @@ Variant::Type GDScriptInstance::get_property_type(const StringName &p_name, bool
}
void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const {
- // exported members, not doen yet!
+ // exported members, not done yet!
const GDScript *sptr = script.ptr();
List<PropertyInfo> props;
@@ -1234,6 +1235,27 @@ void GDScriptInstance::notification(int p_notification) {
}
}
+String GDScriptInstance::to_string(bool *r_valid) {
+ if (has_method(CoreStringNames::get_singleton()->_to_string)) {
+ Variant::CallError ce;
+ Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
+ if (ce.error == Variant::CallError::CALL_OK) {
+ if (ret.get_type() != Variant::STRING) {
+ if (r_valid)
+ *r_valid = false;
+ ERR_EXPLAIN("Wrong type for " + CoreStringNames::get_singleton()->_to_string + ", must be a String.");
+ ERR_FAIL_V(String());
+ }
+ if (r_valid)
+ *r_valid = true;
+ return ret.operator String();
+ }
+ }
+ if (r_valid)
+ *r_valid = false;
+ return String();
+}
+
Ref<Script> GDScriptInstance::get_script() const {
return script;
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 1d75d9e2fe..716f536e89 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -251,6 +251,7 @@ public:
Variant debug_get_member_by_index(int p_idx) const { return members[p_idx]; }
virtual void notification(int p_notification);
+ String to_string(bool *r_valid);
virtual Ref<Script> get_script() const;
@@ -407,9 +408,10 @@ public:
csi.resize(_debug_call_stack_pos);
for (int i = 0; i < _debug_call_stack_pos; i++) {
csi.write[_debug_call_stack_pos - i - 1].line = _call_stack[i].line ? *_call_stack[i].line : 0;
- if (_call_stack[i].function)
+ if (_call_stack[i].function) {
csi.write[_debug_call_stack_pos - i - 1].func = _call_stack[i].function->get_name();
- csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path();
+ csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path();
+ }
}
return csi;
}
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index ab34184bfb..fa80c31984 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -511,8 +511,10 @@ struct GDScriptCompletionIdentifier {
static void _get_directory_contents(EditorFileSystemDirectory *p_dir, Set<String> &r_list) {
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
+
for (int i = 0; i < p_dir->get_file_count(); i++) {
- r_list.insert("\"" + p_dir->get_file_path(i) + "\"");
+ r_list.insert(quote_style + p_dir->get_file_path(i) + quote_style);
}
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
@@ -1949,7 +1951,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context
} else {
base_type.has_type = script->get_instance_base_type() != StringName();
base_type.kind = GDScriptParser::DataType::NATIVE;
- base_type.script_type = script->get_instance_base_type();
+ base_type.native_type = script->get_instance_base_type();
}
} else {
return;
@@ -2052,7 +2054,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context
if (!p_only_functions) {
List<PropertyInfo> members;
- tmp.get_property_list(&members);
+ p_base.value.get_property_list(&members);
for (List<PropertyInfo>::Element *E = members.front(); E; E = E->next()) {
if (String(E->get().name).find("/") == -1) {
@@ -2176,7 +2178,8 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
static void _find_call_arguments(const GDScriptCompletionContext &p_context, const GDScriptCompletionIdentifier &p_base, const StringName &p_method, int p_argidx, bool p_static, Set<String> &r_result, String &r_arghint) {
Variant base = p_base.value;
GDScriptParser::DataType base_type = p_base.type;
- bool _static = false;
+
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
while (base_type.has_type) {
switch (base_type.kind) {
@@ -2187,18 +2190,16 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
return;
}
}
- if (!_static) {
- for (int i = 0; i < base_type.class_type->functions.size(); i++) {
- if (base_type.class_type->functions[i]->name == p_method) {
- r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx);
- return;
- }
+ for (int i = 0; i < base_type.class_type->functions.size(); i++) {
+ if (base_type.class_type->functions[i]->name == p_method) {
+ r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx);
+ return;
}
}
if ((p_method == "connect" || p_method == "emit_signal") && p_argidx == 0) {
for (int i = 0; i < base_type.class_type->_signals.size(); i++) {
- r_result.insert("\"" + base_type.class_type->_signals[i].name.operator String() + "\"");
+ r_result.insert(quote_style + base_type.class_type->_signals[i].name.operator String() + quote_style);
}
}
@@ -2211,7 +2212,7 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
List<MethodInfo> signals;
gds->get_script_signal_list(&signals);
for (List<MethodInfo>::Element *E = signals.front(); E; E = E->next()) {
- r_result.insert("\"" + E->get().name + "\"");
+ r_result.insert(quote_style + E->get().name + quote_style);
}
}
Ref<GDScript> base_script = gds->get_base_script();
@@ -2270,7 +2271,7 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
List<MethodInfo> signals;
ClassDB::get_signal_list(class_name, &signals);
for (List<MethodInfo>::Element *E = signals.front(); E; E = E->next()) {
- r_result.insert("\"" + E->get().name + "\"");
+ r_result.insert(quote_style + E->get().name + quote_style);
}
}
@@ -2285,7 +2286,7 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
continue;
}
String name = s.get_slice("/", 1);
- r_result.insert("\"/root/" + name + "\"");
+ r_result.insert(quote_style + "/root/" + name + quote_style);
}
}
@@ -2299,7 +2300,7 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
continue;
}
String name = s.get_slice("/", 1);
- r_result.insert("\"" + name + "\"");
+ r_result.insert(quote_style + name + quote_style);
}
}
@@ -2334,6 +2335,8 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
static void _find_call_arguments(GDScriptCompletionContext &p_context, const GDScriptParser::Node *p_node, int p_argidx, Set<String> &r_result, bool &r_forced, String &r_arghint) {
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
+
if (!p_node || p_node->type != GDScriptParser::Node::TYPE_OPERATOR) {
return;
}
@@ -2451,7 +2454,7 @@ static void _find_call_arguments(GDScriptCompletionContext &p_context, const GDS
Set<String> methods;
_find_identifiers_in_base(p_context, connect_base, true, methods);
for (Set<String>::Element *E = methods.front(); E; E = E->next()) {
- r_result.insert("\"" + E->get().replace("(", "").replace(")", "") + "\"");
+ r_result.insert(quote_style + E->get().replace("(", "").replace(")", "") + quote_style);
}
}
@@ -2460,6 +2463,8 @@ static void _find_call_arguments(GDScriptCompletionContext &p_context, const GDS
Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_forced, String &r_call_hint) {
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
+
GDScriptParser parser;
parser.parse(p_code, p_base_path, false, "", true);
@@ -2526,7 +2531,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
continue;
}
String name = s.get_slice("/", 1);
- options.insert("\"/root/" + name + "\"");
+ options.insert(quote_style + "/root/" + name + quote_style);
}
}
} break;
@@ -2666,7 +2671,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
switch (base_type.kind) {
case GDScriptParser::DataType::CLASS: {
for (int i = 0; i < base_type.class_type->_signals.size(); i++) {
- options.insert("\"" + base_type.class_type->_signals[i].name.operator String() + "\"");
+ options.insert(quote_style + base_type.class_type->_signals[i].name.operator String() + quote_style);
}
base_type = base_type.class_type->base_type;
} break;
@@ -2677,7 +2682,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
List<MethodInfo> signals;
scr->get_script_signal_list(&signals);
for (List<MethodInfo>::Element *E = signals.front(); E; E = E->next()) {
- options.insert("\"" + E->get().name + "\"");
+ options.insert(quote_style + E->get().name + quote_style);
}
Ref<Script> base_script = scr->get_base_script();
if (base_script.is_valid()) {
@@ -2704,7 +2709,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
List<MethodInfo> signals;
ClassDB::get_signal_list(class_name, &signals);
for (List<MethodInfo>::Element *E = signals.front(); E; E = E->next()) {
- options.insert("\"" + E->get().name + "\"");
+ options.insert(quote_style + E->get().name + quote_style);
}
} break;
default: {
@@ -2890,7 +2895,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
String GDScriptLanguage::_get_indentation() const {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
- bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", 0);
+ bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", false);
if (use_space_indentation) {
int indent_size = EDITOR_DEF("text_editor/indent/size", 4);
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 7552bc6bff..5ebcddfd7c 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -72,6 +72,7 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"is_zero_approx",
"ease",
"decimals",
+ "step_decimals",
"stepify",
"lerp",
"inverse_lerp",
@@ -339,6 +340,13 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
r_ret = Math::step_decimals((double)*p_args[0]);
+ ERR_EXPLAIN("GDScript method 'decimals' is deprecated and has been renamed to 'step_decimals', please update your code accordingly.");
+ WARN_DEPRECATED
+ } break;
+ case MATH_STEP_DECIMALS: {
+ VALIDATE_ARG_COUNT(1);
+ VALIDATE_ARG_NUM(0);
+ r_ret = Math::step_decimals((double)*p_args[0]);
} break;
case MATH_STEPIFY: {
VALIDATE_ARG_COUNT(2);
@@ -1452,6 +1460,7 @@ bool GDScriptFunctions::is_deterministic(Function p_func) {
case MATH_ISINF:
case MATH_EASE:
case MATH_DECIMALS:
+ case MATH_STEP_DECIMALS:
case MATH_STEPIFY:
case MATH_LERP:
case MATH_INVERSE_LERP:
@@ -1626,7 +1635,12 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
} break;
case MATH_DECIMALS: {
MethodInfo mi("decimals", PropertyInfo(Variant::REAL, "step"));
- mi.return_val.type = Variant::REAL;
+ mi.return_val.type = Variant::INT;
+ return mi;
+ } break;
+ case MATH_STEP_DECIMALS: {
+ MethodInfo mi("step_decimals", PropertyInfo(Variant::REAL, "step"));
+ mi.return_val.type = Variant::INT;
return mi;
} break;
case MATH_STEPIFY: {
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index 0dbd172acf..c594480ff8 100644
--- a/modules/gdscript/gdscript_functions.h
+++ b/modules/gdscript/gdscript_functions.h
@@ -63,6 +63,7 @@ public:
MATH_ISZEROAPPROX,
MATH_EASE,
MATH_DECIMALS,
+ MATH_STEP_DECIMALS,
MATH_STEPIFY,
MATH_LERP,
MATH_INVERSE_LERP,
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 80af094c2c..1c22c4af3c 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -282,7 +282,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
switch (tokenizer->get_token()) {
case GDScriptTokenizer::TK_CURSOR: {
- completion_cursor = StringName();
completion_type = COMPLETION_GET_NODE;
completion_class = current_class;
completion_function = current_function;
@@ -2870,8 +2869,6 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
lv->assign_op = op;
lv->assign = assigned;
- lv->assign_op = op;
-
if (!_end_statement()) {
_set_error("Expected end of statement (var)");
return;
@@ -4785,19 +4782,30 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
- if (member._export.type != Variant::NIL) {
+ Variant::Type initial_type = member.data_type.has_type ? member.data_type.builtin_type : member._export.type;
+
+ if (initial_type != Variant::NIL && initial_type != Variant::OBJECT) {
IdentifierNode *id = alloc_node<IdentifierNode>();
id->name = member.identifier;
- ConstantNode *cn = alloc_node<ConstantNode>();
+ Node *expr;
- Variant::CallError ce2;
- cn->value = Variant::construct(member._export.type, NULL, 0, ce2);
+ // Make sure arrays and dictionaries are not shared
+ if (initial_type == Variant::ARRAY) {
+ expr = alloc_node<ArrayNode>();
+ } else if (initial_type == Variant::DICTIONARY) {
+ expr = alloc_node<DictionaryNode>();
+ } else {
+ ConstantNode *cn = alloc_node<ConstantNode>();
+ Variant::CallError ce2;
+ cn->value = Variant::construct(initial_type, NULL, 0, ce2);
+ expr = cn;
+ }
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_INIT_ASSIGN;
op->arguments.push_back(id);
- op->arguments.push_back(cn);
+ op->arguments.push_back(expr);
p_class->initializer->statements.push_back(op);
@@ -5240,6 +5248,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
if (base_script.is_valid()) {
String ident = base;
+ Ref<GDScript> find_subclass = base_script;
for (int i = extend_iter; i < p_class->extends_class.size(); i++) {
@@ -5249,7 +5258,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
if (base_script->get_subclasses().has(subclass)) {
- base_script = base_script->get_subclasses()[subclass];
+ find_subclass = base_script->get_subclasses()[subclass];
} else if (base_script->get_constants().has(subclass)) {
Ref<GDScript> new_base_class = base_script->get_constants()[subclass];
@@ -5257,7 +5266,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
_set_error("Constant is not a class: " + ident, p_class->line);
return;
}
- base_script = new_base_class;
+ find_subclass = new_base_class;
} else {
_set_error("Could not find subclass: " + ident, p_class->line);
@@ -5265,7 +5274,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
}
}
- script = base_script;
+ script = find_subclass;
} else if (!base_class) {
@@ -6226,8 +6235,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
return DataType();
}
#ifdef DEBUG_ENABLED
- if (var_op == Variant::OP_DIVIDE && argument_a_type.has_type && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT &&
- argument_b_type.has_type && argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) {
+ if (var_op == Variant::OP_DIVIDE && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT &&
+ argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) {
_add_warning(GDScriptWarning::INTEGER_DIVISION, op->line);
}
#endif // DEBUG_ENABLED
@@ -6938,10 +6947,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
#ifdef DEBUG_ENABLED
if (current_function && !for_completion && !is_static && p_call->arguments[0]->type == Node::TYPE_SELF && current_function->_static) {
- if (current_function && current_function->_static && p_call->arguments[0]->type == Node::TYPE_SELF) {
- _set_error("Can't call non-static function from a static function.", p_call->line);
- return DataType();
- }
+ _set_error("Can't call non-static function from a static function.", p_call->line);
+ return DataType();
}
if (check_types && !is_static && !is_initializer && base_type.is_meta_type) {
@@ -7467,7 +7474,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
return;
}
- // Replace assignment with implict conversion
+ // Replace assignment with implicit conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = v.line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
@@ -7496,30 +7503,6 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
v.data_type = expr_type;
v.data_type.is_constant = false;
}
- } else if (v.data_type.has_type && v.data_type.kind == DataType::BUILTIN) {
- // Create default value based on the type
- IdentifierNode *id = alloc_node<IdentifierNode>();
- id->line = v.line;
- id->name = v.identifier;
-
- ConstantNode *init = alloc_node<ConstantNode>();
- init->line = v.line;
- Variant::CallError err;
- init->value = Variant::construct(v.data_type.builtin_type, NULL, 0, err);
-
- OperatorNode *op = alloc_node<OperatorNode>();
- op->line = v.line;
- op->op = OperatorNode::OP_INIT_ASSIGN;
- op->arguments.push_back(id);
- op->arguments.push_back(init);
-
- p_class->initializer->statements.push_front(op);
- v.initial_assignment = op;
-#ifdef DEBUG_ENABLED
- NewLineNode *nl = alloc_node<NewLineNode>();
- nl->line = v.line - 1;
- p_class->initializer->statements.push_front(nl);
-#endif
}
// Check export hint
@@ -7855,14 +7838,14 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (_is_type_compatible(assign_type, lv->datatype)) {
_mark_line_as_unsafe(lv->line);
} else {
- // Try implict conversion
+ // Try implicit conversion
if (lv->datatype.kind != DataType::BUILTIN || !_is_type_compatible(lv->datatype, assign_type, true)) {
_set_error("Assigned value type (" + assign_type.to_string() + ") doesn't match the variable's type (" +
lv->datatype.to_string() + ").",
lv->line);
return;
}
- // Replace assignment with implict conversion
+ // Replace assignment with implicit conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = lv->line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
@@ -7986,14 +7969,14 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (_is_type_compatible(rh_type, lh_type)) {
_mark_line_as_unsafe(op->line);
} else {
- // Try implict conversion
+ // Try implicit conversion
if (lh_type.kind != DataType::BUILTIN || !_is_type_compatible(lh_type, rh_type, true)) {
_set_error("Assigned value type (" + rh_type.to_string() + ") doesn't match the variable's type (" +
lh_type.to_string() + ").",
op->line);
return;
}
- // Replace assignment with implict conversion
+ // Replace assignment with implicit conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = op->line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 17eb6f674c..890bd730f7 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -67,9 +67,6 @@ void GridMapEditor::_menu_option(int p_option) {
floor->set_value(floor->get_value() + 1);
} break;
- case MENU_OPTION_CONFIGURE: {
-
- } break;
case MENU_OPTION_LOCK_VIEW: {
int index = options->get_popup()->get_item_index(MENU_OPTION_LOCK_VIEW);
@@ -121,14 +118,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_ROTATE_Y: {
Basis r;
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- r.set_orthogonal_index(selection.duplicate_rot);
+ r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
- selection.duplicate_rot = r.get_orthogonal_index();
- _update_duplicate_indicator();
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
break;
}
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -137,12 +135,12 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_ROTATE_X: {
Basis r;
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- r.set_orthogonal_index(selection.duplicate_rot);
+ r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(1, 0, 0), -Math_PI / 2.0);
- selection.duplicate_rot = r.get_orthogonal_index();
- _update_duplicate_indicator();
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
break;
}
@@ -154,12 +152,12 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_ROTATE_Z: {
Basis r;
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- r.set_orthogonal_index(selection.duplicate_rot);
+ r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 0, 1), -Math_PI / 2.0);
- selection.duplicate_rot = r.get_orthogonal_index();
- _update_duplicate_indicator();
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
break;
}
@@ -171,6 +169,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
Basis r;
+ if (input_action == INPUT_PASTE) {
+
+ r.set_orthogonal_index(paste_indicator.orientation);
+ r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
+ break;
+ }
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -179,6 +186,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
Basis r;
+ if (input_action == INPUT_PASTE) {
+
+ r.set_orthogonal_index(paste_indicator.orientation);
+ r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
+ break;
+ }
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -187,6 +203,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
Basis r;
+ if (input_action == INPUT_PASTE) {
+
+ r.set_orthogonal_index(paste_indicator.orientation);
+ r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
+ break;
+ }
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -194,10 +219,10 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CURSOR_CLEAR_ROTATION: {
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- selection.duplicate_rot = 0;
- _update_duplicate_indicator();
+ paste_indicator.orientation = 0;
+ _update_paste_indicator();
break;
}
@@ -205,28 +230,33 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
- case MENU_OPTION_DUPLICATE_SELECTS: {
- int idx = options->get_popup()->get_item_index(MENU_OPTION_DUPLICATE_SELECTS);
+ case MENU_OPTION_PASTE_SELECTS: {
+ int idx = options->get_popup()->get_item_index(MENU_OPTION_PASTE_SELECTS);
options->get_popup()->set_item_checked(idx, !options->get_popup()->is_item_checked(idx));
} break;
- case MENU_OPTION_SELECTION_DUPLICATE:
+
+ case MENU_OPTION_SELECTION_DUPLICATE: // fallthrough
+ case MENU_OPTION_SELECTION_CUT: {
if (!(selection.active && input_action == INPUT_NONE))
- return;
- if (last_mouseover == Vector3(-1, -1, -1)) //nono mouseovering anythin
break;
- last_mouseover = selection.begin;
- VS::get_singleton()->instance_set_transform(grid_instance[edit_axis], Transform(Basis(), grid_ofs));
+ _set_clipboard_data();
- input_action = INPUT_DUPLICATE;
- selection.click = last_mouseover;
- selection.current = last_mouseover;
- selection.duplicate_rot = 0;
- _update_duplicate_indicator();
- break;
+ if (p_option == MENU_OPTION_SELECTION_CUT) {
+ _delete_selection();
+ }
+
+ input_action = INPUT_PASTE;
+ paste_indicator.click = selection.begin;
+ paste_indicator.current = selection.begin;
+ paste_indicator.begin = selection.begin;
+ paste_indicator.end = selection.end;
+ paste_indicator.orientation = 0;
+ _update_paste_indicator();
+ } break;
case MENU_OPTION_SELECTION_CLEAR: {
if (!selection.active)
- return;
+ break;
_delete_selection();
@@ -315,17 +345,28 @@ void GridMapEditor::_validate_selection() {
_update_selection_transform();
}
+void GridMapEditor::_set_selection(bool p_active, const Vector3 p_begin, const Vector3 p_end) {
+
+ selection.active = p_active;
+ selection.begin = p_begin;
+ selection.end = p_end;
+ selection.click = p_begin;
+ selection.current = p_end;
+
+ _update_selection_transform();
+}
+
bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click) {
if (!spatial_editor)
return false;
- if (selected_palette < 0 && input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE)
+ if (selected_palette < 0 && input_action != INPUT_PICK && input_action != INPUT_SELECT && input_action != INPUT_PASTE)
return false;
Ref<MeshLibrary> mesh_library = node->get_mesh_library();
if (mesh_library.is_null())
return false;
- if (input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE && !mesh_library->has_item(selected_palette))
+ if (input_action != INPUT_PICK && input_action != INPUT_SELECT && input_action != INPUT_PASTE && !mesh_library->has_item(selected_palette))
return false;
Camera *camera = p_camera;
@@ -386,13 +427,17 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
cursor_origin = (Vector3(cell[0], cell[1], cell[2]) + Vector3(0.5 * node->get_center_x(), 0.5 * node->get_center_y(), 0.5 * node->get_center_z())) * node->get_cell_size();
cursor_visible = true;
+ if (input_action == INPUT_SELECT || input_action == INPUT_PASTE) {
+ cursor_visible = false;
+ }
+
_update_cursor_transform();
}
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- selection.current = Vector3(cell[0], cell[1], cell[2]);
- _update_duplicate_indicator();
+ paste_indicator.current = Vector3(cell[0], cell[1], cell[2]);
+ _update_paste_indicator();
} else if (input_action == INPUT_SELECT) {
@@ -403,7 +448,7 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
_validate_selection();
return true;
- } else if (input_action == INPUT_COPY) {
+ } else if (input_action == INPUT_PICK) {
int item = node->get_cell_item(cell[0], cell[1], cell[2]);
if (item >= 0) {
@@ -456,10 +501,9 @@ void GridMapEditor::_delete_selection() {
}
}
}
+ undo_redo->add_do_method(this, "_set_selection", !selection.active, selection.begin, selection.end);
+ undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->commit_action();
-
- selection.active = false;
- _validate_selection();
}
void GridMapEditor::_fill_selection() {
@@ -479,97 +523,124 @@ void GridMapEditor::_fill_selection() {
}
}
}
+ undo_redo->add_do_method(this, "_set_selection", !selection.active, selection.begin, selection.end);
+ undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->commit_action();
+}
- selection.active = false;
- _validate_selection();
+void GridMapEditor::_clear_clipboard_data() {
+
+ for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
+
+ VisualServer::get_singleton()->free(E->get().instance);
+ }
+
+ clipboard_items.clear();
}
-void GridMapEditor::_update_duplicate_indicator() {
+void GridMapEditor::_set_clipboard_data() {
+
+ _clear_clipboard_data();
- if (!selection.active || input_action != INPUT_DUPLICATE) {
+ Ref<MeshLibrary> meshLibrary = node->get_mesh_library();
+
+ for (int i = selection.begin.x; i <= selection.end.x; i++) {
+
+ for (int j = selection.begin.y; j <= selection.end.y; j++) {
+
+ for (int k = selection.begin.z; k <= selection.end.z; k++) {
+
+ int itm = node->get_cell_item(i, j, k);
+ if (itm == GridMap::INVALID_CELL_ITEM)
+ continue;
+
+ Ref<Mesh> mesh = meshLibrary->get_item_mesh(itm);
+
+ ClipboardItem item;
+ item.cell_item = itm;
+ item.grid_offset = Vector3(i, j, k) - selection.begin;
+ item.orientation = node->get_cell_item_orientation(i, j, k);
+ item.instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
+
+ clipboard_items.push_back(item);
+ }
+ }
+ }
+}
+
+void GridMapEditor::_update_paste_indicator() {
+
+ if (input_action != INPUT_PASTE) {
Transform xf;
xf.basis.set_zero();
- VisualServer::get_singleton()->instance_set_transform(duplicate_instance, xf);
+ VisualServer::get_singleton()->instance_set_transform(paste_instance, xf);
return;
}
+ Vector3 center = 0.5 * Vector3(node->get_center_x(), node->get_center_y(), node->get_center_z());
+ Vector3 scale = (Vector3(1, 1, 1) + (paste_indicator.end - paste_indicator.begin)) * node->get_cell_size();
Transform xf;
- xf.scale(Vector3(1, 1, 1) * (Vector3(1, 1, 1) + (selection.end - selection.begin)) * node->get_cell_size());
- xf.origin = (selection.begin + (selection.current - selection.click)) * node->get_cell_size();
+ xf.scale(scale);
+ xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
Basis rot;
- rot.set_orthogonal_index(selection.duplicate_rot);
+ rot.set_orthogonal_index(paste_indicator.orientation);
xf.basis = rot * xf.basis;
+ xf.translate((-center * node->get_cell_size()) / scale);
- VisualServer::get_singleton()->instance_set_transform(duplicate_instance, node->get_global_transform() * xf);
-}
+ VisualServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
-struct __Item {
- Vector3 pos;
- int rot;
- int item;
-};
-void GridMapEditor::_duplicate_paste() {
+ for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- if (!selection.active)
- return;
+ ClipboardItem &item = E->get();
- int idx = options->get_popup()->get_item_index(MENU_OPTION_DUPLICATE_SELECTS);
- bool reselect = options->get_popup()->is_item_checked(idx);
+ xf = Transform();
+ xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
+ xf.basis = rot * xf.basis;
+ xf.translate(item.grid_offset * node->get_cell_size());
- List<__Item> items;
+ Basis item_rot;
+ item_rot.set_orthogonal_index(item.orientation);
+ xf.basis = item_rot * xf.basis;
+
+ VisualServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf);
+ }
+}
+
+void GridMapEditor::_do_paste() {
+
+ int idx = options->get_popup()->get_item_index(MENU_OPTION_PASTE_SELECTS);
+ bool reselect = options->get_popup()->is_item_checked(idx);
Basis rot;
- rot.set_orthogonal_index(selection.duplicate_rot);
+ rot.set_orthogonal_index(paste_indicator.orientation);
- for (int i = selection.begin.x; i <= selection.end.x; i++) {
+ Vector3 ofs = paste_indicator.current - paste_indicator.click;
+ undo_redo->create_action(TTR("GridMap Paste Selection"));
- for (int j = selection.begin.y; j <= selection.end.y; j++) {
+ for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- for (int k = selection.begin.z; k <= selection.end.z; k++) {
+ ClipboardItem &item = E->get();
- int itm = node->get_cell_item(i, j, k);
- if (itm == GridMap::INVALID_CELL_ITEM)
- continue;
- int orientation = node->get_cell_item_orientation(i, j, k);
- __Item item;
- Vector3 rel = Vector3(i, j, k) - selection.begin;
- rel = rot.xform(rel);
-
- Basis orm;
- orm.set_orthogonal_index(orientation);
- orm = rot * orm;
-
- item.pos = selection.begin + rel;
- item.item = itm;
- item.rot = orm.get_orthogonal_index();
- items.push_back(item);
- }
- }
- }
+ Vector3 pos = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
- Vector3 ofs = selection.current - selection.click;
- if (items.size()) {
- undo_redo->create_action(TTR("GridMap Duplicate Selection"));
- for (List<__Item>::Element *E = items.front(); E; E = E->next()) {
- __Item &it = E->get();
- Vector3 pos = it.pos + ofs;
+ Basis orm;
+ orm.set_orthogonal_index(item.orientation);
+ orm = rot * orm;
- undo_redo->add_do_method(node, "set_cell_item", pos.x, pos.y, pos.z, it.item, it.rot);
- undo_redo->add_undo_method(node, "set_cell_item", pos.x, pos.y, pos.z, node->get_cell_item(pos.x, pos.y, pos.z), node->get_cell_item_orientation(pos.x, pos.y, pos.z));
- }
- undo_redo->commit_action();
+ undo_redo->add_do_method(node, "set_cell_item", pos.x, pos.y, pos.z, item.cell_item, orm.get_orthogonal_index());
+ undo_redo->add_undo_method(node, "set_cell_item", pos.x, pos.y, pos.z, node->get_cell_item(pos.x, pos.y, pos.z), node->get_cell_item_orientation(pos.x, pos.y, pos.z));
}
if (reselect) {
- selection.begin += ofs;
- selection.end += ofs;
- selection.click = selection.begin;
- selection.current = selection.end;
- _validate_selection();
+ undo_redo->add_do_method(this, "_set_selection", true, paste_indicator.begin + ofs, paste_indicator.end + ofs);
+ undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
}
+
+ undo_redo->commit_action();
+
+ _clear_clipboard_data();
}
bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) {
@@ -596,28 +667,31 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
if (mb->get_button_index() == BUTTON_LEFT) {
- if (input_action == INPUT_DUPLICATE) {
- //paste
- _duplicate_paste();
+ if (input_action == INPUT_PASTE) {
+ _do_paste();
input_action = INPUT_NONE;
- _update_duplicate_indicator();
+ _update_paste_indicator();
} else if (mb->get_shift()) {
input_action = INPUT_SELECT;
+ last_selection = selection;
} else if (mb->get_command()) {
- input_action = INPUT_COPY;
+ input_action = INPUT_PICK;
} else {
input_action = INPUT_PAINT;
set_items.clear();
}
} else if (mb->get_button_index() == BUTTON_RIGHT) {
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
+ _clear_clipboard_data();
input_action = INPUT_NONE;
- _update_duplicate_indicator();
- } else if (mb->get_shift()) {
+ _update_paste_indicator();
+ return true;
+ } else if (selection.active) {
+ _set_selection(false);
+ return true;
+ } else {
input_action = INPUT_ERASE;
set_items.clear();
- } else {
- return false;
}
} else {
return false;
@@ -650,13 +724,21 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
return set_items.size() > 0;
}
+ if (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_SELECT) {
+
+ undo_redo->create_action("GridMap Selection");
+ undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
+ undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
+ undo_redo->commit_action();
+ }
+
if (mb->get_button_index() == BUTTON_LEFT && input_action != INPUT_NONE) {
set_items.clear();
input_action = INPUT_NONE;
return true;
}
- if (mb->get_button_index() == BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_DUPLICATE)) {
+ if (mb->get_button_index() == BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
input_action = INPUT_NONE;
return true;
}
@@ -670,6 +752,45 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
return do_input_action(p_camera, mm->get_position(), false);
}
+ Ref<InputEventKey> k = p_event;
+
+ if (k.is_valid()) {
+ if (k->is_pressed()) {
+ if (k->get_scancode() == KEY_ESCAPE) {
+
+ if (input_action == INPUT_PASTE) {
+ _clear_clipboard_data();
+ input_action = INPUT_NONE;
+ _update_paste_indicator();
+ return true;
+ } else if (selection.active) {
+ _set_selection(false);
+ return true;
+ } else {
+ selected_palette = -1;
+ mesh_library_palette->unselect_all();
+ update_palette();
+ _update_cursor_instance();
+ return true;
+ }
+ }
+
+ if (k->get_shift() && selection.active && input_action != INPUT_PASTE) {
+
+ if (k->get_scancode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_PREV_LEVEL))) {
+ selection.click[edit_axis]--;
+ _validate_selection();
+ return true;
+ }
+ if (k->get_scancode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_NEXT_LEVEL))) {
+ selection.click[edit_axis]++;
+ _validate_selection();
+ return true;
+ }
+ }
+ }
+ }
+
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
@@ -818,7 +939,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
input_action = INPUT_NONE;
selection.active = false;
_update_selection_transform();
- _update_duplicate_indicator();
+ _update_paste_indicator();
spatial_editor = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen());
@@ -953,13 +1074,15 @@ void GridMapEditor::_notification(int p_what) {
}
selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario());
- duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh, get_tree()->get_root()->get_world()->get_scenario());
+ paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario());
_update_selection_transform();
- _update_duplicate_indicator();
+ _update_paste_indicator();
} break;
case NOTIFICATION_EXIT_TREE: {
+ _clear_clipboard_data();
+
for (int i = 0; i < 3; i++) {
VS::get_singleton()->free(grid_instance[i]);
@@ -970,9 +1093,9 @@ void GridMapEditor::_notification(int p_what) {
}
VisualServer::get_singleton()->free(selection_instance);
- VisualServer::get_singleton()->free(duplicate_instance);
+ VisualServer::get_singleton()->free(paste_instance);
selection_instance = RID();
- duplicate_instance = RID();
+ paste_instance = RID();
} break;
case NOTIFICATION_PROCESS: {
@@ -1056,6 +1179,10 @@ void GridMapEditor::_floor_changed(float p_value) {
_update_selection_transform();
}
+void GridMapEditor::_floor_mouse_exited() {
+ floor->get_line_edit()->release_focus();
+}
+
void GridMapEditor::_bind_methods() {
ClassDB::bind_method("_text_changed", &GridMapEditor::_text_changed);
@@ -1065,6 +1192,8 @@ void GridMapEditor::_bind_methods() {
ClassDB::bind_method("_configure", &GridMapEditor::_configure);
ClassDB::bind_method("_item_selected_cbk", &GridMapEditor::_item_selected_cbk);
ClassDB::bind_method("_floor_changed", &GridMapEditor::_floor_changed);
+ ClassDB::bind_method("_floor_mouse_exited", &GridMapEditor::_floor_mouse_exited);
+ ClassDB::bind_method("_set_selection", &GridMapEditor::_set_selection);
ClassDB::bind_method(D_METHOD("_set_display_mode", "mode"), &GridMapEditor::_set_display_mode);
}
@@ -1097,6 +1226,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
spatial_editor_hb->add_child(floor);
floor->connect("value_changed", this, "_floor_changed");
+ floor->connect("mouse_exited", this, "_floor_mouse_exited");
+ floor->get_line_edit()->connect("mouse_exited", this, "_floor_mouse_exited");
spatial_editor_hb->add_child(memnew(VSeparator));
@@ -1128,15 +1259,12 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
options->get_popup()->add_item(TTR("Cursor Back Rotate Z"), MENU_OPTION_CURSOR_BACK_ROTATE_Z, KEY_MASK_SHIFT + KEY_D);
options->get_popup()->add_item(TTR("Cursor Clear Rotation"), MENU_OPTION_CURSOR_CLEAR_ROTATION, KEY_W);
options->get_popup()->add_separator();
- options->get_popup()->add_check_item("Duplicate Selects", MENU_OPTION_DUPLICATE_SELECTS);
- options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Create Area"), MENU_OPTION_SELECTION_MAKE_AREA, KEY_CONTROL + KEY_C);
- options->get_popup()->add_item(TTR("Create Exterior Connector"), MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR);
- options->get_popup()->add_item(TTR("Erase Area"), MENU_OPTION_REMOVE_AREA);
+ options->get_popup()->add_check_item("Paste Selects", MENU_OPTION_PASTE_SELECTS);
options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_SHIFT + KEY_C);
- options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, KEY_MASK_SHIFT + KEY_X);
- options->get_popup()->add_item(TTR("Fill Selection"), MENU_OPTION_SELECTION_FILL, KEY_MASK_SHIFT + KEY_F);
+ options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_CTRL + KEY_C);
+ options->get_popup()->add_item(TTR("Cut Selection"), MENU_OPTION_SELECTION_CUT, KEY_MASK_CTRL + KEY_X);
+ options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, KEY_DELETE);
+ options->get_popup()->add_item(TTR("Fill Selection"), MENU_OPTION_SELECTION_FILL, KEY_MASK_CTRL + KEY_F);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Settings"), MENU_OPTION_GRIDMAP_SETTINGS);
@@ -1211,7 +1339,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
last_mouseover = Vector3(-1, -1, -1);
selection_mesh = VisualServer::get_singleton()->mesh_create();
- duplicate_mesh = VisualServer::get_singleton()->mesh_create();
+ paste_mesh = VisualServer::get_singleton()->mesh_create();
{
//selection mesh create
@@ -1319,12 +1447,12 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid());
d[VS::ARRAY_VERTEX] = triangles;
- VisualServer::get_singleton()->mesh_add_surface_from_arrays(duplicate_mesh, VS::PRIMITIVE_TRIANGLES, d);
- VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh, 0, inner_mat->get_rid());
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_TRIANGLES, d);
+ VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid());
d[VS::ARRAY_VERTEX] = lines;
- VisualServer::get_singleton()->mesh_add_surface_from_arrays(duplicate_mesh, VS::PRIMITIVE_LINES, d);
- VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh, 1, outer_mat->get_rid());
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_LINES, d);
+ VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid());
for (int i = 0; i < 3; i++) {
d[VS::ARRAY_VERTEX] = square[i];
@@ -1341,6 +1469,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
GridMapEditor::~GridMapEditor() {
+ _clear_clipboard_data();
+
for (int i = 0; i < 3; i++) {
if (grid[i].is_valid())
@@ -1359,9 +1489,9 @@ GridMapEditor::~GridMapEditor() {
if (selection_instance.is_valid())
VisualServer::get_singleton()->free(selection_instance);
- VisualServer::get_singleton()->free(duplicate_mesh);
- if (duplicate_instance.is_valid())
- VisualServer::get_singleton()->free(duplicate_instance);
+ VisualServer::get_singleton()->free(paste_mesh);
+ if (paste_instance.is_valid())
+ VisualServer::get_singleton()->free(paste_instance);
}
void GridMapEditorPlugin::_notification(int p_what) {
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 59b8ac13da..da36165d4e 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -54,9 +54,9 @@ class GridMapEditor : public VBoxContainer {
INPUT_NONE,
INPUT_PAINT,
INPUT_ERASE,
- INPUT_COPY,
+ INPUT_PICK,
INPUT_SELECT,
- INPUT_DUPLICATE,
+ INPUT_PASTE,
};
enum ClipMode {
@@ -116,8 +116,17 @@ class GridMapEditor : public VBoxContainer {
RID selection_instance;
RID selection_level_mesh[3];
RID selection_level_instance[3];
- RID duplicate_mesh;
- RID duplicate_instance;
+ RID paste_mesh;
+ RID paste_instance;
+
+ struct ClipboardItem {
+ int cell_item;
+ Vector3 grid_offset;
+ int orientation;
+ RID instance;
+ };
+
+ List<ClipboardItem> clipboard_items;
Ref<SpatialMaterial> indicator_mat;
Ref<SpatialMaterial> inner_mat;
@@ -132,9 +141,19 @@ class GridMapEditor : public VBoxContainer {
Vector3 current;
Vector3 begin;
Vector3 end;
- int duplicate_rot;
bool active;
} selection;
+ Selection last_selection;
+
+ struct PasteIndicator {
+
+ Vector3 click;
+ Vector3 current;
+ Vector3 begin;
+ Vector3 end;
+ int orientation;
+ };
+ PasteIndicator paste_indicator;
bool cursor_visible;
Transform cursor_transform;
@@ -148,7 +167,6 @@ class GridMapEditor : public VBoxContainer {
enum Menu {
- MENU_OPTION_CONFIGURE,
MENU_OPTION_NEXT_LEVEL,
MENU_OPTION_PREV_LEVEL,
MENU_OPTION_LOCK_VIEW,
@@ -165,13 +183,11 @@ class GridMapEditor : public VBoxContainer {
MENU_OPTION_CURSOR_BACK_ROTATE_X,
MENU_OPTION_CURSOR_BACK_ROTATE_Z,
MENU_OPTION_CURSOR_CLEAR_ROTATION,
- MENU_OPTION_DUPLICATE_SELECTS,
- MENU_OPTION_SELECTION_MAKE_AREA,
- MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR,
+ MENU_OPTION_PASTE_SELECTS,
MENU_OPTION_SELECTION_DUPLICATE,
+ MENU_OPTION_SELECTION_CUT,
MENU_OPTION_SELECTION_CLEAR,
MENU_OPTION_SELECTION_FILL,
- MENU_OPTION_REMOVE_AREA,
MENU_OPTION_GRIDMAP_SETTINGS
};
@@ -200,12 +216,16 @@ class GridMapEditor : public VBoxContainer {
void _icon_size_changed(float p_value);
- void _update_duplicate_indicator();
- void _duplicate_paste();
+ void _clear_clipboard_data();
+ void _set_clipboard_data();
+ void _update_paste_indicator();
+ void _do_paste();
void _update_selection_transform();
void _validate_selection();
+ void _set_selection(bool p_active, const Vector3 p_begin = Vector3(), const Vector3 p_end = Vector3());
void _floor_changed(float p_value);
+ void _floor_mouse_exited();
void _delete_selection();
void _fill_selection();
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index d5f87905eb..96e8e704dd 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -13,7 +13,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_jpg.Append(CPPPATH=[thirdparty_dir])
+env_jpg.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_jpg.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index dc7ed03548..fe107d3683 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -440,6 +440,12 @@ void MobileVRInterface::process() {
};
};
+void MobileVRInterface::notification(int p_what){
+ _THREAD_SAFE_METHOD_
+
+ // nothing to do here, I guess we could pauze our sensors...
+}
+
MobileVRInterface::MobileVRInterface() {
initialized = false;
diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h
index e595daf16e..7fa51eecb7 100644
--- a/modules/mobile_vr/mobile_vr_interface.h
+++ b/modules/mobile_vr/mobile_vr_interface.h
@@ -142,6 +142,7 @@ public:
virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect);
virtual void process();
+ virtual void notification(int p_what);
MobileVRInterface();
~MobileVRInterface();
diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py
index 160580e116..4cfa2a5b93 100644
--- a/modules/mono/build_scripts/mono_configure.py
+++ b/modules/mono/build_scripts/mono_configure.py
@@ -70,7 +70,7 @@ def configure(env, env_mono):
mono_lib_path = os.path.join(mono_root, 'lib')
env.Append(LIBPATH=mono_lib_path)
- env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+ env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
if mono_static:
lib_suffix = Environment()['LIBSUFFIX']
@@ -153,7 +153,7 @@ def configure(env, env_mono):
mono_lib_path = os.path.join(mono_root, 'lib')
env.Append(LIBPATH=mono_lib_path)
- env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+ env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a')
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 27e579935f..72199281ff 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1855,6 +1855,34 @@ void CSharpInstance::_call_notification(int p_notification) {
}
}
+String CSharpInstance::to_string(bool *r_valid) {
+ MonoObject *mono_object = get_mono_object();
+
+ if (mono_object == NULL) {
+ if (r_valid)
+ *r_valid = false;
+ return String();
+ }
+
+ MonoException *exc = NULL;
+ MonoString *result = GDMonoUtils::object_to_string(mono_object, &exc);
+
+ if (exc) {
+ GDMonoUtils::set_pending_exception(exc);
+ if (r_valid)
+ *r_valid = false;
+ return String();
+ }
+
+ if (result == NULL) {
+ if (r_valid)
+ *r_valid = false;
+ return String();
+ }
+
+ return GDMonoMarshal::mono_string_to_godot(result);
+}
+
Ref<Script> CSharpInstance::get_script() const {
return script;
@@ -2020,7 +2048,7 @@ bool CSharpScript::_update_exports() {
for (int i = fields.size() - 1; i >= 0; i--) {
GDMonoField *field = fields[i];
- if (_get_member_export(top, field, prop_info, exported)) {
+ if (_get_member_export(field, prop_info, exported)) {
StringName name = field->get_name();
if (exported) {
@@ -2041,7 +2069,7 @@ bool CSharpScript::_update_exports() {
for (int i = properties.size() - 1; i >= 0; i--) {
GDMonoProperty *property = properties[i];
- if (_get_member_export(top, property, prop_info, exported)) {
+ if (_get_member_export(property, prop_info, exported)) {
StringName name = property->get_name();
if (exported) {
@@ -2168,17 +2196,19 @@ bool CSharpScript::_get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Ve
* Returns false if there was an error, otherwise true.
* If there was an error, r_prop_info and r_exported are not assigned any value.
*/
-bool CSharpScript::_get_member_export(GDMonoClass *p_class, IMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported) {
+bool CSharpScript::_get_member_export(IMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported) {
- StringName name = p_member->get_name();
+ // Goddammit, C++. All I wanted was some nested functions.
+#define MEMBER_FULL_QUALIFIED_NAME(m_member) \
+ (m_member->get_enclosing_class()->get_full_name() + "." + (String)m_member->get_name())
if (p_member->is_static()) {
if (p_member->has_attribute(CACHED_CLASS(ExportAttribute)))
- ERR_PRINTS("Cannot export member because it is static: " + p_class->get_full_name() + "." + name.operator String());
+ ERR_PRINTS("Cannot export member because it is static: " + MEMBER_FULL_QUALIFIED_NAME(p_member));
return false;
}
- if (member_info.has(name))
+ if (member_info.has(p_member->get_name()))
return false;
ManagedType type;
@@ -2191,19 +2221,22 @@ bool CSharpScript::_get_member_export(GDMonoClass *p_class, IMonoClassMember *p_
CRASH_NOW();
}
- GDMonoMarshal::ExportInfo export_info;
- Variant::Type variant_type = GDMonoMarshal::managed_to_variant_type(type, &export_info);
+ Variant::Type variant_type = GDMonoMarshal::managed_to_variant_type(type);
if (!p_member->has_attribute(CACHED_CLASS(ExportAttribute))) {
- r_prop_info = PropertyInfo(variant_type, name.operator String(), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
+ r_prop_info = PropertyInfo(variant_type, (String)p_member->get_name(), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
r_exported = false;
return true;
}
if (p_member->get_member_type() == IMonoClassMember::MEMBER_TYPE_PROPERTY) {
GDMonoProperty *property = static_cast<GDMonoProperty *>(p_member);
- if (!property->has_getter() || !property->has_setter()) {
- ERR_PRINTS("Cannot export property because it does not provide a getter or a setter: " + p_class->get_full_name() + "." + name.operator String());
+ if (!property->has_getter()) {
+ ERR_PRINTS("Read-only property cannot be exported: " + MEMBER_FULL_QUALIFIED_NAME(p_member));
+ return false;
+ }
+ if (!property->has_setter()) {
+ ERR_PRINTS("Set-only property (without getter) cannot be exported: " + MEMBER_FULL_QUALIFIED_NAME(p_member));
return false;
}
}
@@ -2214,16 +2247,38 @@ bool CSharpScript::_get_member_export(GDMonoClass *p_class, IMonoClassMember *p_
String hint_string;
if (variant_type == Variant::NIL) {
- ERR_PRINTS("Unknown type of exported member: " + p_class->get_full_name() + "." + name.operator String());
+ ERR_PRINTS("Unknown exported member type: " + MEMBER_FULL_QUALIFIED_NAME(p_member));
return false;
- } else if (variant_type == Variant::INT && type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(type.type_class->get_mono_ptr())) {
- // TODO: Move to ExportInfo?
- variant_type = Variant::INT;
- hint = PROPERTY_HINT_ENUM;
+ }
- Vector<MonoClassField *> fields = type.type_class->get_enum_fields();
+ int hint_res = _try_get_member_export_hint(p_member, type, variant_type, /* allow_generics: */ true, hint, hint_string);
- MonoType *enum_basetype = mono_class_enum_basetype(type.type_class->get_mono_ptr());
+ if (hint_res == -1) {
+ ERR_EXPLAIN("Error while trying to determine information about the exported member: " + MEMBER_FULL_QUALIFIED_NAME(p_member));
+ ERR_FAIL_V(false);
+ }
+
+ if (hint_res == 0) {
+ hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr));
+ hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr);
+ }
+
+ r_prop_info = PropertyInfo(variant_type, (String)p_member->get_name(), hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE);
+ r_exported = true;
+
+ return true;
+
+#undef MEMBER_FULL_QUALIFIED_NAME
+}
+
+int CSharpScript::_try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string) {
+
+ if (p_variant_type == Variant::INT && p_type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(p_type.type_class->get_mono_ptr())) {
+ r_hint = PROPERTY_HINT_ENUM;
+
+ Vector<MonoClassField *> fields = p_type.type_class->get_enum_fields();
+
+ MonoType *enum_basetype = mono_class_enum_basetype(p_type.type_class->get_mono_ptr());
String name_only_hint_string;
@@ -2236,12 +2291,12 @@ bool CSharpScript::_get_member_export(GDMonoClass *p_class, IMonoClassMember *p_
MonoClassField *field = fields[i];
if (i > 0) {
- hint_string += ",";
+ r_hint_string += ",";
name_only_hint_string += ",";
}
String enum_field_name = mono_field_get_name(field);
- hint_string += enum_field_name;
+ r_hint_string += enum_field_name;
name_only_hint_string += enum_field_name;
// TODO:
@@ -2251,53 +2306,73 @@ bool CSharpScript::_get_member_export(GDMonoClass *p_class, IMonoClassMember *p_
MonoObject *val_obj = mono_field_get_value_object(mono_domain_get(), field, NULL);
if (val_obj == NULL) {
- ERR_PRINTS("Failed to get '" + enum_field_name + "' constant enum value of exported member: " +
- p_class->get_full_name() + "." + name.operator String());
- return false;
+ ERR_EXPLAIN("Failed to get '" + enum_field_name + "' constant enum value");
+ ERR_FAIL_V(-1);
}
bool r_error;
uint64_t val = GDMonoUtils::unbox_enum_value(val_obj, enum_basetype, r_error);
if (r_error) {
- ERR_PRINTS("Failed to unbox '" + enum_field_name + "' constant enum value of exported member: " +
- p_class->get_full_name() + "." + name.operator String());
- return false;
+ ERR_EXPLAIN("Failed to unbox '" + enum_field_name + "' constant enum value");
+ ERR_FAIL_V(-1);
}
if (val != (unsigned int)i) {
uses_default_values = false;
}
- hint_string += ":";
- hint_string += String::num_uint64(val);
+ r_hint_string += ":";
+ r_hint_string += String::num_uint64(val);
}
if (uses_default_values) {
// If we use the format NAME:VAL, that's what the editor displays.
// That's annoying if the user is not using custom values for the enum constants.
// This may not be needed in the future if the editor is changed to not display values.
- hint_string = name_only_hint_string;
+ r_hint_string = name_only_hint_string;
}
- } else if (variant_type == Variant::OBJECT && CACHED_CLASS(GodotReference)->is_assignable_from(type.type_class)) {
- GDMonoClass *field_native_class = GDMonoUtils::get_class_native_base(type.type_class);
+ } else if (p_variant_type == Variant::OBJECT && CACHED_CLASS(GodotResource)->is_assignable_from(p_type.type_class)) {
+ GDMonoClass *field_native_class = GDMonoUtils::get_class_native_base(p_type.type_class);
CRASH_COND(field_native_class == NULL);
- hint = PROPERTY_HINT_RESOURCE_TYPE;
- hint_string = NATIVE_GDMONOCLASS_NAME(field_native_class);
- } else if (variant_type == Variant::ARRAY && export_info.array.element_type != Variant::NIL) {
- hint = PROPERTY_HINT_TYPE_STRING;
- hint_string = itos(export_info.array.element_type) + ":";
- } else if (variant_type == Variant::DICTIONARY && export_info.dictionary.key_type != Variant::NIL && export_info.dictionary.value_type != Variant::NIL) {
- // TODO: There is no hint for this yet
+ r_hint = PROPERTY_HINT_RESOURCE_TYPE;
+ r_hint_string = NATIVE_GDMONOCLASS_NAME(field_native_class);
+ } else if (p_allow_generics && p_variant_type == Variant::ARRAY) {
+ // Nested arrays are not supported in the inspector
+
+ ManagedType elem_type;
+
+ if (!GDMonoMarshal::try_get_array_element_type(p_type, elem_type))
+ return 0;
+
+ Variant::Type elem_variant_type = GDMonoMarshal::managed_to_variant_type(elem_type);
+
+ PropertyHint elem_hint = PROPERTY_HINT_NONE;
+ String elem_hint_string;
+
+ if (elem_variant_type == Variant::NIL) {
+ ERR_EXPLAIN("Unknown array element type");
+ ERR_FAIL_V(-1);
+ }
+
+ int hint_res = _try_get_member_export_hint(p_member, elem_type, elem_variant_type, /* allow_generics: */ false, elem_hint, elem_hint_string);
+
+ if (hint_res == -1) {
+ ERR_EXPLAIN("Error while trying to determine information about the array element type");
+ ERR_FAIL_V(-1);
+ }
+
+ // Format: type/hint:hint_string
+ r_hint_string = itos(elem_variant_type) + "/" + itos(elem_hint) + ":" + elem_hint_string;
+ r_hint = PROPERTY_HINT_TYPE_STRING;
+
+ } else if (p_allow_generics && p_variant_type == Variant::DICTIONARY) {
+ // TODO: Dictionaries are not supported in the inspector
} else {
- hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr));
- hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr);
+ return 0;
}
- r_prop_info = PropertyInfo(variant_type, name.operator String(), hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE);
- r_exported = true;
-
- return true;
+ return 1;
}
#endif
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index fe4eed2e24..e735e0f741 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -127,7 +127,8 @@ class CSharpScript : public Script {
bool _update_exports();
#ifdef TOOLS_ENABLED
- bool _get_member_export(GDMonoClass *p_class, IMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported);
+ bool _get_member_export(IMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported);
+ static int _try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string);
#endif
CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error);
@@ -260,6 +261,8 @@ public:
virtual void notification(int p_notification);
void _call_notification(int p_notification);
+ virtual String to_string(bool *r_valid);
+
virtual Ref<Script> get_script() const;
virtual ScriptLanguage *get_language();
diff --git a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
index 967e3bcc19..e5044feb75 100644
--- a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
@@ -186,7 +186,7 @@ namespace GodotSharpTools.Build
private string BuildArguments(string loggerAssemblyPath, string loggerOutputDir, List<string> customProperties)
{
- string arguments = string.Format(@"""{0}"" /v:normal /t:Build ""/p:{1}"" ""/l:{2},{3};{4}""",
+ string arguments = string.Format(@"""{0}"" /v:normal /t:Rebuild ""/p:{1}"" ""/l:{2},{3};{4}""",
solution,
"Configuration=" + config,
typeof(GodotBuildLogger).FullName,
@@ -196,7 +196,7 @@ namespace GodotSharpTools.Build
foreach (string customProperty in customProperties)
{
- arguments += " \"/p:" + customProperty + "\"";
+ arguments += " /p:" + customProperty;
}
return arguments;
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
index 89279c69a6..f4ab11a222 100644
--- a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
@@ -80,7 +80,7 @@ namespace GodotSharpTools.Project
toolsGroup.AddProperty("DebugSymbols", "true");
toolsGroup.AddProperty("DebugType", "portable");
toolsGroup.AddProperty("Optimize", "false");
- toolsGroup.AddProperty("DefineConstants", "DEBUG;TOOLS;");
+ toolsGroup.AddProperty("DefineConstants", "$(GodotDefineConstants);GODOT;DEBUG;TOOLS;");
toolsGroup.AddProperty("ErrorReport", "prompt");
toolsGroup.AddProperty("WarningLevel", "4");
toolsGroup.AddProperty("ConsolePause", "false");
@@ -161,7 +161,7 @@ namespace GodotSharpTools.Project
debugGroup.AddProperty("DebugSymbols", "true");
debugGroup.AddProperty("DebugType", "portable");
debugGroup.AddProperty("Optimize", "false");
- debugGroup.AddProperty("DefineConstants", "DEBUG;");
+ debugGroup.AddProperty("DefineConstants", "$(GodotDefineConstants);GODOT;DEBUG;");
debugGroup.AddProperty("ErrorReport", "prompt");
debugGroup.AddProperty("WarningLevel", "4");
debugGroup.AddProperty("ConsolePause", "false");
@@ -170,6 +170,7 @@ namespace GodotSharpTools.Project
releaseGroup.Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ";
releaseGroup.AddProperty("DebugType", "portable");
releaseGroup.AddProperty("Optimize", "true");
+ releaseGroup.AddProperty("DefineConstants", "$(GodotDefineConstants);GODOT;");
releaseGroup.AddProperty("ErrorReport", "prompt");
releaseGroup.AddProperty("WarningLevel", "4");
releaseGroup.AddProperty("ConsolePause", "false");
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index a408716641..cd7774e7a1 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -2300,9 +2300,14 @@ void BindingsGenerator::_populate_object_type_interfaces() {
if (method_info.name.empty())
continue;
+ String cname = method_info.name;
+
+ if (blacklisted_methods.find(itype.cname) && blacklisted_methods[itype.cname].find(cname))
+ continue;
+
MethodInterface imethod;
imethod.name = method_info.name;
- imethod.cname = imethod.name;
+ imethod.cname = cname;
if (method_info.flags & METHOD_FLAG_VIRTUAL)
imethod.is_virtual = true;
@@ -2975,6 +2980,13 @@ void BindingsGenerator::_populate_global_constants() {
}
}
+void BindingsGenerator::_initialize_blacklisted_methods() {
+
+ blacklisted_methods["Object"].push_back("to_string"); // there is already ToString
+ blacklisted_methods["Object"].push_back("_to_string"); // override ToString instead
+ blacklisted_methods["Object"].push_back("_init"); // never called in C# (TODO: implement it)
+}
+
void BindingsGenerator::_log(const char *p_format, ...) {
if (log_print_enabled) {
@@ -2992,6 +3004,8 @@ void BindingsGenerator::_initialize() {
enum_types.clear();
+ _initialize_blacklisted_methods();
+
_populate_object_type_interfaces();
_populate_builtin_type_interfaces();
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index bdba28c267..ffc73a7e3e 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -491,6 +491,10 @@ class BindingsGenerator {
List<InternalCall> core_custom_icalls;
List<InternalCall> editor_custom_icalls;
+ Map<StringName, List<StringName> > blacklisted_methods;
+
+ void _initialize_blacklisted_methods();
+
struct NameCache {
StringName type_void;
StringName type_Array;
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index de3fd91223..9f132825fb 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -30,6 +30,7 @@
#include "godotsharp_builds.h"
+#include "core/os/os.h"
#include "core/vector.h"
#include "main/main.h"
@@ -351,7 +352,7 @@ bool GodotSharpBuilds::make_api_assembly(APIAssembly::Type p_api_type) {
return true;
}
-bool GodotSharpBuilds::build_project_blocking(const String &p_config) {
+bool GodotSharpBuilds::build_project_blocking(const String &p_config, const Vector<String> &p_godot_defines) {
if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path()))
return true; // No solution to build
@@ -366,6 +367,21 @@ bool GodotSharpBuilds::build_project_blocking(const String &p_config) {
pr.step("Building project solution", 0);
MonoBuildInfo build_info(GodotSharpDirs::get_project_sln_path(), p_config);
+
+ // Add Godot defines
+ String constants = "GodotDefineConstants=\"";
+
+ for (int i = 0; i < p_godot_defines.size(); i++) {
+ constants += "GODOT_" + p_godot_defines[i].to_upper().replace("-", "_").replace(" ", "_").replace(";", "_") + ";";
+ }
+
+#ifdef REAL_T_IS_DOUBLE
+ constants += "GODOT_REAL_T_IS_DOUBLE;";
+#endif
+
+ constants += "\"";
+ build_info.custom_props.push_back(constants);
+
if (!GodotSharpBuilds::get_singleton()->build(build_info)) {
GodotSharpBuilds::show_build_error_dialog("Failed to build project solution");
return false;
@@ -393,7 +409,10 @@ bool GodotSharpBuilds::editor_build_callback() {
ERR_FAIL_COND_V(copy_err != OK, false);
}
- return build_project_blocking("Tools");
+ Vector<String> godot_defines;
+ godot_defines.push_back(OS::get_singleton()->get_name());
+ godot_defines.push_back(sizeof(void *) == 4 ? "32" : "64");
+ return build_project_blocking("Tools", godot_defines);
}
GodotSharpBuilds *GodotSharpBuilds::singleton = NULL;
diff --git a/modules/mono/editor/godotsharp_builds.h b/modules/mono/editor/godotsharp_builds.h
index 652d30538a..2e9050e12e 100644
--- a/modules/mono/editor/godotsharp_builds.h
+++ b/modules/mono/editor/godotsharp_builds.h
@@ -92,7 +92,7 @@ public:
static bool make_api_assembly(APIAssembly::Type p_api_type);
- static bool build_project_blocking(const String &p_config);
+ static bool build_project_blocking(const String &p_config, const Vector<String> &p_godot_defines);
static bool editor_build_callback();
diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp
index ee5fed1a0c..ae5b939b26 100644
--- a/modules/mono/editor/godotsharp_export.cpp
+++ b/modules/mono/editor/godotsharp_export.cpp
@@ -94,7 +94,12 @@ void GodotSharpExport::_export_begin(const Set<String> &p_features, bool p_debug
ERR_FAIL_COND(!_add_file(scripts_metadata_path, scripts_metadata_path));
- ERR_FAIL_COND(!GodotSharpBuilds::build_project_blocking(build_config));
+ // Turn export features into defines
+ Vector<String> godot_defines;
+ for (Set<String>::Element *E = p_features.front(); E; E = E->next()) {
+ godot_defines.push_back(E->get());
+ }
+ ERR_FAIL_COND(!GodotSharpBuilds::build_project_blocking(build_config, godot_defines));
// Add dependency assemblies
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index 21ce9ca5c4..5d9e39b6c2 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -175,7 +175,10 @@ void MonoBottomPanel::_build_project_pressed() {
ERR_FAIL_COND(copy_err != OK);
}
- bool build_success = GodotSharpBuilds::get_singleton()->build_project_blocking("Tools");
+ Vector<String> godot_defines;
+ godot_defines.push_back(OS::get_singleton()->get_name());
+ godot_defines.push_back((sizeof(void *) == 4 ? "32" : "64"));
+ bool build_success = GodotSharpBuilds::get_singleton()->build_project_blocking("Tools", godot_defines);
if (build_success) {
// Notify running game for hot-reload
diff --git a/modules/mono/glue/Managed/Files/AABB.cs b/modules/mono/glue/Managed/Files/AABB.cs
index 33b2b46712..a2ebbc0736 100644
--- a/modules/mono/glue/Managed/Files/AABB.cs
+++ b/modules/mono/glue/Managed/Files/AABB.cs
@@ -414,6 +414,21 @@ namespace Godot
_position = position;
_size = size;
}
+ public AABB(Vector3 position, real_t width, real_t height, real_t depth)
+ {
+ _position = position;
+ _size = new Vector3(width, height, depth);
+ }
+ public AABB(real_t x, real_t y, real_t z, Vector3 size)
+ {
+ _position = new Vector3(x, y, z);
+ _size = size;
+ }
+ public AABB(real_t x, real_t y, real_t z, real_t width, real_t height, real_t depth)
+ {
+ _position = new Vector3(x, y, z);
+ _size = new Vector3(width, height, depth);
+ }
public static bool operator ==(AABB left, AABB right)
{
diff --git a/modules/mono/glue/Managed/Files/Basis.cs b/modules/mono/glue/Managed/Files/Basis.cs
index ac9576cebd..9cc31a0557 100644
--- a/modules/mono/glue/Managed/Files/Basis.cs
+++ b/modules/mono/glue/Managed/Files/Basis.cs
@@ -260,13 +260,13 @@ namespace Godot
Vector3 euler;
euler.z = 0.0f;
- real_t mxy = m.Row1[2];
+ real_t mzy = m.Row1[2];
- if (mxy < 1.0f)
+ if (mzy < 1.0f)
{
- if (mxy > -1.0f)
+ if (mzy > -1.0f)
{
- euler.x = Mathf.Asin(-mxy);
+ euler.x = Mathf.Asin(-mzy);
euler.y = Mathf.Atan2(m.Row0[2], m.Row2[2]);
euler.z = Mathf.Atan2(m.Row1[0], m.Row1[1]);
}
@@ -418,19 +418,11 @@ namespace Godot
public Basis Scaled(Vector3 scale)
{
- var m = this;
-
- m.Row0[0] *= scale.x;
- m.Row0[1] *= scale.x;
- m.Row0[2] *= scale.x;
- m.Row1[0] *= scale.y;
- m.Row1[1] *= scale.y;
- m.Row1[2] *= scale.y;
- m.Row2[0] *= scale.z;
- m.Row2[1] *= scale.z;
- m.Row2[2] *= scale.z;
-
- return m;
+ var b = this;
+ b.Row0 *= scale.x;
+ b.Row1 *= scale.y;
+ b.Row2 *= scale.z;
+ return b;
}
public real_t Tdotx(Vector3 with)
@@ -583,31 +575,29 @@ namespace Godot
public Basis(Vector3 axis, real_t phi)
{
- var axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
-
+ Vector3 axisSq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
real_t cosine = Mathf.Cos(phi);
+ Row0.x = axisSq.x + cosine * (1.0f - axisSq.x);
+ Row1.y = axisSq.y + cosine * (1.0f - axisSq.y);
+ Row2.z = axisSq.z + cosine * (1.0f - axisSq.z);
+
real_t sine = Mathf.Sin(phi);
+ real_t t = 1.0f - cosine;
- Row0 = new Vector3
- (
- axis_sq.x + cosine * (1.0f - axis_sq.x),
- axis.x * axis.y * (1.0f - cosine) - axis.z * sine,
- axis.z * axis.x * (1.0f - cosine) + axis.y * sine
- );
+ real_t xyzt = axis.x * axis.y * t;
+ real_t zyxs = axis.z * sine;
+ Row0.y = xyzt - zyxs;
+ Row1.x = xyzt + zyxs;
- Row1 = new Vector3
- (
- axis.x * axis.y * (1.0f - cosine) + axis.z * sine,
- axis_sq.y + cosine * (1.0f - axis_sq.y),
- axis.y * axis.z * (1.0f - cosine) - axis.x * sine
- );
+ xyzt = axis.x * axis.z * t;
+ zyxs = axis.y * sine;
+ Row0.z = xyzt + zyxs;
+ Row2.x = xyzt - zyxs;
- Row2 = new Vector3
- (
- axis.z * axis.x * (1.0f - cosine) - axis.y * sine,
- axis.y * axis.z * (1.0f - cosine) + axis.x * sine,
- axis_sq.z + cosine * (1.0f - axis_sq.z)
- );
+ xyzt = axis.y * axis.z * t;
+ zyxs = axis.x * sine;
+ Row1.z = xyzt - zyxs;
+ Row2.y = xyzt + zyxs;
}
public Basis(Vector3 column0, Vector3 column1, Vector3 column2)
@@ -622,11 +612,12 @@ namespace Godot
// We need to assign the struct fields here first so we can't do it that way...
}
- internal Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz)
+ // Arguments are named such that xy is equal to calling x.y
+ internal Basis(real_t xx, real_t yx, real_t zx, real_t xy, real_t yy, real_t zy, real_t xz, real_t yz, real_t zz)
{
- Row0 = new Vector3(xx, xy, xz);
- Row1 = new Vector3(yx, yy, yz);
- Row2 = new Vector3(zx, zy, zz);
+ Row0 = new Vector3(xx, yx, zx);
+ Row1 = new Vector3(xy, yy, zy);
+ Row2 = new Vector3(xz, yz, zz);
}
public static Basis operator *(Basis left, Basis right)
diff --git a/modules/mono/glue/Managed/Files/DynamicObject.cs b/modules/mono/glue/Managed/Files/DynamicObject.cs
index 9860feafdd..a0f105d55e 100644
--- a/modules/mono/glue/Managed/Files/DynamicObject.cs
+++ b/modules/mono/glue/Managed/Files/DynamicObject.cs
@@ -202,7 +202,7 @@ namespace Godot
//public override bool TryDeleteIndex(DeleteIndexBinder binder, object[] indexes);
//public override bool TryDeleteMember(DeleteMemberBinder binder);
- // Invokation on the object itself, e.g.: obj(param)
+ // Invocation on the object itself, e.g.: obj(param)
//public override bool TryInvoke(InvokeBinder binder, object[] args, out object result);
// No unnary operations to handle
diff --git a/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs b/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs
index 366d89b1c2..5023725f17 100644
--- a/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs
+++ b/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs
@@ -24,12 +24,12 @@ namespace Godot
public T GetOwner<T>() where T : class
{
- return (T)(object)GetOwner();
+ return (T)(object)Owner;
}
public T GetOwnerOrNull<T>() where T : class
{
- return GetOwner() as T;
+ return Owner as T;
}
public T GetParent<T>() where T : class
diff --git a/modules/mono/glue/Managed/Files/MarshalUtils.cs b/modules/mono/glue/Managed/Files/MarshalUtils.cs
index 7e72b0edb5..a1d63a62ef 100644
--- a/modules/mono/glue/Managed/Files/MarshalUtils.cs
+++ b/modules/mono/glue/Managed/Files/MarshalUtils.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections;
+using System.Collections.Generic;
namespace Godot
{
@@ -8,29 +9,151 @@ namespace Godot
static class MarshalUtils
{
+ /// <summary>
+ /// Returns <see langword="true"/> if the generic type definition of <paramref name="type"/>
+ /// is <see cref="Godot.Collections.Array{T}"/>; otherwise returns <see langword="false"/>.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">
+ /// <paramref name="type"/> is not a generic type. That is, IsGenericType returns false.
+ /// </exception>
static bool TypeIsGenericArray(Type type)
{
return type.GetGenericTypeDefinition() == typeof(Godot.Collections.Array<>);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the generic type definition of <paramref name="type"/>
+ /// is <see cref="Godot.Collections.Dictionary{TKey, TValue}"/>; otherwise returns <see langword="false"/>.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">
+ /// <paramref name="type"/> is not a generic type. That is, IsGenericType returns false.
+ /// </exception>
static bool TypeIsGenericDictionary(Type type)
{
return type.GetGenericTypeDefinition() == typeof(Godot.Collections.Dictionary<,>);
}
- static void ArrayGetElementType(Type type, out Type elementType)
+ static void ArrayGetElementType(Type arrayType, out Type elementType)
{
- elementType = type.GetGenericArguments()[0];
+ elementType = arrayType.GetGenericArguments()[0];
}
- static void DictionaryGetKeyValueTypes(Type type, out Type keyType, out Type valueType)
+ static void DictionaryGetKeyValueTypes(Type dictionaryType, out Type keyType, out Type valueType)
{
- var genericArgs = type.GetGenericArguments();
-
+ var genericArgs = dictionaryType.GetGenericArguments();
keyType = genericArgs[0];
valueType = genericArgs[1];
}
+ static bool GenericIEnumerableIsAssignableFromType(Type type)
+ {
+ if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IEnumerable<>))
+ return true;
+
+ foreach (var interfaceType in type.GetInterfaces())
+ {
+ if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
+ return true;
+ }
+
+ Type baseType = type.BaseType;
+
+ if (baseType == null)
+ return false;
+
+ return GenericIEnumerableIsAssignableFromType(baseType);
+ }
+
+ static bool GenericIDictionaryIsAssignableFromType(Type type)
+ {
+ if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary<,>))
+ return true;
+
+ foreach (var interfaceType in type.GetInterfaces())
+ {
+ if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IDictionary<,>))
+ return true;
+ }
+
+ Type baseType = type.BaseType;
+
+ if (baseType == null)
+ return false;
+
+ return GenericIDictionaryIsAssignableFromType(baseType);
+ }
+
+ static bool GenericIEnumerableIsAssignableFromType(Type type, out Type elementType)
+ {
+ if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IEnumerable<>))
+ {
+ elementType = type.GetGenericArguments()[0];
+ return true;
+ }
+
+ foreach (var interfaceType in type.GetInterfaces())
+ {
+ if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
+ {
+ elementType = interfaceType.GetGenericArguments()[0];
+ return true;
+ }
+ }
+
+ Type baseType = type.BaseType;
+
+ if (baseType == null)
+ {
+ elementType = null;
+ return false;
+ }
+
+ return GenericIEnumerableIsAssignableFromType(baseType, out elementType);
+ }
+
+ static bool GenericIDictionaryIsAssignableFromType(Type type, out Type keyType, out Type valueType)
+ {
+ if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary<,>))
+ {
+ var genericArgs = type.GetGenericArguments();
+ keyType = genericArgs[0];
+ valueType = genericArgs[1];
+ return true;
+ }
+
+ foreach (var interfaceType in type.GetInterfaces())
+ {
+ if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IDictionary<,>))
+ {
+ var genericArgs = interfaceType.GetGenericArguments();
+ keyType = genericArgs[0];
+ valueType = genericArgs[1];
+ return true;
+ }
+ }
+
+ Type baseType = type.BaseType;
+
+ if (baseType == null)
+ {
+ keyType = null;
+ valueType = null;
+ return false;
+ }
+
+ return GenericIDictionaryIsAssignableFromType(baseType, out keyType, out valueType);
+ }
+
+ static Type MakeGenericArrayType(Type elemType)
+ {
+ return typeof(Godot.Collections.Array<>).MakeGenericType(elemType);
+ }
+
+ static Type MakeGenericDictionaryType(Type keyType, Type valueType)
+ {
+ return typeof(Godot.Collections.Dictionary<,>).MakeGenericType(keyType, valueType);
+ }
+
// TODO Add support for IEnumerable<T> and IDictionary<TKey, TValue>
// TODO: EnumerableToArray and IDictionaryToDictionary can be optimized
@@ -64,5 +187,26 @@ namespace Godot
Dictionary.godot_icall_Dictionary_Add(godotDictionaryPtr, entry.Key, entry.Value);
}
}
+
+ internal static void GenericIDictionaryToDictionary(object dictionary, IntPtr godotDictionaryPtr)
+ {
+#if DEBUG
+ if (!GenericIDictionaryIsAssignableFromType(dictionary.GetType()))
+ throw new InvalidOperationException("The type does not implement IDictionary<,>");
+#endif
+
+ // TODO: Can we optimize this?
+
+ var keys = ((IEnumerable)dictionary.GetType().GetProperty("Keys").GetValue(dictionary)).GetEnumerator();
+ var values = ((IEnumerable)dictionary.GetType().GetProperty("Values").GetValue(dictionary)).GetEnumerator();
+
+ while (keys.MoveNext() && values.MoveNext())
+ {
+ object key = keys.Current;
+ object value = values.Current;
+
+ Dictionary.godot_icall_Dictionary_Add(godotDictionaryPtr, key, value);
+ }
+ }
}
}
diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs
index 947fbb6665..8fb8730b88 100644
--- a/modules/mono/glue/Managed/Files/Mathf.cs
+++ b/modules/mono/glue/Managed/Files/Mathf.cs
@@ -44,9 +44,9 @@ namespace Godot
return (real_t)Math.Atan(s);
}
- public static real_t Atan2(real_t x, real_t y)
+ public static real_t Atan2(real_t y, real_t x)
{
- return (real_t)Math.Atan2(x, y);
+ return (real_t)Math.Atan2(y, x);
}
public static Vector2 Cartesian2Polar(real_t x, real_t y)
@@ -79,14 +79,27 @@ namespace Godot
return (real_t)Math.Cosh(s);
}
- public static int Decimals(real_t step)
- {
- return Decimals((decimal)step);
- }
-
- public static int Decimals(decimal step)
- {
- return BitConverter.GetBytes(decimal.GetBits(step)[3])[2];
+ public static int StepDecimals(real_t step)
+ {
+ double[] sd = new double[] {
+ 0.9999,
+ 0.09999,
+ 0.009999,
+ 0.0009999,
+ 0.00009999,
+ 0.000009999,
+ 0.0000009999,
+ 0.00000009999,
+ 0.000000009999,
+ };
+ double abs = Mathf.Abs(step);
+ double decs = abs - (int)abs; // Strip away integer part
+ for (int i = 0; i < sd.Length; i++) {
+ if (decs >= sd[i]) {
+ return i;
+ }
+ }
+ return 0;
}
public static real_t Deg2Rad(real_t deg)
diff --git a/modules/mono/glue/Managed/Files/MathfEx.cs b/modules/mono/glue/Managed/Files/MathfEx.cs
index d6eb65b097..b96f01bc2e 100644
--- a/modules/mono/glue/Managed/Files/MathfEx.cs
+++ b/modules/mono/glue/Managed/Files/MathfEx.cs
@@ -21,6 +21,16 @@ namespace Godot
public const real_t Epsilon = 1e-06f;
#endif
+ public static int DecimalCount(real_t s)
+ {
+ return DecimalCount((decimal)s);
+ }
+
+ public static int DecimalCount(decimal s)
+ {
+ return BitConverter.GetBytes(decimal.GetBits(s)[3])[2];
+ }
+
public static int CeilToInt(real_t s)
{
return (int)Math.Ceiling(s);
diff --git a/modules/mono/glue/Managed/Files/Transform2D.cs b/modules/mono/glue/Managed/Files/Transform2D.cs
index f7bb41d523..33ff286769 100644
--- a/modules/mono/glue/Managed/Files/Transform2D.cs
+++ b/modules/mono/glue/Managed/Files/Transform2D.cs
@@ -298,6 +298,7 @@ namespace Godot
origin = originPos;
}
+ // Arguments are named such that xy is equal to calling x.y
public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
{
x = new Vector2(xx, xy);
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Node.cs b/modules/mono/glue/Managed/IgnoredFiles/Node.cs
index 99ba0f827a..cff61b1e0b 100644
--- a/modules/mono/glue/Managed/IgnoredFiles/Node.cs
+++ b/modules/mono/glue/Managed/IgnoredFiles/Node.cs
@@ -15,9 +15,10 @@ namespace Godot
throw new NotImplementedException();
}
- public Node GetOwner()
+ public Node Owner
{
- throw new NotImplementedException();
+ get => throw new NotImplementedException();
+ set => throw new NotImplementedException();
}
public Node GetParent()
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index 4aef5684fd..47239f1260 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -162,7 +162,7 @@ MonoObject *godot_icall_Dictionary_GetValue(Dictionary *ptr, MonoObject *key) {
#ifdef DEBUG_ENABLED
CRASH_COND(!exc);
#endif
- GDMonoUtils::runtime_object_init(exc);
+ GDMonoUtils::runtime_object_init(exc, CACHED_CLASS(KeyNotFoundException));
GDMonoUtils::set_pending_exception((MonoException *)exc);
return NULL;
}
@@ -176,7 +176,7 @@ MonoObject *godot_icall_Dictionary_GetValue_Generic(Dictionary *ptr, MonoObject
#ifdef DEBUG_ENABLED
CRASH_COND(!exc);
#endif
- GDMonoUtils::runtime_object_init(exc);
+ GDMonoUtils::runtime_object_init(exc, CACHED_CLASS(KeyNotFoundException));
GDMonoUtils::set_pending_exception((MonoException *)exc);
return NULL;
}
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 9779797d1a..2e79f87625 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -313,12 +313,32 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
break;
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, type_class->get_mono_type());
+
+ MonoReflectionType *key_reftype, *value_reftype;
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype, &key_reftype, &value_reftype)) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Dictionary(),
+ GDMonoUtils::Marshal::make_generic_dictionary_type(key_reftype, value_reftype));
+ mono_field_set_value(p_object, mono_field, managed);
+ break;
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Dictionary(), CACHED_CLASS(Dictionary));
mono_field_set_value(p_object, mono_field, managed);
break;
}
+ MonoReflectionType *elem_reftype;
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype, &elem_reftype)) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(),
+ GDMonoUtils::Marshal::make_generic_array_type(elem_reftype));
+ mono_field_set_value(p_object, mono_field, managed);
+ break;
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), CACHED_CLASS(Array));
mono_field_set_value(p_object, mono_field, managed);
@@ -432,26 +452,24 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
case MONO_TYPE_GENERICINST: {
MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, type.type_class->get_mono_type());
- MonoException *exc = NULL;
-
- GDMonoUtils::TypeIsGenericDictionary type_is_dict = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericDictionary);
- MonoBoolean is_dict = invoke_method_thunk(type_is_dict, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_dict) {
+ if (GDMonoUtils::Marshal::type_is_generic_dictionary(reftype)) {
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Dictionary(), type.type_class);
mono_field_set_value(p_object, mono_field, managed);
break;
}
- exc = NULL;
+ if (GDMonoUtils::Marshal::type_is_generic_array(reftype)) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), type.type_class);
+ mono_field_set_value(p_object, mono_field, managed);
+ break;
+ }
- GDMonoUtils::TypeIsGenericArray type_is_array = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericArray);
- MonoBoolean is_array = invoke_method_thunk(type_is_array, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
- if (is_array) {
- MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), type.type_class);
+ MonoReflectionType *key_reftype, *value_reftype;
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype, &key_reftype, &value_reftype)) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Dictionary(),
+ GDMonoUtils::Marshal::make_generic_dictionary_type(key_reftype, value_reftype));
mono_field_set_value(p_object, mono_field, managed);
break;
}
@@ -462,6 +480,14 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
break;
}
+ MonoReflectionType *elem_reftype;
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype, &elem_reftype)) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(),
+ GDMonoUtils::Marshal::make_generic_array_type(elem_reftype));
+ mono_field_set_value(p_object, mono_field, managed);
+ break;
+ }
+
if (type.type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), CACHED_CLASS(Array));
mono_field_set_value(p_object, mono_field, managed);
diff --git a/modules/mono/mono_gd/gd_mono_field.h b/modules/mono/mono_gd/gd_mono_field.h
index e348583370..a7727ddf34 100644
--- a/modules/mono/mono_gd/gd_mono_field.h
+++ b/modules/mono/mono_gd/gd_mono_field.h
@@ -47,9 +47,11 @@ class GDMonoField : public IMonoClassMember {
MonoCustomAttrInfo *attributes;
public:
- virtual MemberType get_member_type() GD_FINAL { return MEMBER_TYPE_FIELD; }
+ virtual GDMonoClass *get_enclosing_class() const GD_FINAL { return owner; }
- virtual StringName get_name() GD_FINAL { return name; }
+ virtual MemberType get_member_type() const GD_FINAL { return MEMBER_TYPE_FIELD; }
+
+ virtual StringName get_name() const GD_FINAL { return name; }
virtual bool is_static() GD_FINAL;
virtual Visibility get_visibility() GD_FINAL;
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index de4f3650bd..c462b8f71d 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -35,7 +35,7 @@
namespace GDMonoMarshal {
-Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_export_info) {
+Variant::Type managed_to_variant_type(const ManagedType &p_type) {
switch (p_type.type_encoding) {
case MONO_TYPE_BOOLEAN:
return Variant::BOOL;
@@ -157,10 +157,22 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_e
return Variant::ARRAY;
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, type_class->get_mono_type());
+
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype)) {
+ return Variant::DICTIONARY;
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
return Variant::DICTIONARY;
}
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype)) {
+ return Variant::ARRAY;
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
return Variant::ARRAY;
}
@@ -169,52 +181,26 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_e
case MONO_TYPE_GENERICINST: {
MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, p_type.type_class->get_mono_type());
- MonoException *exc = NULL;
- GDMonoUtils::TypeIsGenericDictionary type_is_dict = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericDictionary);
- MonoBoolean is_dict = invoke_method_thunk(type_is_dict, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_dict) {
- if (r_export_info) {
- MonoReflectionType *key_reftype;
- MonoReflectionType *value_reftype;
-
- exc = NULL;
- invoke_method_thunk(CACHED_METHOD_THUNK(MarshalUtils, DictionaryGetKeyValueTypes),
- reftype, &key_reftype, &value_reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- r_export_info->dictionary.key_type = managed_to_variant_type(ManagedType::from_reftype(key_reftype));
- r_export_info->dictionary.value_type = managed_to_variant_type(ManagedType::from_reftype(value_reftype));
- }
-
+ if (GDMonoUtils::Marshal::type_is_generic_dictionary(reftype)) {
return Variant::DICTIONARY;
}
- exc = NULL;
- GDMonoUtils::TypeIsGenericArray type_is_array = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericArray);
- MonoBoolean is_array = invoke_method_thunk(type_is_array, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_array) {
- if (r_export_info) {
- MonoReflectionType *elem_reftype;
-
- exc = NULL;
- invoke_method_thunk(CACHED_METHOD_THUNK(MarshalUtils, ArrayGetElementType),
- reftype, &elem_reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- r_export_info->array.element_type = managed_to_variant_type(ManagedType::from_reftype(elem_reftype));
- }
-
+ if (GDMonoUtils::Marshal::type_is_generic_array(reftype)) {
return Variant::ARRAY;
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype))
+ return Variant::DICTIONARY;
+
if (p_type.type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
return Variant::DICTIONARY;
}
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype))
+ return Variant::ARRAY;
+
if (p_type.type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
return Variant::ARRAY;
}
@@ -228,6 +214,63 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_e
return Variant::NIL;
}
+bool try_get_array_element_type(const ManagedType &p_array_type, ManagedType &r_elem_type) {
+ switch (p_array_type.type_encoding) {
+ case MONO_TYPE_GENERICINST: {
+ MonoReflectionType *array_reftype = mono_type_get_object(SCRIPTS_DOMAIN, p_array_type.type_class->get_mono_type());
+
+ if (GDMonoUtils::Marshal::type_is_generic_array(array_reftype)) {
+ MonoReflectionType *elem_reftype;
+
+ GDMonoUtils::Marshal::array_get_element_type(array_reftype, &elem_reftype);
+
+ r_elem_type = ManagedType::from_reftype(elem_reftype);
+ return true;
+ }
+
+ MonoReflectionType *elem_reftype;
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(array_reftype, &elem_reftype)) {
+ r_elem_type = ManagedType::from_reftype(elem_reftype);
+ return true;
+ }
+ } break;
+ default: {
+ } break;
+ }
+
+ return false;
+}
+
+bool try_get_dictionary_key_value_types(const ManagedType &p_dictionary_type, ManagedType &r_key_type, ManagedType &r_value_type) {
+ switch (p_dictionary_type.type_encoding) {
+ case MONO_TYPE_GENERICINST: {
+ MonoReflectionType *dict_reftype = mono_type_get_object(SCRIPTS_DOMAIN, p_dictionary_type.type_class->get_mono_type());
+
+ if (GDMonoUtils::Marshal::type_is_generic_dictionary(dict_reftype)) {
+ MonoReflectionType *key_reftype;
+ MonoReflectionType *value_reftype;
+
+ GDMonoUtils::Marshal::dictionary_get_key_value_types(dict_reftype, &key_reftype, &value_reftype);
+
+ r_key_type = ManagedType::from_reftype(key_reftype);
+ r_value_type = ManagedType::from_reftype(value_reftype);
+ return true;
+ }
+
+ MonoReflectionType *key_reftype, *value_reftype;
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(dict_reftype, &key_reftype, &value_reftype)) {
+ r_key_type = ManagedType::from_reftype(key_reftype);
+ r_value_type = ManagedType::from_reftype(value_reftype);
+ return true;
+ }
+ } break;
+ default: {
+ } break;
+ }
+
+ return false;
+}
+
String mono_to_utf8_string(MonoString *p_mono_string) {
MonoError error;
char *utf8 = mono_string_to_utf8_checked(p_mono_string, &error);
@@ -494,10 +537,26 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array));
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, type_class->get_mono_type());
+
+ MonoReflectionType *key_reftype, *value_reftype;
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype, &key_reftype, &value_reftype)) {
+ return GDMonoUtils::create_managed_from(p_var->operator Dictionary(),
+ GDMonoUtils::Marshal::make_generic_dictionary_type(key_reftype, value_reftype));
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
return GDMonoUtils::create_managed_from(p_var->operator Dictionary(), CACHED_CLASS(Dictionary));
}
+ MonoReflectionType *elem_reftype;
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype, &elem_reftype)) {
+ return GDMonoUtils::create_managed_from(p_var->operator Array(),
+ GDMonoUtils::Marshal::make_generic_array_type(elem_reftype));
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array));
}
@@ -595,28 +654,32 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
case MONO_TYPE_GENERICINST: {
MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, p_type.type_class->get_mono_type());
- MonoException *exc = NULL;
- GDMonoUtils::TypeIsGenericDictionary type_is_dict = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericDictionary);
- MonoBoolean is_dict = invoke_method_thunk(type_is_dict, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_dict) {
+ if (GDMonoUtils::Marshal::type_is_generic_dictionary(reftype)) {
return GDMonoUtils::create_managed_from(p_var->operator Dictionary(), p_type.type_class);
}
- exc = NULL;
- GDMonoUtils::TypeIsGenericArray type_is_array = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericArray);
- MonoBoolean is_array = invoke_method_thunk(type_is_array, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_array) {
+ if (GDMonoUtils::Marshal::type_is_generic_array(reftype)) {
return GDMonoUtils::create_managed_from(p_var->operator Array(), p_type.type_class);
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ MonoReflectionType *key_reftype, *value_reftype;
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype, &key_reftype, &value_reftype)) {
+ return GDMonoUtils::create_managed_from(p_var->operator Dictionary(),
+ GDMonoUtils::Marshal::make_generic_dictionary_type(key_reftype, value_reftype));
+ }
+
if (p_type.type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
return GDMonoUtils::create_managed_from(p_var->operator Dictionary(), CACHED_CLASS(Dictionary));
}
+ MonoReflectionType *elem_reftype;
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype, &elem_reftype)) {
+ return GDMonoUtils::create_managed_from(p_var->operator Array(),
+ GDMonoUtils::Marshal::make_generic_array_type(elem_reftype));
+ }
+
if (p_type.type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array));
}
@@ -779,66 +842,60 @@ Variant mono_object_to_variant(MonoObject *p_obj) {
return ptr ? Variant(*ptr) : Variant();
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, type_class->get_mono_type());
+
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype)) {
+ return GDMonoUtils::Marshal::generic_idictionary_to_dictionary(p_obj);
+ }
+
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
- Dictionary dict;
- MonoException *exc = NULL;
- invoke_method_thunk(CACHED_METHOD_THUNK(MarshalUtils, IDictionaryToDictionary), p_obj, &dict, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
- return dict;
+ return GDMonoUtils::Marshal::idictionary_to_dictionary(p_obj);
+ }
+
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype)) {
+ return GDMonoUtils::Marshal::enumerable_to_array(p_obj);
}
if (type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
- Array array;
- MonoException *exc = NULL;
- invoke_method_thunk(CACHED_METHOD_THUNK(MarshalUtils, EnumerableToArray), p_obj, &array, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
- return array;
+ return GDMonoUtils::Marshal::enumerable_to_array(p_obj);
}
} break;
case MONO_TYPE_GENERICINST: {
MonoReflectionType *reftype = mono_type_get_object(SCRIPTS_DOMAIN, type.type_class->get_mono_type());
- MonoException *exc = NULL;
-
- GDMonoUtils::TypeIsGenericDictionary type_is_dict = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericDictionary);
- MonoBoolean is_dict = invoke_method_thunk(type_is_dict, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_dict) {
- exc = NULL;
+ if (GDMonoUtils::Marshal::type_is_generic_dictionary(reftype)) {
+ MonoException *exc = NULL;
MonoObject *ret = type.type_class->get_method("GetPtr")->invoke(p_obj, &exc);
UNLIKELY_UNHANDLED_EXCEPTION(exc);
return *unbox<Dictionary *>(ret);
}
- exc = NULL;
-
- GDMonoUtils::TypeIsGenericArray type_is_array = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericArray);
- MonoBoolean is_array = invoke_method_thunk(type_is_array, reftype, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
-
- if (is_array) {
- exc = NULL;
+ if (GDMonoUtils::Marshal::type_is_generic_array(reftype)) {
+ MonoException *exc = NULL;
MonoObject *ret = type.type_class->get_method("GetPtr")->invoke(p_obj, &exc);
UNLIKELY_UNHANDLED_EXCEPTION(exc);
return *unbox<Array *>(ret);
}
+ // The order in which we check the following interfaces is very important (dictionaries and generics first)
+
+ if (GDMonoUtils::Marshal::generic_idictionary_is_assignable_from(reftype)) {
+ return GDMonoUtils::Marshal::generic_idictionary_to_dictionary(p_obj);
+ }
+
if (type.type_class->implements_interface(CACHED_CLASS(System_Collections_IDictionary))) {
- Dictionary dict;
- exc = NULL;
- invoke_method_thunk(CACHED_METHOD_THUNK(MarshalUtils, IDictionaryToDictionary), p_obj, &dict, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
- return dict;
+ return GDMonoUtils::Marshal::idictionary_to_dictionary(p_obj);
+ }
+
+ if (GDMonoUtils::Marshal::generic_ienumerable_is_assignable_from(reftype)) {
+ return GDMonoUtils::Marshal::enumerable_to_array(p_obj);
}
if (type.type_class->implements_interface(CACHED_CLASS(System_Collections_IEnumerable))) {
- Array array;
- exc = NULL;
- invoke_method_thunk(CACHED_METHOD_THUNK(MarshalUtils, EnumerableToArray), p_obj, &array, &exc);
- UNLIKELY_UNHANDLED_EXCEPTION(exc);
- return array;
+ return GDMonoUtils::Marshal::enumerable_to_array(p_obj);
}
} break;
}
@@ -1067,4 +1124,5 @@ PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array) {
return ret;
}
+
} // namespace GDMonoMarshal
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 4a73f9e3e6..3fa958ac32 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -57,25 +57,10 @@ T unbox(MonoObject *p_obj) {
#define BOX_PTR(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(IntPtr), x)
#define BOX_ENUM(m_enum_class, x) mono_value_box(mono_domain_get(), m_enum_class, &x)
-// FIXME: Made this struct in a hurry. It could be done differently.
-struct ExportInfo {
- struct ArrayInfo {
- Variant::Type element_type;
-
- ArrayInfo() :
- element_type(Variant::NIL) {}
- } array;
- struct DictionaryInfo {
- Variant::Type key_type;
- Variant::Type value_type;
-
- DictionaryInfo() :
- key_type(Variant::NIL),
- value_type(Variant::NIL) {}
- } dictionary;
-};
+Variant::Type managed_to_variant_type(const ManagedType &p_type);
-Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_export_info = NULL);
+bool try_get_array_element_type(const ManagedType &p_array_type, ManagedType &r_elem_type);
+bool try_get_dictionary_key_value_types(const ManagedType &p_dictionary_type, ManagedType &r_key_type, ManagedType &r_value_type);
// String
diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp
index 7f11e4671d..f290c6c8ac 100644
--- a/modules/mono/mono_gd/gd_mono_method.cpp
+++ b/modules/mono/mono_gd/gd_mono_method.cpp
@@ -74,6 +74,10 @@ void GDMonoMethod::_update_signature(MonoMethodSignature *p_method_sig) {
method_info = MethodInfo();
}
+GDMonoClass *GDMonoMethod::get_enclosing_class() const {
+ return GDMono::get_singleton()->get_class(mono_method_get_class(mono_method));
+}
+
bool GDMonoMethod::is_static() {
return mono_method_get_flags(mono_method, NULL) & MONO_METHOD_ATTR_STATIC;
}
diff --git a/modules/mono/mono_gd/gd_mono_method.h b/modules/mono/mono_gd/gd_mono_method.h
index f74cef438d..2fc8628f27 100644
--- a/modules/mono/mono_gd/gd_mono_method.h
+++ b/modules/mono/mono_gd/gd_mono_method.h
@@ -57,9 +57,11 @@ class GDMonoMethod : public IMonoClassMember {
MonoMethod *mono_method;
public:
- virtual MemberType get_member_type() GD_FINAL { return MEMBER_TYPE_METHOD; }
+ virtual GDMonoClass *get_enclosing_class() const GD_FINAL;
- virtual StringName get_name() GD_FINAL { return name; }
+ virtual MemberType get_member_type() const GD_FINAL { return MEMBER_TYPE_METHOD; }
+
+ virtual StringName get_name() const GD_FINAL { return name; }
virtual bool is_static() GD_FINAL;
diff --git a/modules/mono/mono_gd/gd_mono_property.h b/modules/mono/mono_gd/gd_mono_property.h
index 2700c460b0..d6efa60412 100644
--- a/modules/mono/mono_gd/gd_mono_property.h
+++ b/modules/mono/mono_gd/gd_mono_property.h
@@ -47,9 +47,11 @@ class GDMonoProperty : public IMonoClassMember {
MonoCustomAttrInfo *attributes;
public:
- virtual MemberType get_member_type() GD_FINAL { return MEMBER_TYPE_PROPERTY; }
+ virtual GDMonoClass *get_enclosing_class() const GD_FINAL { return owner; }
- virtual StringName get_name() GD_FINAL { return name; }
+ virtual MemberType get_member_type() const GD_FINAL { return MEMBER_TYPE_PROPERTY; }
+
+ virtual StringName get_name() const GD_FINAL { return name; }
virtual bool is_static() GD_FINAL;
virtual Visibility get_visibility() GD_FINAL;
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index bcf5712d16..413c8cba85 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -109,7 +109,7 @@ void MonoCache::clear_members() {
class_NodePath = NULL;
class_RID = NULL;
class_GodotObject = NULL;
- class_GodotReference = NULL;
+ class_GodotResource = NULL;
class_Node = NULL;
class_Control = NULL;
class_Spatial = NULL;
@@ -151,12 +151,27 @@ void MonoCache::clear_members() {
methodthunk_SignalAwaiter_FailureCallback = NULL;
methodthunk_GodotTaskScheduler_Activate = NULL;
+ // Start of MarshalUtils methods
+
methodthunk_MarshalUtils_TypeIsGenericArray = NULL;
methodthunk_MarshalUtils_TypeIsGenericDictionary = NULL;
+
methodthunk_MarshalUtils_ArrayGetElementType = NULL;
methodthunk_MarshalUtils_DictionaryGetKeyValueTypes = NULL;
+
+ methodthunk_MarshalUtils_GenericIEnumerableIsAssignableFromType = NULL;
+ methodthunk_MarshalUtils_GenericIDictionaryIsAssignableFromType = NULL;
+ methodthunk_MarshalUtils_GenericIEnumerableIsAssignableFromType_with_info = NULL;
+ methodthunk_MarshalUtils_GenericIDictionaryIsAssignableFromType_with_info = NULL;
+
+ methodthunk_MarshalUtils_MakeGenericArrayType = NULL;
+ methodthunk_MarshalUtils_MakeGenericDictionaryType = NULL;
+
methodthunk_MarshalUtils_EnumerableToArray = NULL;
methodthunk_MarshalUtils_IDictionaryToDictionary = NULL;
+ methodthunk_MarshalUtils_GenericIDictionaryToDictionary = NULL;
+
+ // End of MarshalUtils methods
task_scheduler_handle = Ref<MonoGCHandle>();
}
@@ -217,7 +232,7 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath));
CACHE_CLASS_AND_CHECK(RID, GODOT_API_CLASS(RID));
CACHE_CLASS_AND_CHECK(GodotObject, GODOT_API_CLASS(Object));
- CACHE_CLASS_AND_CHECK(GodotReference, GODOT_API_CLASS(Reference));
+ CACHE_CLASS_AND_CHECK(GodotResource, GODOT_API_CLASS(Resource));
CACHE_CLASS_AND_CHECK(Node, GODOT_API_CLASS(Node));
CACHE_CLASS_AND_CHECK(Control, GODOT_API_CLASS(Control));
CACHE_CLASS_AND_CHECK(Spatial, GODOT_API_CLASS(Spatial));
@@ -258,12 +273,30 @@ void update_godot_api_cache() {
CACHE_METHOD_THUNK_AND_CHECK(SignalAwaiter, FailureCallback, (SignalAwaiter_FailureCallback)GODOT_API_CLASS(SignalAwaiter)->get_method_thunk("FailureCallback", 0));
CACHE_METHOD_THUNK_AND_CHECK(GodotTaskScheduler, Activate, (GodotTaskScheduler_Activate)GODOT_API_CLASS(GodotTaskScheduler)->get_method_thunk("Activate", 0));
+ // Start of MarshalUtils methods
+
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericArray, (TypeIsGenericArray)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("TypeIsGenericArray", 1));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericDictionary, (TypeIsGenericDictionary)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("TypeIsGenericDictionary", 1));
+
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, ArrayGetElementType, (ArrayGetElementType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("ArrayGetElementType", 2));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, DictionaryGetKeyValueTypes, (DictionaryGetKeyValueTypes)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("DictionaryGetKeyValueTypes", 3));
+
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, ArrayGetElementType, (ArrayGetElementType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("ArrayGetElementType", 2));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, DictionaryGetKeyValueTypes, (DictionaryGetKeyValueTypes)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("DictionaryGetKeyValueTypes", 3));
+
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GenericIEnumerableIsAssignableFromType, (GenericIEnumerableIsAssignableFromType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("GenericIEnumerableIsAssignableFromType", 1));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GenericIDictionaryIsAssignableFromType, (GenericIDictionaryIsAssignableFromType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("GenericIDictionaryIsAssignableFromType", 1));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GenericIEnumerableIsAssignableFromType_with_info, (GenericIEnumerableIsAssignableFromType_with_info)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("GenericIEnumerableIsAssignableFromType", 2));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GenericIEnumerableIsAssignableFromType_with_info, (GenericIEnumerableIsAssignableFromType_with_info)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("GenericIDictionaryIsAssignableFromType", 3));
+
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, MakeGenericArrayType, (MakeGenericArrayType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("MakeGenericArrayType", 1));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, MakeGenericDictionaryType, (MakeGenericDictionaryType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("MakeGenericDictionaryType", 2));
+
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, EnumerableToArray, (EnumerableToArray)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("EnumerableToArray", 2));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, IDictionaryToDictionary, (IDictionaryToDictionary)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("IDictionaryToDictionary", 2));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GenericIDictionaryToDictionary, (GenericIDictionaryToDictionary)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("GenericIDictionaryToDictionary", 2));
+
+ // End of MarshalUtils methods
#ifdef DEBUG_ENABLED
CACHE_METHOD_THUNK_AND_CHECK(DebuggingUtils, GetStackFrameInfo, (DebugUtils_StackFrameInfo)GODOT_API_CLASS(DebuggingUtils)->get_method_thunk("GetStackFrameInfo", 4));
@@ -271,7 +304,7 @@ void update_godot_api_cache() {
// TODO Move to CSharpLanguage::init() and do handle disposal
MonoObject *task_scheduler = mono_object_new(SCRIPTS_DOMAIN, GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr());
- GDMonoUtils::runtime_object_init(task_scheduler);
+ GDMonoUtils::runtime_object_init(task_scheduler, GODOT_API_CLASS(GodotTaskScheduler));
mono_cache.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
mono_cache.godot_api_cache_updated = true;
@@ -372,11 +405,10 @@ MonoThread *get_current_thread() {
return mono_thread_current();
}
-void runtime_object_init(MonoObject *p_this_obj) {
- GD_MONO_BEGIN_RUNTIME_INVOKE;
- // FIXME: Do not use mono_runtime_object_init, it aborts if an exception is thrown
- mono_runtime_object_init(p_this_obj);
- GD_MONO_END_RUNTIME_INVOKE;
+void runtime_object_init(MonoObject *p_this_obj, GDMonoClass *p_class, MonoException **r_exc) {
+ GDMonoMethod *ctor = p_class->get_method(".ctor", 0);
+ ERR_FAIL_NULL(ctor);
+ ctor->invoke_raw(p_this_obj, NULL, r_exc);
}
GDMonoClass *get_object_class(MonoObject *p_object) {
@@ -438,7 +470,7 @@ MonoObject *create_managed_for_godot_object(GDMonoClass *p_class, const StringNa
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, p_object);
// Construct
- GDMonoUtils::runtime_object_init(mono_object);
+ GDMonoUtils::runtime_object_init(mono_object, p_class);
return mono_object;
}
@@ -448,7 +480,7 @@ MonoObject *create_managed_from(const NodePath &p_from) {
ERR_FAIL_NULL_V(mono_object, NULL);
// Construct
- GDMonoUtils::runtime_object_init(mono_object);
+ GDMonoUtils::runtime_object_init(mono_object, CACHED_CLASS(NodePath));
CACHED_FIELD(NodePath, ptr)->set_value_raw(mono_object, memnew(NodePath(p_from)));
@@ -460,7 +492,7 @@ MonoObject *create_managed_from(const RID &p_from) {
ERR_FAIL_NULL_V(mono_object, NULL);
// Construct
- GDMonoUtils::runtime_object_init(mono_object);
+ GDMonoUtils::runtime_object_init(mono_object, CACHED_CLASS(RID));
CACHED_FIELD(RID, ptr)->set_value_raw(mono_object, memnew(RID(p_from)));
@@ -727,4 +759,115 @@ void dispose(MonoObject *p_mono_object, MonoException **r_exc) {
invoke_method_thunk(CACHED_METHOD_THUNK(GodotObject, Dispose), p_mono_object, r_exc);
}
+namespace Marshal {
+
+MonoBoolean type_is_generic_array(MonoReflectionType *p_reftype) {
+ TypeIsGenericArray thunk = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericArray);
+ MonoException *exc = NULL;
+ MonoBoolean res = invoke_method_thunk(thunk, p_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return res;
+}
+
+MonoBoolean type_is_generic_dictionary(MonoReflectionType *p_reftype) {
+ TypeIsGenericDictionary thunk = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericDictionary);
+ MonoException *exc = NULL;
+ MonoBoolean res = invoke_method_thunk(thunk, p_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return res;
+}
+
+void array_get_element_type(MonoReflectionType *p_array_reftype, MonoReflectionType **r_elem_reftype) {
+ ArrayGetElementType thunk = CACHED_METHOD_THUNK(MarshalUtils, ArrayGetElementType);
+ MonoException *exc = NULL;
+ invoke_method_thunk(thunk, p_array_reftype, r_elem_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+}
+
+void dictionary_get_key_value_types(MonoReflectionType *p_dict_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype) {
+ DictionaryGetKeyValueTypes thunk = CACHED_METHOD_THUNK(MarshalUtils, DictionaryGetKeyValueTypes);
+ MonoException *exc = NULL;
+ invoke_method_thunk(thunk, p_dict_reftype, r_key_reftype, r_value_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+}
+
+MonoBoolean generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype) {
+ GenericIEnumerableIsAssignableFromType thunk = CACHED_METHOD_THUNK(MarshalUtils, GenericIEnumerableIsAssignableFromType);
+ MonoException *exc = NULL;
+ MonoBoolean res = invoke_method_thunk(thunk, p_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return res;
+}
+
+MonoBoolean generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype) {
+ GenericIDictionaryIsAssignableFromType thunk = CACHED_METHOD_THUNK(MarshalUtils, GenericIDictionaryIsAssignableFromType);
+ MonoException *exc = NULL;
+ MonoBoolean res = invoke_method_thunk(thunk, p_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return res;
+}
+
+MonoBoolean generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype, MonoReflectionType **r_elem_reftype) {
+ GenericIEnumerableIsAssignableFromType_with_info thunk = CACHED_METHOD_THUNK(MarshalUtils, GenericIEnumerableIsAssignableFromType_with_info);
+ MonoException *exc = NULL;
+ MonoBoolean res = invoke_method_thunk(thunk, p_reftype, r_elem_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return res;
+}
+
+MonoBoolean generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype) {
+ GenericIDictionaryIsAssignableFromType_with_info thunk = CACHED_METHOD_THUNK(MarshalUtils, GenericIDictionaryIsAssignableFromType_with_info);
+ MonoException *exc = NULL;
+ MonoBoolean res = invoke_method_thunk(thunk, p_reftype, r_key_reftype, r_value_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return res;
+}
+
+Array enumerable_to_array(MonoObject *p_enumerable) {
+ Array result;
+ EnumerableToArray thunk = CACHED_METHOD_THUNK(MarshalUtils, EnumerableToArray);
+ MonoException *exc = NULL;
+ invoke_method_thunk(thunk, p_enumerable, &result, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return result;
+}
+
+Dictionary idictionary_to_dictionary(MonoObject *p_idictionary) {
+ Dictionary result;
+ IDictionaryToDictionary thunk = CACHED_METHOD_THUNK(MarshalUtils, IDictionaryToDictionary);
+ MonoException *exc = NULL;
+ invoke_method_thunk(thunk, p_idictionary, &result, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return result;
+}
+
+Dictionary generic_idictionary_to_dictionary(MonoObject *p_generic_idictionary) {
+ Dictionary result;
+ GenericIDictionaryToDictionary thunk = CACHED_METHOD_THUNK(MarshalUtils, GenericIDictionaryToDictionary);
+ MonoException *exc = NULL;
+ invoke_method_thunk(thunk, p_generic_idictionary, &result, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return result;
+}
+
+GDMonoClass *make_generic_array_type(MonoReflectionType *p_elem_reftype) {
+ MakeGenericArrayType thunk = CACHED_METHOD_THUNK(MarshalUtils, MakeGenericArrayType);
+ MonoException *exc = NULL;
+ MonoReflectionType *reftype = invoke_method_thunk(thunk, p_elem_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return GDMono::get_singleton()->get_class(mono_class_from_mono_type(mono_reflection_type_get_type(reftype)));
+}
+
+GDMonoClass *make_generic_dictionary_type(MonoReflectionType *p_key_reftype, MonoReflectionType *p_value_reftype) {
+ MakeGenericDictionaryType thunk = CACHED_METHOD_THUNK(MarshalUtils, MakeGenericDictionaryType);
+ MonoException *exc = NULL;
+ MonoReflectionType *reftype = invoke_method_thunk(thunk, p_key_reftype, p_value_reftype, &exc);
+ UNLIKELY_UNHANDLED_EXCEPTION(exc);
+ return GDMono::get_singleton()->get_class(mono_class_from_mono_type(mono_reflection_type_get_type(reftype)));
+}
+
+} // namespace Marshal
+
+// namespace Marshal
+
} // namespace GDMonoUtils
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 87610e286c..ee239be959 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -60,10 +60,45 @@ typedef void (*DebugUtils_StackFrameInfo)(MonoObject *, MonoString **, int *, Mo
typedef MonoBoolean (*TypeIsGenericArray)(MonoReflectionType *, MonoException **);
typedef MonoBoolean (*TypeIsGenericDictionary)(MonoReflectionType *, MonoException **);
-typedef MonoBoolean (*ArrayGetElementType)(MonoReflectionType *, MonoReflectionType **, MonoException **);
-typedef MonoBoolean (*DictionaryGetKeyValueTypes)(MonoReflectionType *, MonoReflectionType **, MonoReflectionType **, MonoException **);
+
+typedef void (*ArrayGetElementType)(MonoReflectionType *, MonoReflectionType **, MonoException **);
+typedef void (*DictionaryGetKeyValueTypes)(MonoReflectionType *, MonoReflectionType **, MonoReflectionType **, MonoException **);
+
+typedef MonoBoolean (*GenericIEnumerableIsAssignableFromType)(MonoReflectionType *, MonoException **);
+typedef MonoBoolean (*GenericIDictionaryIsAssignableFromType)(MonoReflectionType *, MonoException **);
+typedef MonoBoolean (*GenericIEnumerableIsAssignableFromType_with_info)(MonoReflectionType *, MonoReflectionType **, MonoException **);
+typedef MonoBoolean (*GenericIDictionaryIsAssignableFromType_with_info)(MonoReflectionType *, MonoReflectionType **, MonoReflectionType **, MonoException **);
+
+typedef MonoReflectionType *(*MakeGenericArrayType)(MonoReflectionType *, MonoException **);
+typedef MonoReflectionType *(*MakeGenericDictionaryType)(MonoReflectionType *, MonoReflectionType *, MonoException **);
+
typedef void (*EnumerableToArray)(MonoObject *, Array *, MonoException **);
typedef void (*IDictionaryToDictionary)(MonoObject *, Dictionary *, MonoException **);
+typedef void (*GenericIDictionaryToDictionary)(MonoObject *, Dictionary *, MonoException **);
+
+namespace Marshal {
+
+MonoBoolean type_is_generic_array(MonoReflectionType *p_reftype);
+MonoBoolean type_is_generic_dictionary(MonoReflectionType *p_reftype);
+
+void array_get_element_type(MonoReflectionType *p_array_reftype, MonoReflectionType **r_elem_reftype);
+void dictionary_get_key_value_types(MonoReflectionType *p_dict_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype);
+
+MonoBoolean generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype);
+MonoBoolean generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype);
+MonoBoolean generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype, MonoReflectionType **r_elem_reftype);
+MonoBoolean generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype);
+
+GDMonoClass *make_generic_array_type(MonoReflectionType *p_elem_reftype);
+GDMonoClass *make_generic_dictionary_type(MonoReflectionType *p_key_reftype, MonoReflectionType *p_value_reftype);
+
+Array enumerable_to_array(MonoObject *p_enumerable);
+Dictionary idictionary_to_dictionary(MonoObject *p_idictionary);
+Dictionary generic_idictionary_to_dictionary(MonoObject *p_generic_idictionary);
+
+} // namespace Marshal
+
+// End of MarshalUtils methods
struct MonoCache {
@@ -114,7 +149,7 @@ struct MonoCache {
GDMonoClass *class_NodePath;
GDMonoClass *class_RID;
GDMonoClass *class_GodotObject;
- GDMonoClass *class_GodotReference;
+ GDMonoClass *class_GodotResource;
GDMonoClass *class_Node;
GDMonoClass *class_Control;
GDMonoClass *class_Spatial;
@@ -156,12 +191,27 @@ struct MonoCache {
SignalAwaiter_FailureCallback methodthunk_SignalAwaiter_FailureCallback;
GodotTaskScheduler_Activate methodthunk_GodotTaskScheduler_Activate;
+ // Start of MarshalUtils methods
+
TypeIsGenericArray methodthunk_MarshalUtils_TypeIsGenericArray;
TypeIsGenericDictionary methodthunk_MarshalUtils_TypeIsGenericDictionary;
+
ArrayGetElementType methodthunk_MarshalUtils_ArrayGetElementType;
DictionaryGetKeyValueTypes methodthunk_MarshalUtils_DictionaryGetKeyValueTypes;
+
+ GenericIEnumerableIsAssignableFromType methodthunk_MarshalUtils_GenericIEnumerableIsAssignableFromType;
+ GenericIDictionaryIsAssignableFromType methodthunk_MarshalUtils_GenericIDictionaryIsAssignableFromType;
+ GenericIEnumerableIsAssignableFromType_with_info methodthunk_MarshalUtils_GenericIEnumerableIsAssignableFromType_with_info;
+ GenericIDictionaryIsAssignableFromType_with_info methodthunk_MarshalUtils_GenericIDictionaryIsAssignableFromType_with_info;
+
+ MakeGenericArrayType methodthunk_MarshalUtils_MakeGenericArrayType;
+ MakeGenericDictionaryType methodthunk_MarshalUtils_MakeGenericDictionaryType;
+
EnumerableToArray methodthunk_MarshalUtils_EnumerableToArray;
IDictionaryToDictionary methodthunk_MarshalUtils_IDictionaryToDictionary;
+ GenericIDictionaryToDictionary methodthunk_MarshalUtils_GenericIDictionaryToDictionary;
+
+ // End of MarshalUtils methods
Ref<MonoGCHandle> task_scheduler_handle;
@@ -205,7 +255,7 @@ _FORCE_INLINE_ bool is_main_thread() {
return mono_domain_get() != NULL && mono_thread_get_main() == mono_thread_current();
}
-void runtime_object_init(MonoObject *p_this_obj);
+void runtime_object_init(MonoObject *p_this_obj, GDMonoClass *p_class, MonoException **r_exc = NULL);
GDMonoClass *get_object_class(MonoObject *p_object);
GDMonoClass *type_get_proxy_class(const StringName &p_type);
diff --git a/modules/mono/mono_gd/i_mono_class_member.h b/modules/mono/mono_gd/i_mono_class_member.h
index 553d9edc72..f4de4e3230 100644
--- a/modules/mono/mono_gd/i_mono_class_member.h
+++ b/modules/mono/mono_gd/i_mono_class_member.h
@@ -53,9 +53,11 @@ public:
virtual ~IMonoClassMember() {}
- virtual MemberType get_member_type() = 0;
+ virtual GDMonoClass *get_enclosing_class() const = 0;
- virtual StringName get_name() = 0;
+ virtual MemberType get_member_type() const = 0;
+
+ virtual StringName get_name() const = 0;
virtual bool is_static() = 0;
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index 0ef66577fe..877122985d 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -33,6 +33,7 @@
#include "core/os/file_access.h"
#include <stdio.h>
+#include <stdlib.h>
namespace {
@@ -65,7 +66,7 @@ int sfind(const String &p_text, int p_from) {
break;
case 1: {
CharType c = src[read_pos];
- found = src[read_pos] == 's' || (c >= '0' || c <= '4');
+ found = src[read_pos] == 's' || (c >= '0' && c <= '4');
break;
}
default:
@@ -209,8 +210,8 @@ String str_format(const char *p_format, ...) {
#endif
#endif
-#if defined(MINGW_ENABLED) || defined(_MSC_VER)
-#define vsnprintf vsnprintf_s
+#if defined(MINGW_ENABLED) || defined(_MSC_VER) && _MSC_VER < 1900
+#define vsnprintf(m_buffer, m_count, m_format, m_argptr) vsnprintf_s(m_buffer, m_count, _TRUNCATE, m_format, m_argptr)
#endif
String str_format(const char *p_format, va_list p_list) {
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 765a9fc11a..6a72a519fe 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -14,7 +14,7 @@ if env['builtin_libogg']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_ogg.Append(CPPPATH=[thirdparty_dir])
+ env_ogg.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_ogg.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/opensimplex/SCsub b/modules/opensimplex/SCsub
index 4235f6a0b9..311d33b047 100644
--- a/modules/opensimplex/SCsub
+++ b/modules/opensimplex/SCsub
@@ -12,7 +12,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_opensimplex.Append(CPPPATH=[thirdparty_dir])
+env_opensimplex.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_opensimplex.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index a1325734e2..f3c981dd45 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -206,7 +206,7 @@ if env['builtin_opus']:
# also requires libogg
if env['builtin_libogg']:
- env_opus.Append(CPPPATH=["#thirdparty/libogg"])
+ env_opus.Prepend(CPPPATH=["#thirdparty/libogg"])
env_opus.Append(CPPFLAGS=["-DHAVE_CONFIG_H"])
@@ -218,7 +218,7 @@ if env['builtin_opus']:
"silk/fixed",
"silk/float",
]
- env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ 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"]):
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
index 2e4a792a36..18da38fbbd 100644
--- a/modules/pvr/SCsub
+++ b/modules/pvr/SCsub
@@ -17,7 +17,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_pvr.Append(CPPPATH=[thirdparty_dir])
+env_pvr.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_pvr.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 82f323e8cf..8f6ffcc83f 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -192,9 +192,9 @@ static void _compress_pvrtc4(Image *p_img) {
Ref<Image> img = p_img->duplicate();
bool make_mipmaps = false;
- if (img->get_width() % 8 || img->get_height() % 8) {
+ if (!img->is_size_po2() || img->get_width() != img->get_height()) {
make_mipmaps = img->has_mipmaps();
- img->resize(img->get_width() + (8 - (img->get_width() % 8)), img->get_height() + (8 - (img->get_height() % 8)));
+ img->resize_to_po2(true);
}
img->convert(Image::FORMAT_RGBA8);
if (!img->has_mipmaps() && make_mipmaps)
@@ -204,7 +204,7 @@ static void _compress_pvrtc4(Image *p_img) {
Ref<Image> new_img;
new_img.instance();
- new_img->create(img->get_width(), img->get_height(), true, use_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4);
+ new_img->create(img->get_width(), img->get_height(), img->has_mipmaps(), use_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4);
PoolVector<uint8_t> data = new_img->get_data();
{
@@ -221,7 +221,6 @@ static void _compress_pvrtc4(Image *p_img) {
/* red and Green colors are swapped. */
new (dp) Javelin::ColorRgba<unsigned char>(r[ofs + 4 * j + 2], r[ofs + 4 * j + 1], r[ofs + 4 * j], r[ofs + 4 * j + 3]);
}
-
new_img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
Javelin::PvrTcEncoder::EncodeRgba4Bpp(&wr[ofs], bm);
}
diff --git a/modules/recast/SCsub b/modules/recast/SCsub
index 4a06653968..94d9968164 100644
--- a/modules/recast/SCsub
+++ b/modules/recast/SCsub
@@ -23,7 +23,7 @@ if env['builtin_recast']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_recast.Append(CPPPATH=[thirdparty_dir + "/Include"])
+ env_recast.Prepend(CPPPATH=[thirdparty_dir + "/Include"])
env_thirdparty = env_recast.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/recast/navigation_mesh_editor_plugin.cpp b/modules/recast/navigation_mesh_editor_plugin.cpp
index 62108620bd..eadc11fcee 100644
--- a/modules/recast/navigation_mesh_editor_plugin.cpp
+++ b/modules/recast/navigation_mesh_editor_plugin.cpp
@@ -54,26 +54,28 @@ void NavigationMeshEditor::_notification(int p_option) {
}
void NavigationMeshEditor::_bake_pressed() {
+ button_bake->set_pressed(false);
ERR_FAIL_COND(!node);
const String conf_warning = node->get_configuration_warning();
if (!conf_warning.empty()) {
err_dialog->set_text(conf_warning);
err_dialog->popup_centered_minsize();
- button_bake->set_pressed(false);
return;
}
- NavigationMeshGenerator::clear(node->get_navigation_mesh());
- NavigationMeshGenerator::bake(node->get_navigation_mesh(), node);
+ EditorNavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh());
+ EditorNavigationMeshGenerator::get_singleton()->bake(node->get_navigation_mesh(), node);
- node->update_gizmo();
+ if (node) {
+ node->update_gizmo();
+ }
}
void NavigationMeshEditor::_clear_pressed() {
if (node)
- NavigationMeshGenerator::clear(node->get_navigation_mesh());
+ EditorNavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh());
button_bake->set_pressed(false);
bake_info->set_text("");
diff --git a/modules/recast/navigation_mesh_generator.cpp b/modules/recast/navigation_mesh_generator.cpp
index 80e98a13a5..0cac07e3e7 100644
--- a/modules/recast/navigation_mesh_generator.cpp
+++ b/modules/recast/navigation_mesh_generator.cpp
@@ -29,14 +29,31 @@
/*************************************************************************/
#include "navigation_mesh_generator.h"
-
-void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) {
+#include "core/math/quick_hull.h"
+#include "core/os/thread.h"
+#include "editor/editor_settings.h"
+#include "scene/3d/collision_shape.h"
+#include "scene/3d/mesh_instance.h"
+#include "scene/3d/physics_body.h"
+#include "scene/resources/box_shape.h"
+#include "scene/resources/capsule_shape.h"
+#include "scene/resources/concave_polygon_shape.h"
+#include "scene/resources/convex_polygon_shape.h"
+#include "scene/resources/cylinder_shape.h"
+#include "scene/resources/plane_shape.h"
+#include "scene/resources/primitive_meshes.h"
+#include "scene/resources/shape.h"
+#include "scene/resources/sphere_shape.h"
+
+EditorNavigationMeshGenerator *EditorNavigationMeshGenerator::singleton = NULL;
+
+void EditorNavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) {
p_verticies.push_back(p_vec3.x);
p_verticies.push_back(p_vec3.y);
p_verticies.push_back(p_vec3.z);
}
-void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) {
+void EditorNavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) {
int current_vertex_count = 0;
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
@@ -91,23 +108,132 @@ void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform
}
}
-void NavigationMeshGenerator::_parse_geometry(const Transform &p_base_inverse, Node *p_node, Vector<float> &p_verticies, Vector<int> &p_indices) {
+void EditorNavigationMeshGenerator::_add_faces(const PoolVector3Array &p_faces, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) {
+ int face_count = p_faces.size() / 3;
+ int current_vertex_count = p_verticies.size() / 3;
+
+ for (int j = 0; j < face_count; j++) {
+ _add_vertex(p_xform.xform(p_faces[j * 3 + 0]), p_verticies);
+ _add_vertex(p_xform.xform(p_faces[j * 3 + 1]), p_verticies);
+ _add_vertex(p_xform.xform(p_faces[j * 3 + 2]), p_verticies);
+
+ p_indices.push_back(current_vertex_count + (j * 3 + 0));
+ p_indices.push_back(current_vertex_count + (j * 3 + 2));
+ p_indices.push_back(current_vertex_count + (j * 3 + 1));
+ }
+}
+
+void EditorNavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, Node *p_node, Vector<float> &p_verticies, Vector<int> &p_indices, int p_generate_from, uint32_t p_collision_mask) {
- if (Object::cast_to<MeshInstance>(p_node)) {
+ if (Object::cast_to<MeshInstance>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) {
MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(p_node);
Ref<Mesh> mesh = mesh_instance->get_mesh();
if (mesh.is_valid()) {
- _add_mesh(mesh, p_base_inverse * mesh_instance->get_global_transform(), p_verticies, p_indices);
+ _add_mesh(mesh, p_accumulated_transform * mesh_instance->get_transform(), p_verticies, p_indices);
}
}
+ if (Object::cast_to<StaticBody>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_MESH_INSTANCES) {
+ StaticBody *static_body = Object::cast_to<StaticBody>(p_node);
+
+ if (static_body->get_collision_layer() & p_collision_mask) {
+
+ for (int i = 0; i < p_node->get_child_count(); ++i) {
+ Node *child = p_node->get_child(i);
+ if (Object::cast_to<CollisionShape>(child)) {
+ CollisionShape *col_shape = Object::cast_to<CollisionShape>(child);
+
+ Transform transform = p_accumulated_transform * static_body->get_transform() * col_shape->get_transform();
+
+ Ref<Mesh> mesh;
+ Ref<Shape> s = col_shape->get_shape();
+
+ BoxShape *box = Object::cast_to<BoxShape>(*s);
+ if (box) {
+ Ref<CubeMesh> cube_mesh;
+ cube_mesh.instance();
+ cube_mesh->set_size(box->get_extents() * 2.0);
+ mesh = cube_mesh;
+ }
+
+ CapsuleShape *capsule = Object::cast_to<CapsuleShape>(*s);
+ if (capsule) {
+ Ref<CapsuleMesh> capsule_mesh;
+ capsule_mesh.instance();
+ capsule_mesh->set_radius(capsule->get_radius());
+ capsule_mesh->set_mid_height(capsule->get_height() / 2.0);
+ mesh = capsule_mesh;
+ }
+
+ CylinderShape *cylinder = Object::cast_to<CylinderShape>(*s);
+ if (cylinder) {
+ Ref<CylinderMesh> cylinder_mesh;
+ cylinder_mesh.instance();
+ cylinder_mesh->set_height(cylinder->get_height());
+ cylinder_mesh->set_bottom_radius(cylinder->get_radius());
+ cylinder_mesh->set_top_radius(cylinder->get_radius());
+ mesh = cylinder_mesh;
+ }
+
+ SphereShape *sphere = Object::cast_to<SphereShape>(*s);
+ if (sphere) {
+ Ref<SphereMesh> sphere_mesh;
+ sphere_mesh.instance();
+ sphere_mesh->set_radius(sphere->get_radius());
+ sphere_mesh->set_height(sphere->get_radius() * 2.0);
+ mesh = sphere_mesh;
+ }
+
+ ConcavePolygonShape *concave_polygon = Object::cast_to<ConcavePolygonShape>(*s);
+ if (concave_polygon) {
+ _add_faces(concave_polygon->get_faces(), transform, p_verticies, p_indices);
+ }
+
+ ConvexPolygonShape *convex_polygon = Object::cast_to<ConvexPolygonShape>(*s);
+ if (convex_polygon) {
+ Vector<Vector3> varr = Variant(convex_polygon->get_points());
+ Geometry::MeshData md;
+
+ Error err = QuickHull::build(varr, md);
+
+ if (err == OK) {
+ PoolVector3Array faces;
+
+ for (int j = 0; j < md.faces.size(); ++j) {
+ Geometry::MeshData::Face face = md.faces[j];
+
+ for (int k = 2; k < face.indices.size(); ++k) {
+ faces.push_back(md.vertices[face.indices[0]]);
+ faces.push_back(md.vertices[face.indices[k - 1]]);
+ faces.push_back(md.vertices[face.indices[k]]);
+ }
+ }
+
+ _add_faces(faces, transform, p_verticies, p_indices);
+ }
+ }
+
+ if (mesh.is_valid()) {
+ _add_mesh(mesh, transform, p_verticies, p_indices);
+ }
+ }
+ }
+ }
+ }
+
+ if (Object::cast_to<Spatial>(p_node)) {
+
+ Spatial *spatial = Object::cast_to<Spatial>(p_node);
+ p_accumulated_transform = p_accumulated_transform * spatial->get_transform();
+ }
+
for (int i = 0; i < p_node->get_child_count(); i++) {
- _parse_geometry(p_base_inverse, p_node->get_child(i), p_verticies, p_indices);
+ _parse_geometry(p_accumulated_transform, p_node->get_child(i), p_verticies, p_indices, p_generate_from, p_collision_mask);
}
}
-void NavigationMeshGenerator::_convert_detail_mesh_to_native_navigation_mesh(const rcPolyMeshDetail *p_detail_mesh, Ref<NavigationMesh> p_nav_mesh) {
+void EditorNavigationMeshGenerator::_convert_detail_mesh_to_native_navigation_mesh(const rcPolyMeshDetail *p_detail_mesh, Ref<NavigationMesh> p_nav_mesh) {
PoolVector<Vector3> nav_vertices;
@@ -126,15 +252,16 @@ void NavigationMeshGenerator::_convert_detail_mesh_to_native_navigation_mesh(con
for (unsigned int j = 0; j < ntris; j++) {
Vector<int> nav_indices;
nav_indices.resize(3);
+ // Polygon order in recast is opposite than godot's
nav_indices.write[0] = ((int)(bverts + tris[j * 4 + 0]));
- nav_indices.write[1] = ((int)(bverts + tris[j * 4 + 1]));
- nav_indices.write[2] = ((int)(bverts + tris[j * 4 + 2]));
+ nav_indices.write[1] = ((int)(bverts + tris[j * 4 + 2]));
+ nav_indices.write[2] = ((int)(bverts + tris[j * 4 + 1]));
p_nav_mesh->add_polygon(nav_indices);
}
}
}
-void NavigationMeshGenerator::_build_recast_navigation_mesh(Ref<NavigationMesh> p_nav_mesh, EditorProgress *ep,
+void EditorNavigationMeshGenerator::_build_recast_navigation_mesh(Ref<NavigationMesh> p_nav_mesh, EditorProgress *ep,
rcHeightfield *hf, rcCompactHeightfield *chf, rcContourSet *cset, rcPolyMesh *poly_mesh, rcPolyMeshDetail *detail_mesh,
Vector<float> &vertices, Vector<int> &indices) {
rcContext ctx;
@@ -256,7 +383,18 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(Ref<NavigationMesh>
detail_mesh = 0;
}
-void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node) {
+EditorNavigationMeshGenerator *EditorNavigationMeshGenerator::get_singleton() {
+ return singleton;
+}
+
+EditorNavigationMeshGenerator::EditorNavigationMeshGenerator() {
+ singleton = this;
+}
+
+EditorNavigationMeshGenerator::~EditorNavigationMeshGenerator() {
+}
+
+void EditorNavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node) {
ERR_FAIL_COND(!p_nav_mesh.is_valid());
@@ -266,7 +404,7 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
Vector<float> vertices;
Vector<int> indices;
- _parse_geometry(Object::cast_to<Spatial>(p_node)->get_global_transform().affine_inverse(), p_node, vertices, indices);
+ _parse_geometry(Object::cast_to<Spatial>(p_node)->get_transform().affine_inverse(), p_node, vertices, indices, p_nav_mesh->get_parsed_geometry_type(), p_nav_mesh->get_collision_mask());
if (vertices.size() > 0 && indices.size() > 0) {
@@ -296,9 +434,14 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
ep.step(TTR("Done!"), 11);
}
-void NavigationMeshGenerator::clear(Ref<NavigationMesh> p_nav_mesh) {
+void EditorNavigationMeshGenerator::clear(Ref<NavigationMesh> p_nav_mesh) {
if (p_nav_mesh.is_valid()) {
p_nav_mesh->clear_polygons();
p_nav_mesh->set_vertices(PoolVector<Vector3>());
}
}
+
+void EditorNavigationMeshGenerator::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("bake", "nav_mesh", "root_node"), &EditorNavigationMeshGenerator::bake);
+ ClassDB::bind_method(D_METHOD("clear", "nav_mesh"), &EditorNavigationMeshGenerator::clear);
+}
diff --git a/modules/recast/navigation_mesh_generator.h b/modules/recast/navigation_mesh_generator.h
index 3adc01ccda..30a6e3c835 100644
--- a/modules/recast/navigation_mesh_generator.h
+++ b/modules/recast/navigation_mesh_generator.h
@@ -31,20 +31,23 @@
#ifndef NAVIGATION_MESH_GENERATOR_H
#define NAVIGATION_MESH_GENERATOR_H
-#include "core/os/thread.h"
#include "editor/editor_node.h"
-#include "editor/editor_settings.h"
-#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation_mesh.h"
-#include "scene/resources/shape.h"
#include <Recast.h>
-class NavigationMeshGenerator {
+class EditorNavigationMeshGenerator : public Object {
+ GDCLASS(EditorNavigationMeshGenerator, Object);
+
+ static EditorNavigationMeshGenerator *singleton;
+
protected:
+ static void _bind_methods();
+
static void _add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies);
static void _add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices);
- static void _parse_geometry(const Transform &p_base_inverse, Node *p_node, Vector<float> &p_verticies, Vector<int> &p_indices);
+ static void _add_faces(const PoolVector3Array &p_faces, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices);
+ static void _parse_geometry(Transform p_accumulated_transform, Node *p_node, Vector<float> &p_verticies, Vector<int> &p_indices, int p_generate_from, uint32_t p_collision_mask);
static void _convert_detail_mesh_to_native_navigation_mesh(const rcPolyMeshDetail *p_detail_mesh, Ref<NavigationMesh> p_nav_mesh);
static void _build_recast_navigation_mesh(Ref<NavigationMesh> p_nav_mesh, EditorProgress *ep,
@@ -52,8 +55,13 @@ protected:
rcPolyMeshDetail *detail_mesh, Vector<float> &vertices, Vector<int> &indices);
public:
- static void bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node);
- static void clear(Ref<NavigationMesh> p_nav_mesh);
+ static EditorNavigationMeshGenerator *get_singleton();
+
+ EditorNavigationMeshGenerator();
+ ~EditorNavigationMeshGenerator();
+
+ void bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node);
+ void clear(Ref<NavigationMesh> p_nav_mesh);
};
#endif // NAVIGATION_MESH_GENERATOR_H
diff --git a/modules/recast/register_types.cpp b/modules/recast/register_types.cpp
index f272cc4236..247d7f6144 100644
--- a/modules/recast/register_types.cpp
+++ b/modules/recast/register_types.cpp
@@ -32,8 +32,23 @@
#include "navigation_mesh_editor_plugin.h"
+#ifdef TOOLS_ENABLED
+EditorNavigationMeshGenerator *_nav_mesh_generator = NULL;
+#endif
+
void register_recast_types() {
+#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
+ _nav_mesh_generator = memnew(EditorNavigationMeshGenerator);
+ ClassDB::register_class<EditorNavigationMeshGenerator>();
+ Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", EditorNavigationMeshGenerator::get_singleton()));
+#endif
}
-void unregister_recast_types() {}
+void unregister_recast_types() {
+#ifdef TOOLS_ENABLED
+ if (_nav_mesh_generator) {
+ memdelete(_nav_mesh_generator);
+ }
+#endif
+}
diff --git a/modules/regex/SCsub b/modules/regex/SCsub
index 99c25add45..65f354ffa7 100644
--- a/modules/regex/SCsub
+++ b/modules/regex/SCsub
@@ -46,7 +46,7 @@ if env['builtin_pcre2']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_regex.Append(CPPPATH=[thirdparty_dir])
+ env_regex.Prepend(CPPPATH=[thirdparty_dir])
env_regex.Append(CPPFLAGS=thirdparty_flags)
def pcre2_builtin(width):
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml
index 0538753a47..cc8205e400 100644
--- a/modules/regex/doc_classes/RegEx.xml
+++ b/modules/regex/doc_classes/RegEx.xml
@@ -123,7 +123,7 @@
<argument index="4" name="end" type="int" default="-1">
</argument>
<description>
- Searches the text for the compiled pattern and replaces it with the specified string. Escapes and backreferences such as [code]\1[/code] and [code]\g&lt;name&gt;[/code] expanded and resolved. By default only the first instance is replaced but it can be changed for all instances (global replacement). The region to search within can be specified without modifying where the start and end anchor would be.
+ Searches the text for the compiled pattern and replaces it with the specified string. Escapes and backreferences such as [code]$1[/code] and [code]$name[/code] are expanded and resolved. By default only the first instance is replaced but it can be changed for all instances (global replacement). The region to search within can be specified without modifying where the start and end anchor would be.
</description>
</method>
</methods>
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
index 3be85a1efa..15320bcd0c 100644
--- a/modules/squish/SCsub
+++ b/modules/squish/SCsub
@@ -22,7 +22,7 @@ if env['builtin_squish']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_squish.Append(CPPPATH=[thirdparty_dir])
+ env_squish.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_squish.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/svg/SCsub b/modules/svg/SCsub
index 66d9b3bf75..90bfe22abb 100644
--- a/modules/svg/SCsub
+++ b/modules/svg/SCsub
@@ -12,10 +12,10 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_svg.Append(CPPPATH=[thirdparty_dir])
+env_svg.Prepend(CPPPATH=[thirdparty_dir])
# FIXME: Needed in editor/editor_themes.cpp for now, but ideally there
# shouldn't be a dependency on modules/ and its own 3rd party deps.
-env.Append(CPPPATH=[thirdparty_dir])
+env.Prepend(CPPPATH=[thirdparty_dir])
env.Append(CPPFLAGS=["-DSVG_ENABLED"])
env_thirdparty = env_svg.Clone()
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
index f98db2359c..785eca4c41 100644
--- a/modules/theora/SCsub
+++ b/modules/theora/SCsub
@@ -70,13 +70,13 @@ if env['builtin_libtheora']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_theora.Append(CPPPATH=[thirdparty_dir])
+ env_theora.Prepend(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis
if env['builtin_libogg']:
- env_theora.Append(CPPPATH=["#thirdparty/libogg"])
+ env_theora.Prepend(CPPPATH=["#thirdparty/libogg"])
if env['builtin_libvorbis']:
- env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
+ env_theora.Prepend(CPPPATH=["#thirdparty/libvorbis"])
env_thirdparty = env_theora.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 8db0799b47..ae542713ea 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -94,15 +94,15 @@ void VideoStreamPlaybackTheora::video_write(void) {
if (px_fmt == TH_PF_444) {
- yuv444_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2, 0);
+ yuv444_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2);
} else if (px_fmt == TH_PF_422) {
- yuv422_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2, 0);
+ yuv422_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2);
} else if (px_fmt == TH_PF_420) {
- yuv420_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[2].data, (uint8_t *)yuv[1].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2, 0);
+ yuv420_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2);
};
format = Image::FORMAT_RGBA8;
diff --git a/modules/tinyexr/SCsub b/modules/tinyexr/SCsub
index 3e7bda2bca..97f9797b58 100644
--- a/modules/tinyexr/SCsub
+++ b/modules/tinyexr/SCsub
@@ -13,7 +13,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_tinyexr.Append(CPPPATH=[thirdparty_dir])
+env_tinyexr.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_tinyexr.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub
index 2b15f7aee2..6d669ab73b 100644
--- a/modules/upnp/SCsub
+++ b/modules/upnp/SCsub
@@ -25,7 +25,7 @@ if env['builtin_miniupnpc']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_upnp.Append(CPPPATH=[thirdparty_dir])
+ env_upnp.Prepend(CPPPATH=[thirdparty_dir])
env_upnp.Append(CPPFLAGS=["-DMINIUPNP_STATICLIB"])
env_thirdparty = env_upnp.Clone()
diff --git a/modules/vhacd/SCsub b/modules/vhacd/SCsub
index fdd3ddc1e6..161aed2eb9 100644
--- a/modules/vhacd/SCsub
+++ b/modules/vhacd/SCsub
@@ -24,7 +24,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_vhacd.Append(CPPPATH=[thirdparty_dir+"/inc"])
+env_vhacd.Prepend(CPPPATH=[thirdparty_dir + "/inc"])
env_vhacd.Append(CPPFLAGS=["-DGODOT_ENET"])
# upstream uses c++11
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 581809fec9..85fc867901 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -30,6 +30,7 @@
#include "visual_script.h"
+#include "core/core_string_names.h"
#include "core/os/os.h"
#include "core/project_settings.h"
#include "scene/main/node.h"
@@ -45,15 +46,7 @@ bool VisualScriptNode::is_breakpoint() const {
return breakpoint;
}
-void VisualScriptNode::_notification(int p_what) {
-
- if (p_what == NOTIFICATION_POSTINITIALIZE) {
- validate_input_default_values();
- }
-}
-
void VisualScriptNode::ports_changed_notify() {
- validate_input_default_values();
emit_signal("ports_changed");
}
@@ -272,11 +265,7 @@ void VisualScript::_node_ports_changed(int p_id) {
Function &func = functions[function];
Ref<VisualScriptNode> vsn = func.nodes[p_id].node;
- if (OS::get_singleton()->get_main_loop() &&
- Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop()) &&
- Engine::get_singleton()->is_editor_hint()) {
- vsn->validate_input_default_values(); //force validate default values when editing on editor
- }
+ vsn->validate_input_default_values();
//must revalidate all the functions
@@ -352,6 +341,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual
Ref<VisualScriptNode> vsn = p_node;
vsn->connect("ports_changed", this, "_node_ports_changed", varray(p_id));
vsn->scripts_used.insert(this);
+ vsn->validate_input_default_values(); // Validate when fully loaded
func.nodes[p_id] = nd;
}
@@ -1976,6 +1966,27 @@ void VisualScriptInstance::notification(int p_notification) {
call(VisualScriptLanguage::singleton->notification, &whatp, 1, ce); //do as call
}
+String VisualScriptInstance::to_string(bool *r_valid) {
+ if (has_method(CoreStringNames::get_singleton()->_to_string)) {
+ Variant::CallError ce;
+ Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
+ if (ce.error == Variant::CallError::CALL_OK) {
+ if (ret.get_type() != Variant::STRING) {
+ if (r_valid)
+ *r_valid = false;
+ ERR_EXPLAIN("Wrong type for " + CoreStringNames::get_singleton()->_to_string + ", must be a String.");
+ ERR_FAIL_V(String());
+ }
+ if (r_valid)
+ *r_valid = true;
+ return ret.operator String();
+ }
+ }
+ if (r_valid)
+ *r_valid = false;
+ return String();
+}
+
Ref<Script> VisualScriptInstance::get_script() const {
return script;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 0171b8e6f1..89f32f54f7 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -54,7 +54,6 @@ class VisualScriptNode : public Resource {
void validate_input_default_values();
protected:
- void _notification(int p_what);
void ports_changed_notify();
static void _bind_methods();
@@ -405,6 +404,7 @@ public:
virtual bool has_method(const StringName &p_method) const;
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
virtual void notification(int p_notification);
+ String to_string(bool *r_valid);
bool set_variable(const StringName &p_variable, const Variant &p_value) {
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index b50c99932d..6bbfb1ec5c 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -1330,9 +1330,9 @@ void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
}
}
-void VisualScriptEditor::_generic_search() {
+void VisualScriptEditor::_generic_search(String p_base_type) {
port_action_pos = graph->get_viewport()->get_mouse_position() - graph->get_global_position();
- new_connect_node_select->select_from_visual_script(String(""), false);
+ new_connect_node_select->select_from_visual_script(p_base_type, false);
}
void VisualScriptEditor::_members_gui_input(const Ref<InputEvent> &p_event) {
@@ -1787,7 +1787,6 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
call->set_base_path(sn->get_path_to(node));
call->set_base_type(node->get_class());
n = call;
-
method_select->select_from_instance(node);
selecting_method_id = base_id;
}
@@ -2042,7 +2041,7 @@ void VisualScriptEditor::set_edit_state(const Variant &p_state) {
Dictionary d = p_state;
if (d.has("function")) {
- edited_func = p_state;
+ edited_func = d["function"];
selected = edited_func;
}
@@ -2219,7 +2218,7 @@ Control *VisualScriptEditor::get_edit_menu() {
void VisualScriptEditor::_change_base_type() {
- select_base_type->popup_create(true);
+ select_base_type->popup_create(true, true);
}
void VisualScriptEditor::clear_edit_menu() {
@@ -2727,93 +2726,98 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
Ref<VisualScriptFunctionCall> vsfc = vsn;
vsfc->set_function(p_text);
- VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
- if (tg.type == Variant::OBJECT) {
- vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
- vsfc->set_base_type(String(""));
- if (tg.gdclass != StringName()) {
- vsfc->set_base_type(tg.gdclass);
+ if (p_connecting) {
+ VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
+
+ if (tg.type == Variant::OBJECT) {
+ vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
+ vsfc->set_base_type(String(""));
+ if (tg.gdclass != StringName()) {
+ vsfc->set_base_type(tg.gdclass);
- } else if (script->get_node(edited_func, port_action_node).is_valid()) {
- PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
- String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
+ } else if (script->get_node(edited_func, port_action_node).is_valid()) {
+ PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
+ String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
- if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
- vsfc->set_base_type(base_type);
+ if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
+ vsfc->set_base_type(base_type);
+ }
+ if (p_text == "call" || p_text == "call_deferred") {
+ vsfc->set_function(String(""));
+ }
}
- if (p_text == "call" || p_text == "call_deferred") {
- vsfc->set_function(String(""));
+ if (tg.script.is_valid()) {
+ vsfc->set_base_script(tg.script->get_path());
}
+ } else if (tg.type == Variant::NIL) {
+ vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
+ vsfc->set_base_type(String(""));
+ } else {
+ vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_BASIC_TYPE);
+ vsfc->set_basic_type(tg.type);
}
- if (tg.script.is_valid()) {
- vsfc->set_base_script(tg.script->get_path());
- }
- } else if (tg.type == Variant::NIL) {
- vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
- vsfc->set_base_type(String(""));
- } else {
- vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_BASIC_TYPE);
- vsfc->set_basic_type(tg.type);
}
}
- if (Object::cast_to<VisualScriptPropertySet>(vsn.ptr())) {
+ // if connecting from another node the call mode shouldn't be self
+ if (p_connecting) {
+ if (Object::cast_to<VisualScriptPropertySet>(vsn.ptr())) {
+ Ref<VisualScriptPropertySet> vsp = vsn;
- Ref<VisualScriptPropertySet> vsp = vsn;
-
- VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
- if (tg.type == Variant::OBJECT) {
- vsp->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- vsp->set_base_type(String(""));
- if (tg.gdclass != StringName()) {
- vsp->set_base_type(tg.gdclass);
+ VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
+ if (tg.type == Variant::OBJECT) {
+ vsp->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
+ vsp->set_base_type(String(""));
+ if (tg.gdclass != StringName()) {
+ vsp->set_base_type(tg.gdclass);
- } else if (script->get_node(edited_func, port_action_node).is_valid()) {
- PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
- String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
+ } else if (script->get_node(edited_func, port_action_node).is_valid()) {
+ PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
+ String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
- if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
- vsp->set_base_type(base_type);
+ if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
+ vsp->set_base_type(base_type);
+ }
}
+ if (tg.script.is_valid()) {
+ vsp->set_base_script(tg.script->get_path());
+ }
+ } else if (tg.type == Variant::NIL) {
+ vsp->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
+ vsp->set_base_type(String(""));
+ } else {
+ vsp->set_call_mode(VisualScriptPropertySet::CALL_MODE_BASIC_TYPE);
+ vsp->set_basic_type(tg.type);
}
- if (tg.script.is_valid()) {
- vsp->set_base_script(tg.script->get_path());
- }
- } else if (tg.type == Variant::NIL) {
- vsp->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- vsp->set_base_type(String(""));
- } else {
- vsp->set_call_mode(VisualScriptPropertySet::CALL_MODE_BASIC_TYPE);
- vsp->set_basic_type(tg.type);
}
- }
-
- if (Object::cast_to<VisualScriptPropertyGet>(vsn.ptr())) {
- Ref<VisualScriptPropertyGet> vsp = vsn;
- VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
- if (tg.type == Variant::OBJECT) {
- vsp->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
- vsp->set_base_type(String(""));
- if (tg.gdclass != StringName()) {
- vsp->set_base_type(tg.gdclass);
+ if (Object::cast_to<VisualScriptPropertyGet>(vsn.ptr())) {
+ Ref<VisualScriptPropertyGet> vsp = vsn;
- } else if (script->get_node(edited_func, port_action_node).is_valid()) {
- PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
- String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
- if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
- vsp->set_base_type(base_type);
+ VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
+ if (tg.type == Variant::OBJECT) {
+ vsp->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
+ vsp->set_base_type(String(""));
+ if (tg.gdclass != StringName()) {
+ vsp->set_base_type(tg.gdclass);
+
+ } else if (script->get_node(edited_func, port_action_node).is_valid()) {
+ PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
+ String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
+ if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
+ vsp->set_base_type(base_type);
+ }
}
+ if (tg.script.is_valid()) {
+ vsp->set_base_script(tg.script->get_path());
+ }
+ } else if (tg.type == Variant::NIL) {
+ vsp->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
+ vsp->set_base_type(String(""));
+ } else {
+ vsp->set_call_mode(VisualScriptPropertyGet::CALL_MODE_BASIC_TYPE);
+ vsp->set_basic_type(tg.type);
}
- if (tg.script.is_valid()) {
- vsp->set_base_script(tg.script->get_path());
- }
- } else if (tg.type == Variant::NIL) {
- vsp->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
- vsp->set_base_type(String(""));
- } else {
- vsp->set_call_mode(VisualScriptPropertyGet::CALL_MODE_BASIC_TYPE);
- vsp->set_basic_type(tg.type);
}
}
Ref<VisualScriptNode> vnode_old = script->get_node(edited_func, port_action_node);
@@ -3156,7 +3160,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
} break;
case EDIT_FIND_NODE_TYPE: {
- _generic_search();
+ _generic_search(script->get_instance_base_type());
} break;
case EDIT_COPY_NODES:
case EDIT_CUT_NODES: {
@@ -3574,7 +3578,7 @@ VisualScriptEditor::VisualScriptEditor() {
graph->connect("scroll_offset_changed", this, "_graph_ofs_changed");
select_func_text = memnew(Label);
- select_func_text->set_text(TTR("Select or create a function to edit graph"));
+ select_func_text->set_text(TTR("Select or create a function to edit its graph."));
select_func_text->set_align(Label::ALIGN_CENTER);
select_func_text->set_valign(Label::VALIGN_CENTER);
select_func_text->set_h_size_flags(SIZE_EXPAND_FILL);
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 9387a09c78..3d3a49f672 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -212,7 +212,7 @@ class VisualScriptEditor : public ScriptEditorBase {
void _input(const Ref<InputEvent> &p_event);
- void _generic_search();
+ void _generic_search(String p_base_type = "");
void _members_gui_input(const Ref<InputEvent> &p_event);
void _on_nodes_delete();
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index ac5f73d113..ceec79c0d5 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -87,38 +87,17 @@ void VisualScriptPropertySelector::_update_search() {
TreeItem *root = search_options->create_item();
bool found = false;
+ StringName base = base_type;
+ List<StringName> base_list;
+ while (base) {
+ base_list.push_back(base);
+ base = ClassDB::get_parent_class_nocheck(base);
+ }
- if (properties) {
-
+ for (List<StringName>::Element *E = base_list.front(); E; E = E->next()) {
+ List<MethodInfo> methods;
List<PropertyInfo> props;
-
- if (instance) {
- instance->get_property_list(&props, true);
- } else if (type != Variant::NIL) {
- Variant v;
- Variant::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
-
- v.get_property_list(&props);
- } else {
-
- Object *obj = ObjectDB::get_instance(script);
- if (Object::cast_to<Script>(obj)) {
-
- props.push_back(PropertyInfo(Variant::NIL, "Script Variables", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CATEGORY));
- Object::cast_to<Script>(obj)->get_script_property_list(&props);
- }
-
- StringName base = base_type;
- while (base) {
- props.push_back(PropertyInfo(Variant::NIL, base, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CATEGORY));
- ClassDB::get_property_list(base, &props, true);
- base = ClassDB::get_parent_class_nocheck(base);
- }
- }
-
TreeItem *category = NULL;
-
Ref<Texture> type_icons[Variant::VARIANT_MAX] = {
Control::get_icon("Variant", "EditorIcons"),
Control::get_icon("bool", "EditorIcons"),
@@ -148,85 +127,164 @@ void VisualScriptPropertySelector::_update_search() {
Control::get_icon("PoolVector3Array", "EditorIcons"),
Control::get_icon("PoolColorArray", "EditorIcons")
};
-
- if (!seq_connect && !visual_script_generic) {
- get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box);
- get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box);
- get_visual_node_names("functions/by_type/" + Variant::get_type_name(type), Set<String>(), found, root, search_box);
- get_visual_node_names("operators/compare/", Set<String>(), found, root, search_box);
- if (type == Variant::INT) {
- get_visual_node_names("operators/bitwise/", Set<String>(), found, root, search_box);
- }
- if (type == Variant::BOOL) {
- get_visual_node_names("operators/logic/", Set<String>(), found, root, search_box);
+ {
+ String b = String(E->get());
+ category = search_options->create_item(root);
+ category->set_text(0, b.replace_first("*", ""));
+ category->set_selectable(0, false);
+ Ref<Texture> icon;
+ String rep = b.replace("*", "");
+ icon = EditorNode::get_singleton()->get_class_icon(rep);
+ category->set_icon(0, icon);
+ }
+ if (properties || seq_connect) {
+ if (instance) {
+ instance->get_property_list(&props, true);
+ } else {
+ Object *obj = ObjectDB::get_instance(script);
+ if (Object::cast_to<Script>(obj)) {
+ Object::cast_to<Script>(obj)->get_script_property_list(&props);
+ } else {
+ ClassDB::get_property_list(E->get(), &props, true);
+ }
}
- if (type == Variant::BOOL || type == Variant::INT || type == Variant::REAL || type == Variant::VECTOR2 || type == Variant::VECTOR3) {
- get_visual_node_names("operators/math/", Set<String>(), found, root, search_box);
+ for (List<PropertyInfo>::Element *F = props.front(); F; F = F->next()) {
+ if (!(F->get().usage & PROPERTY_USAGE_EDITOR) && !(F->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE))
+ continue;
+
+ if (type_filter.size() && type_filter.find(F->get().type) == -1)
+ continue;
+
+ // capitalize() also converts underscore to space, we'll match again both possible styles
+ String get_text_raw = String(vformat(TTR("Get %s"), F->get().name));
+ String get_text = get_text_raw.capitalize();
+ String set_text_raw = String(vformat(TTR("Set %s"), F->get().name));
+ String set_text = set_text_raw.capitalize();
+ String input = search_box->get_text().capitalize();
+
+ if (input == String() || get_text_raw.findn(input) != -1 || get_text.findn(input) != -1) {
+ TreeItem *item = search_options->create_item(category ? category : root);
+ item->set_text(0, get_text);
+ item->set_metadata(0, F->get().name);
+ item->set_icon(0, type_icons[F->get().type]);
+ item->set_metadata(1, "get");
+ item->set_collapsed(1);
+ item->set_selectable(0, true);
+ item->set_selectable(1, false);
+ item->set_selectable(2, false);
+ item->set_metadata(2, connecting);
+ }
+
+ if (input == String() || set_text_raw.findn(input) != -1 || set_text.findn(input) != -1) {
+ TreeItem *item = search_options->create_item(category ? category : root);
+ item->set_text(0, set_text);
+ item->set_metadata(0, F->get().name);
+ item->set_icon(0, type_icons[F->get().type]);
+ item->set_metadata(1, "set");
+ item->set_selectable(0, true);
+ item->set_selectable(1, false);
+ item->set_selectable(2, false);
+ item->set_metadata(2, connecting);
+ }
}
}
+ bool script_methods = false;
+ {
+ if (type != Variant::NIL) {
+ Variant v;
+ Variant::CallError ce;
+ v = Variant::construct(type, NULL, 0, ce);
+ v.get_method_list(&methods);
+ } else {
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (E->get().usage == PROPERTY_USAGE_CATEGORY) {
- if (category && category->get_children() == NULL) {
- memdelete(category); //old category was unused
- }
- category = search_options->create_item(root);
- category->set_text(0, E->get().name);
- category->set_selectable(0, false);
+ Object *obj = ObjectDB::get_instance(script);
+ if (Object::cast_to<Script>(obj)) {
+ methods.push_back(MethodInfo("*Script Methods"));
+ Object::cast_to<Script>(obj)->get_script_method_list(&methods);
- Ref<Texture> icon;
- if (E->get().name == "Script Variables") {
- icon = get_icon("Script", "EditorIcons");
} else {
- icon = EditorNode::get_singleton()->get_class_icon(E->get().name);
+ methods.push_back(MethodInfo("*" + String(E->get())));
+ ClassDB::get_method_list(E->get(), &methods, true, true);
}
- category->set_icon(0, icon);
- continue;
}
+ }
+ 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))
+ continue;
- if (!(E->get().usage & PROPERTY_USAGE_EDITOR) && !(E->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE))
+ if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL))
continue;
- if (type_filter.size() && type_filter.find(E->get().type) == -1)
+ if (!virtuals_only && (M->get().flags & METHOD_FLAG_VIRTUAL))
continue;
- // capitalize() also converts underscore to space, we'll match again both possible styles
- String get_text_raw = String(vformat(TTR("Get %s"), E->get().name));
- String get_text = get_text_raw.capitalize();
- String set_text_raw = String(vformat(TTR("Set %s"), E->get().name));
- String set_text = set_text_raw.capitalize();
- String input = search_box->get_text().capitalize();
-
- if (input == String() || get_text_raw.findn(input) != -1 || get_text.findn(input) != -1) {
- TreeItem *item = search_options->create_item(category ? category : root);
- item->set_text(0, get_text);
- item->set_metadata(0, E->get().name);
- item->set_icon(0, type_icons[E->get().type]);
- item->set_metadata(1, "get");
- item->set_collapsed(1);
- item->set_selectable(0, true);
- item->set_selectable(1, false);
- item->set_selectable(2, false);
- item->set_metadata(2, connecting);
+ MethodInfo mi = M->get();
+ String desc_arguments;
+ if (mi.arguments.size() > 0) {
+ desc_arguments = "(";
+ for (int i = 0; i < mi.arguments.size(); i++) {
+
+ if (i > 0) {
+ desc_arguments += ", ";
+ }
+ if (mi.arguments[i].type == Variant::NIL) {
+ desc_arguments += "var";
+ } else if (mi.arguments[i].name.find(":") != -1) {
+ desc_arguments += mi.arguments[i].name.get_slice(":", 1);
+ mi.arguments[i].name = mi.arguments[i].name.get_slice(":", 0);
+ } else {
+ desc_arguments += Variant::get_type_name(mi.arguments[i].type);
+ }
+ }
+ desc_arguments += ")";
}
+ String desc_raw = mi.name + desc_arguments;
+ String desc = desc_raw.capitalize().replace("( ", "(");
- if (input == String() || set_text_raw.findn(input) != -1 || set_text.findn(input) != -1) {
- TreeItem *item = search_options->create_item(category ? category : root);
- item->set_text(0, set_text);
- item->set_metadata(0, E->get().name);
- item->set_icon(0, type_icons[E->get().type]);
- item->set_metadata(1, "set");
- item->set_selectable(0, true);
- item->set_selectable(1, false);
- item->set_selectable(2, false);
- item->set_metadata(2, connecting);
+ if (search_box->get_text() != String() &&
+ name.findn(search_box->get_text()) == -1 &&
+ desc.findn(search_box->get_text()) == -1 &&
+ desc_raw.findn(search_box->get_text()) == -1) {
+ continue;
}
+
+ TreeItem *item = search_options->create_item(category ? category : root);
+ item->set_text(0, desc);
+ item->set_icon(0, get_icon("MemberMethod", "EditorIcons"));
+ item->set_metadata(0, name);
+ item->set_selectable(0, true);
+
+ item->set_metadata(1, "method");
+ item->set_collapsed(1);
+ item->set_selectable(1, false);
+
+ item->set_selectable(2, false);
+ item->set_metadata(2, connecting);
}
if (category && category->get_children() == NULL) {
memdelete(category); //old category was unused
}
}
+ if (properties) {
+ if (!seq_connect && !visual_script_generic) {
+ get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box);
+ get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box);
+ get_visual_node_names("functions/by_type/" + Variant::get_type_name(type), Set<String>(), found, root, search_box);
+ get_visual_node_names("operators/compare/", Set<String>(), found, root, search_box);
+ if (type == Variant::INT) {
+ get_visual_node_names("operators/bitwise/", Set<String>(), found, root, search_box);
+ }
+ if (type == Variant::BOOL) {
+ get_visual_node_names("operators/logic/", Set<String>(), found, root, search_box);
+ }
+ if (type == Variant::BOOL || type == Variant::INT || type == Variant::REAL || type == Variant::VECTOR2 || type == Variant::VECTOR3) {
+ get_visual_node_names("operators/math/", Set<String>(), found, root, search_box);
+ }
+ }
+ }
if (seq_connect && !visual_script_generic) {
String text = search_box->get_text();
@@ -240,127 +298,16 @@ void VisualScriptPropertySelector::_update_search() {
get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box);
}
- if (visual_script_generic) {
+ if ((properties || seq_connect) && visual_script_generic) {
get_visual_node_names("", Set<String>(), found, root, search_box);
}
- List<MethodInfo> methods;
-
- if (type != Variant::NIL) {
- Variant v;
- Variant::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
- v.get_method_list(&methods);
- } else {
-
- Object *obj = ObjectDB::get_instance(script);
- if (Object::cast_to<Script>(obj)) {
-
- methods.push_back(MethodInfo("*Script Methods"));
- Object::cast_to<Script>(obj)->get_script_method_list(&methods);
- }
-
- StringName base = base_type;
- while (base) {
- methods.push_back(MethodInfo("*" + String(base)));
- ClassDB::get_method_list(base, &methods, true, true);
- base = ClassDB::get_parent_class_nocheck(base);
- }
- }
- TreeItem *category = NULL;
- bool script_methods = false;
-
- for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
- if (E->get().name.begins_with("*")) {
- if (category && category->get_children() == NULL) {
- memdelete(category); //old category was unused
- }
- category = search_options->create_item(root);
- category->set_text(0, E->get().name.replace_first("*", ""));
- category->set_selectable(0, false);
-
- Ref<Texture> icon;
- script_methods = false;
- String rep = E->get().name.replace("*", "");
- if (E->get().name == "*Script Methods") {
- icon = get_icon("Script", "EditorIcons");
- script_methods = true;
- } else {
- icon = EditorNode::get_singleton()->get_class_icon(rep);
- }
- category->set_icon(0, icon);
-
- continue;
- }
-
- String name = E->get().name.get_slice(":", 0);
- if (!script_methods && name.begins_with("_") && !(E->get().flags & METHOD_FLAG_VIRTUAL))
- continue;
-
- if (virtuals_only && !(E->get().flags & METHOD_FLAG_VIRTUAL))
- continue;
-
- if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL))
- continue;
-
- MethodInfo mi = E->get();
- String desc_arguments;
- if (mi.arguments.size() > 0) {
- desc_arguments = "(";
- for (int i = 0; i < mi.arguments.size(); i++) {
-
- if (i > 0) {
- desc_arguments += ", ";
- }
- if (mi.arguments[i].type == Variant::NIL) {
- desc_arguments += "var";
- } else if (mi.arguments[i].name.find(":") != -1) {
- desc_arguments += mi.arguments[i].name.get_slice(":", 1);
- mi.arguments[i].name = mi.arguments[i].name.get_slice(":", 0);
- } else {
- desc_arguments += Variant::get_type_name(mi.arguments[i].type);
- }
- }
- desc_arguments += ")";
- }
- String desc_raw = mi.name + desc_arguments;
- String desc = desc_raw.capitalize().replace("( ", "(");
-
- if (search_box->get_text() != String() &&
- name.findn(search_box->get_text()) == -1 &&
- desc.findn(search_box->get_text()) == -1 &&
- desc_raw.findn(search_box->get_text()) == -1) {
- continue;
- }
-
- TreeItem *item = search_options->create_item(category ? category : root);
- item->set_text(0, desc);
- item->set_icon(0, get_icon("MemberMethod", "EditorIcons"));
- item->set_metadata(0, name);
- item->set_selectable(0, true);
-
- item->set_metadata(1, "method");
- item->set_collapsed(1);
- item->set_selectable(1, false);
-
- item->set_selectable(2, false);
- item->set_metadata(2, connecting);
-
- if (category && category->get_children() == NULL) {
- memdelete(category); //old category was unused
- }
- }
-
TreeItem *selected_item = search_options->search_item_text(search_box->get_text());
if (!found && selected_item != NULL) {
selected_item->select(0);
found = true;
}
- if (category && category->get_children() == NULL) {
- memdelete(category); //old category was unused
- }
-
get_ok()->set_disabled(root->get_children() == NULL);
}
@@ -488,23 +435,23 @@ void VisualScriptPropertySelector::_item_selected() {
while (at_class != String()) {
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
- if (E) {
- for (int i = 0; i < E->get().methods.size(); i++) {
- if (E->get().methods[i].name == name) {
- text = E->get().methods[i].description;
+ Map<String, DocData::ClassDoc>::Element *C = dd->class_list.find(at_class);
+ if (C) {
+ for (int i = 0; i < C->get().methods.size(); i++) {
+ if (C->get().methods[i].name == name) {
+ text = C->get().methods[i].description;
}
}
}
at_class = ClassDB::get_parent_class_nocheck(at_class);
}
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
- if (E) {
- for (int i = 0; i < E->get().methods.size(); i++) {
+ Map<String, DocData::ClassDoc>::Element *T = dd->class_list.find(class_type);
+ if (T) {
+ for (int i = 0; i < T->get().methods.size(); i++) {
Vector<String> functions = name.rsplit("/", false, 1);
- if (E->get().methods[i].name == functions[functions.size() - 1]) {
- text = E->get().methods[i].description;
+ if (T->get().methods[i].name == functions[functions.size() - 1]) {
+ text = T->get().methods[i].description;
}
}
}
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index 19587563ab..3824fdd789 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -40,11 +40,11 @@ if env['builtin_libvorbis']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_vorbis.Append(CPPPATH=[thirdparty_dir])
+ env_vorbis.Prepend(CPPPATH=[thirdparty_dir])
# also requires libogg
if env['builtin_libogg']:
- env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
+ env_vorbis.Prepend(CPPPATH=["#thirdparty/libogg"])
env_thirdparty = env_vorbis.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index dcc9a45044..e57437229f 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -15,7 +15,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_webm.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
+env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
# upstream uses c++11
if (not env_webm.msvc):
@@ -23,14 +23,14 @@ if (not env_webm.msvc):
# also requires libogg, libvorbis and libopus
if env['builtin_libogg']:
- env_webm.Append(CPPPATH=["#thirdparty/libogg"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/libogg"])
if env['builtin_libvorbis']:
- env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"])
if env['builtin_opus']:
- env_webm.Append(CPPPATH=["#thirdparty/opus"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/opus"])
if env['builtin_libvpx']:
- env_webm.Append(CPPPATH=["#thirdparty/libvpx"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"])
SConscript("libvpx/SCsub")
env_thirdparty = env_webm.Clone()
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 5bf4ea3464..a6be1380a6 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -256,7 +256,7 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
env_libvpx = env_modules.Clone()
env_libvpx.disable_warnings()
-env_libvpx.Append(CPPPATH=[libvpx_dir])
+env_libvpx.Prepend(CPPPATH=[libvpx_dir])
webm_multithread = env["platform"] != 'javascript'
@@ -380,7 +380,7 @@ if webm_cpu_x86:
elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
if env["platform"] == 'android':
- env_libvpx.Append(CPPPATH=[libvpx_dir + "third_party/android"])
+ env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"])
env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
env_libvpx_neon = env_libvpx.Clone()
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index f2497eeec1..6485c95360 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -32,6 +32,7 @@
#include "OpusVorbisDecoder.hpp"
#include "VPXDecoder.hpp"
+#include <vpx/vpx_image.h>
#include "mkvparser/mkvparser.h"
@@ -314,19 +315,37 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
PoolVector<uint8_t>::Write w = frame_data.write();
bool converted = false;
- if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
+ if (image.chromaShiftW == 0 && image.chromaShiftH == 0 && image.cs == VPX_CS_SRGB) {
+
+ uint8_t *wp = w.ptr();
+ unsigned char *rRow = image.planes[2];
+ unsigned char *gRow = image.planes[0];
+ unsigned char *bRow = image.planes[1];
+ for (int i = 0; i < image.h; i++) {
+ for (int j = 0; j < image.w; j++) {
+ *wp++ = rRow[j];
+ *wp++ = gRow[j];
+ *wp++ = bRow[j];
+ *wp++ = 255;
+ }
+ rRow += image.linesize[2];
+ gRow += image.linesize[0];
+ bRow += image.linesize[1];
+ }
+ converted = true;
+ } else if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
- yuv420_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
+ yuv420_2_rgb8888(w.ptr(), image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2);
// libyuv::I420ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
converted = true;
} else if (image.chromaShiftW == 1 && image.chromaShiftH == 0) {
- yuv422_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
+ yuv422_2_rgb8888(w.ptr(), image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2);
// libyuv::I422ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
converted = true;
} else if (image.chromaShiftW == 0 && image.chromaShiftH == 0) {
- yuv444_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
+ yuv444_2_rgb8888(w.ptr(), image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2);
// libyuv::I444ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
converted = true;
} else if (image.chromaShiftW == 2 && image.chromaShiftH == 0) {
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index fa3896c457..666628bb44 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -126,7 +126,7 @@ if env['builtin_libwebp']:
]
thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
- env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
+ env_webp.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
env_thirdparty = env_webp.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/webrtc/SCsub b/modules/webrtc/SCsub
index 446bd530c2..868553b879 100644
--- a/modules/webrtc/SCsub
+++ b/modules/webrtc/SCsub
@@ -10,7 +10,6 @@ use_gdnative = env_webrtc["module_gdnative_enabled"]
if use_gdnative: # GDNative is retained in Javascript for export compatibility
env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED'])
- gdnative_includes = ["#modules/gdnative/include/"]
- env_webrtc.Append(CPPPATH=gdnative_includes)
+ env_webrtc.Prepend(CPPPATH=["#modules/gdnative/include/"])
env_webrtc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webrtc/config.py b/modules/webrtc/config.py
index 5ed245bad2..2e3a18ad0e 100644
--- a/modules/webrtc/config.py
+++ b/modules/webrtc/config.py
@@ -6,7 +6,8 @@ def configure(env):
def get_doc_classes():
return [
- "WebRTCPeer"
+ "WebRTCPeerConnection",
+ "WebRTCDataChannel"
]
def get_doc_path():
diff --git a/modules/webrtc/doc_classes/WebRTCDataChannel.xml b/modules/webrtc/doc_classes/WebRTCDataChannel.xml
new file mode 100644
index 0000000000..dcc14d4ddb
--- /dev/null
+++ b/modules/webrtc/doc_classes/WebRTCDataChannel.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="WebRTCDataChannel" inherits="PacketPeer" category="Core" version="3.2">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="close">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_id" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_label" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_max_packet_life_time" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_max_retransmits" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_protocol" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_ready_state" qualifiers="const">
+ <return type="int" enum="WebRTCDataChannel.ChannelState">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_negotiated" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_ordered" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="poll">
+ <return type="int" enum="Error">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="was_string_packet" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="write_mode" type="int" setter="set_write_mode" getter="get_write_mode" enum="WebRTCDataChannel.WriteMode">
+ </member>
+ </members>
+ <constants>
+ <constant name="WRITE_MODE_TEXT" value="0" enum="WriteMode">
+ </constant>
+ <constant name="WRITE_MODE_BINARY" value="1" enum="WriteMode">
+ </constant>
+ <constant name="STATE_CONNECTING" value="0" enum="ChannelState">
+ </constant>
+ <constant name="STATE_OPEN" value="1" enum="ChannelState">
+ </constant>
+ <constant name="STATE_CLOSING" value="2" enum="ChannelState">
+ </constant>
+ <constant name="STATE_CLOSED" value="3" enum="ChannelState">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/webrtc/doc_classes/WebRTCPeer.xml b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml
index 18d1345623..8b14c60deb 100644
--- a/modules/webrtc/doc_classes/WebRTCPeer.xml
+++ b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebRTCPeer" inherits="PacketPeer" category="Core" version="3.2">
+<class name="WebRTCPeerConnection" inherits="Reference" category="Core" version="3.2">
<brief_description>
</brief_description>
<description>
@@ -19,6 +19,24 @@
<description>
</description>
</method>
+ <method name="close">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="create_data_channel">
+ <return type="WebRTCDataChannel">
+ </return>
+ <argument index="0" name="label" type="String">
+ </argument>
+ <argument index="1" name="options" type="Dictionary" default="{
+
+}">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="create_offer">
<return type="int" enum="Error">
</return>
@@ -26,8 +44,18 @@
</description>
</method>
<method name="get_connection_state" qualifiers="const">
- <return type="int" enum="WebRTCPeer.ConnectionState">
+ <return type="int" enum="WebRTCPeerConnection.ConnectionState">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="initialize">
+ <return type="int" enum="Error">
</return>
+ <argument index="0" name="configuration" type="Dictionary" default="{
+
+}">
+ </argument>
<description>
</description>
</method>
@@ -57,19 +85,15 @@
<description>
</description>
</method>
- <method name="was_string_packet" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
</methods>
- <members>
- <member name="write_mode" type="int" setter="set_write_mode" getter="get_write_mode" enum="WebRTCPeer.WriteMode">
- </member>
- </members>
<signals>
- <signal name="new_ice_candidate">
+ <signal name="data_channel_received">
+ <argument index="0" name="channel" type="Object">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="ice_candidate_created">
<argument index="0" name="media" type="String">
</argument>
<argument index="1" name="index" type="int">
@@ -79,7 +103,7 @@
<description>
</description>
</signal>
- <signal name="offer_created">
+ <signal name="session_description_created">
<argument index="0" name="type" type="String">
</argument>
<argument index="1" name="sdp" type="String">
@@ -89,10 +113,6 @@
</signal>
</signals>
<constants>
- <constant name="WRITE_MODE_TEXT" value="0" enum="WriteMode">
- </constant>
- <constant name="WRITE_MODE_BINARY" value="1" enum="WriteMode">
- </constant>
<constant name="STATE_NEW" value="0" enum="ConnectionState">
</constant>
<constant name="STATE_CONNECTING" value="1" enum="ConnectionState">
diff --git a/modules/webrtc/register_types.cpp b/modules/webrtc/register_types.cpp
index ee7a766bd9..44e072cc89 100644
--- a/modules/webrtc/register_types.cpp
+++ b/modules/webrtc/register_types.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
@@ -29,27 +29,31 @@
/*************************************************************************/
#include "register_types.h"
-#include "webrtc_peer.h"
+#include "webrtc_data_channel.h"
+#include "webrtc_peer_connection.h"
#ifdef JAVASCRIPT_ENABLED
#include "emscripten.h"
-#include "webrtc_peer_js.h"
+#include "webrtc_peer_connection_js.h"
#endif
#ifdef WEBRTC_GDNATIVE_ENABLED
-#include "webrtc_peer_gdnative.h"
+#include "webrtc_data_channel_gdnative.h"
+#include "webrtc_peer_connection_gdnative.h"
#endif
void register_webrtc_types() {
#ifdef JAVASCRIPT_ENABLED
- WebRTCPeerJS::make_default();
+ WebRTCPeerConnectionJS::make_default();
#elif defined(WEBRTC_GDNATIVE_ENABLED)
- WebRTCPeerGDNative::make_default();
+ WebRTCPeerConnectionGDNative::make_default();
#endif
- ClassDB::register_custom_instance_class<WebRTCPeer>();
+ ClassDB::register_custom_instance_class<WebRTCPeerConnection>();
#ifdef WEBRTC_GDNATIVE_ENABLED
- ClassDB::register_class<WebRTCPeerGDNative>();
+ ClassDB::register_class<WebRTCPeerConnectionGDNative>();
+ ClassDB::register_class<WebRTCDataChannelGDNative>();
#endif
+ ClassDB::register_virtual_class<WebRTCDataChannel>();
}
void unregister_webrtc_types() {}
diff --git a/modules/webrtc/register_types.h b/modules/webrtc/register_types.h
index 18a5dcc5aa..4923547a95 100644
--- a/modules/webrtc/register_types.h
+++ b/modules/webrtc/register_types.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
diff --git a/modules/webrtc/webrtc_data_channel.cpp b/modules/webrtc/webrtc_data_channel.cpp
new file mode 100644
index 0000000000..2bd30e68f5
--- /dev/null
+++ b/modules/webrtc/webrtc_data_channel.cpp
@@ -0,0 +1,64 @@
+/*************************************************************************/
+/* webrtc_data_channel.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 "webrtc_data_channel.h"
+
+void WebRTCDataChannel::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("poll"), &WebRTCDataChannel::poll);
+ ClassDB::bind_method(D_METHOD("close"), &WebRTCDataChannel::close);
+
+ ClassDB::bind_method(D_METHOD("was_string_packet"), &WebRTCDataChannel::was_string_packet);
+ ClassDB::bind_method(D_METHOD("set_write_mode", "write_mode"), &WebRTCDataChannel::set_write_mode);
+ ClassDB::bind_method(D_METHOD("get_write_mode"), &WebRTCDataChannel::get_write_mode);
+ ClassDB::bind_method(D_METHOD("get_ready_state"), &WebRTCDataChannel::get_ready_state);
+ ClassDB::bind_method(D_METHOD("get_label"), &WebRTCDataChannel::get_label);
+ ClassDB::bind_method(D_METHOD("is_ordered"), &WebRTCDataChannel::is_ordered);
+ ClassDB::bind_method(D_METHOD("get_id"), &WebRTCDataChannel::get_id);
+ ClassDB::bind_method(D_METHOD("get_max_packet_life_time"), &WebRTCDataChannel::get_max_packet_life_time);
+ ClassDB::bind_method(D_METHOD("get_max_retransmits"), &WebRTCDataChannel::get_max_retransmits);
+ ClassDB::bind_method(D_METHOD("get_protocol"), &WebRTCDataChannel::get_protocol);
+ ClassDB::bind_method(D_METHOD("is_negotiated"), &WebRTCDataChannel::is_negotiated);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "write_mode", PROPERTY_HINT_ENUM), "set_write_mode", "get_write_mode");
+
+ BIND_ENUM_CONSTANT(WRITE_MODE_TEXT);
+ BIND_ENUM_CONSTANT(WRITE_MODE_BINARY);
+
+ BIND_ENUM_CONSTANT(STATE_CONNECTING);
+ BIND_ENUM_CONSTANT(STATE_OPEN);
+ BIND_ENUM_CONSTANT(STATE_CLOSING);
+ BIND_ENUM_CONSTANT(STATE_CLOSED);
+}
+
+WebRTCDataChannel::WebRTCDataChannel() {
+}
+
+WebRTCDataChannel::~WebRTCDataChannel() {
+}
diff --git a/modules/webrtc/webrtc_peer.h b/modules/webrtc/webrtc_data_channel.h
index e141c14655..0b161da784 100644
--- a/modules/webrtc/webrtc_peer.h
+++ b/modules/webrtc/webrtc_data_channel.h
@@ -1,12 +1,12 @@
/*************************************************************************/
-/* webrtc_peer.h */
+/* webrtc_data_channel.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
@@ -28,13 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WEBRTC_PEER_H
-#define WEBRTC_PEER_H
+#ifndef WEBRTC_DATA_CHANNEL_H
+#define WEBRTC_DATA_CHANNEL_H
#include "core/io/packet_peer.h"
-class WebRTCPeer : public PacketPeer {
- GDCLASS(WebRTCPeer, PacketPeer);
+class WebRTCDataChannel : public PacketPeer {
+ GDCLASS(WebRTCDataChannel, PacketPeer);
public:
enum WriteMode {
@@ -42,30 +42,32 @@ public:
WRITE_MODE_BINARY,
};
- enum ConnectionState {
- STATE_NEW,
+ enum ChannelState {
STATE_CONNECTING,
- STATE_CONNECTED,
- STATE_DISCONNECTED,
- STATE_FAILED,
+ STATE_OPEN,
+ STATE_CLOSING,
STATE_CLOSED
};
protected:
static void _bind_methods();
- static WebRTCPeer *(*_create)();
public:
virtual void set_write_mode(WriteMode mode) = 0;
virtual WriteMode get_write_mode() const = 0;
virtual bool was_string_packet() const = 0;
- virtual ConnectionState get_connection_state() const = 0;
- virtual Error create_offer() = 0;
- virtual Error set_remote_description(String type, String sdp) = 0;
- virtual Error set_local_description(String type, String sdp) = 0;
- virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) = 0;
+ virtual ChannelState get_ready_state() const = 0;
+ virtual String get_label() const = 0;
+ virtual bool is_ordered() const = 0;
+ virtual int get_id() const = 0;
+ virtual int get_max_packet_life_time() const = 0;
+ virtual int get_max_retransmits() const = 0;
+ virtual String get_protocol() const = 0;
+ virtual bool is_negotiated() const = 0;
+
virtual Error poll() = 0;
+ virtual void close() = 0;
/** Inherited from PacketPeer: **/
virtual int get_available_packet_count() const = 0;
@@ -74,13 +76,10 @@ public:
virtual int get_max_packet_size() const = 0;
- static Ref<WebRTCPeer> create_ref();
- static WebRTCPeer *create();
-
- WebRTCPeer();
- ~WebRTCPeer();
+ WebRTCDataChannel();
+ ~WebRTCDataChannel();
};
-VARIANT_ENUM_CAST(WebRTCPeer::WriteMode);
-VARIANT_ENUM_CAST(WebRTCPeer::ConnectionState);
-#endif // WEBRTC_PEER_H
+VARIANT_ENUM_CAST(WebRTCDataChannel::WriteMode);
+VARIANT_ENUM_CAST(WebRTCDataChannel::ChannelState);
+#endif // WEBRTC_DATA_CHANNEL_H
diff --git a/modules/webrtc/webrtc_peer_gdnative.cpp b/modules/webrtc/webrtc_data_channel_gdnative.cpp
index f782944980..4f33491af2 100644
--- a/modules/webrtc/webrtc_peer_gdnative.cpp
+++ b/modules/webrtc/webrtc_data_channel_gdnative.cpp
@@ -1,12 +1,12 @@
/*************************************************************************/
-/* webrtc_peer_gdnative.cpp */
+/* webrtc_data_channel_gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
@@ -30,84 +30,106 @@
#ifdef WEBRTC_GDNATIVE_ENABLED
-#include "webrtc_peer_gdnative.h"
+#include "webrtc_data_channel_gdnative.h"
+#include "core/io/resource_loader.h"
+#include "modules/gdnative/nativescript/nativescript.h"
-void WebRTCPeerGDNative::_bind_methods() {
+void WebRTCDataChannelGDNative::_bind_methods() {
}
-WebRTCPeerGDNative::WebRTCPeerGDNative() {
+WebRTCDataChannelGDNative::WebRTCDataChannelGDNative() {
interface = NULL;
}
-WebRTCPeerGDNative::~WebRTCPeerGDNative() {
+WebRTCDataChannelGDNative::~WebRTCDataChannelGDNative() {
}
-Error WebRTCPeerGDNative::create_offer() {
+Error WebRTCDataChannelGDNative::poll() {
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
- return (Error)interface->create_offer(interface->data);
+ return (Error)interface->poll(interface->data);
}
-Error WebRTCPeerGDNative::set_local_description(String p_type, String p_sdp) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
- return (Error)interface->set_local_description(interface->data, p_type.utf8().get_data(), p_sdp.utf8().get_data());
+void WebRTCDataChannelGDNative::close() {
+ ERR_FAIL_COND(interface == NULL);
+ interface->close(interface->data);
}
-Error WebRTCPeerGDNative::set_remote_description(String p_type, String p_sdp) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
- return (Error)interface->set_remote_description(interface->data, p_type.utf8().get_data(), p_sdp.utf8().get_data());
+void WebRTCDataChannelGDNative::set_write_mode(WriteMode p_mode) {
+ ERR_FAIL_COND(interface == NULL);
+ interface->set_write_mode(interface->data, p_mode);
}
-Error WebRTCPeerGDNative::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
- return (Error)interface->add_ice_candidate(interface->data, sdpMidName.utf8().get_data(), sdpMlineIndexName, sdpName.utf8().get_data());
+WebRTCDataChannel::WriteMode WebRTCDataChannelGDNative::get_write_mode() const {
+ ERR_FAIL_COND_V(interface == NULL, WRITE_MODE_BINARY);
+ return (WriteMode)interface->get_write_mode(interface->data);
}
-Error WebRTCPeerGDNative::poll() {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
- return (Error)interface->poll(interface->data);
+bool WebRTCDataChannelGDNative::was_string_packet() const {
+ ERR_FAIL_COND_V(interface == NULL, false);
+ return interface->was_string_packet(interface->data);
}
-void WebRTCPeerGDNative::set_write_mode(WriteMode p_mode) {
- ERR_FAIL_COND(interface == NULL);
- interface->set_write_mode(interface->data, p_mode);
+WebRTCDataChannel::ChannelState WebRTCDataChannelGDNative::get_ready_state() const {
+ ERR_FAIL_COND_V(interface == NULL, STATE_CLOSED);
+ return (ChannelState)interface->get_ready_state(interface->data);
}
-WebRTCPeer::WriteMode WebRTCPeerGDNative::get_write_mode() const {
- ERR_FAIL_COND_V(interface == NULL, WRITE_MODE_BINARY);
- return (WriteMode)interface->get_write_mode(interface->data);
+String WebRTCDataChannelGDNative::get_label() const {
+ ERR_FAIL_COND_V(interface == NULL, "");
+ return String(interface->get_label(interface->data));
}
-bool WebRTCPeerGDNative::was_string_packet() const {
+bool WebRTCDataChannelGDNative::is_ordered() const {
ERR_FAIL_COND_V(interface == NULL, false);
- return interface->was_string_packet(interface->data);
+ return interface->is_ordered(interface->data);
}
-WebRTCPeer::ConnectionState WebRTCPeerGDNative::get_connection_state() const {
- ERR_FAIL_COND_V(interface == NULL, STATE_DISCONNECTED);
- return STATE_DISCONNECTED;
+int WebRTCDataChannelGDNative::get_id() const {
+ ERR_FAIL_COND_V(interface == NULL, -1);
+ return interface->get_id(interface->data);
+}
+
+int WebRTCDataChannelGDNative::get_max_packet_life_time() const {
+ ERR_FAIL_COND_V(interface == NULL, -1);
+ return interface->get_max_packet_life_time(interface->data);
+}
+
+int WebRTCDataChannelGDNative::get_max_retransmits() const {
+ ERR_FAIL_COND_V(interface == NULL, -1);
+ return interface->get_max_retransmits(interface->data);
+}
+
+String WebRTCDataChannelGDNative::get_protocol() const {
+ ERR_FAIL_COND_V(interface == NULL, "");
+ return String(interface->get_protocol(interface->data));
+}
+
+bool WebRTCDataChannelGDNative::is_negotiated() const {
+ ERR_FAIL_COND_V(interface == NULL, false);
+ return interface->is_negotiated(interface->data);
}
-Error WebRTCPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
+Error WebRTCDataChannelGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
return (Error)interface->get_packet(interface->data, r_buffer, &r_buffer_size);
}
-Error WebRTCPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
+Error WebRTCDataChannelGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
}
-int WebRTCPeerGDNative::get_max_packet_size() const {
+int WebRTCDataChannelGDNative::get_max_packet_size() const {
ERR_FAIL_COND_V(interface == NULL, 0);
return interface->get_max_packet_size(interface->data);
}
-int WebRTCPeerGDNative::get_available_packet_count() const {
+int WebRTCDataChannelGDNative::get_available_packet_count() const {
ERR_FAIL_COND_V(interface == NULL, 0);
return interface->get_available_packet_count(interface->data);
}
-void WebRTCPeerGDNative::set_native_webrtc_peer(const godot_net_webrtc_peer *p_impl) {
+void WebRTCDataChannelGDNative::set_native_webrtc_data_channel(const godot_net_webrtc_data_channel *p_impl) {
interface = p_impl;
}
diff --git a/modules/webrtc/webrtc_peer_gdnative.h b/modules/webrtc/webrtc_data_channel_gdnative.h
index 6786cec8ea..3685f86353 100644
--- a/modules/webrtc/webrtc_peer_gdnative.h
+++ b/modules/webrtc/webrtc_data_channel_gdnative.h
@@ -1,12 +1,12 @@
/*************************************************************************/
-/* webrtc_peer_gdnative.h */
+/* webrtc_data_channel_gdnative.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
@@ -30,37 +30,39 @@
#ifdef WEBRTC_GDNATIVE_ENABLED
-#ifndef WEBRTC_PEER_GDNATIVE_H
-#define WEBRTC_PEER_GDNATIVE_H
+#ifndef WEBRTC_DATA_CHANNEL_GDNATIVE_H
+#define WEBRTC_DATA_CHANNEL_GDNATIVE_H
#include "modules/gdnative/include/net/godot_net.h"
-#include "webrtc_peer.h"
+#include "webrtc_data_channel.h"
-class WebRTCPeerGDNative : public WebRTCPeer {
- GDCLASS(WebRTCPeerGDNative, WebRTCPeer);
+class WebRTCDataChannelGDNative : public WebRTCDataChannel {
+ GDCLASS(WebRTCDataChannelGDNative, WebRTCDataChannel);
protected:
static void _bind_methods();
private:
- const godot_net_webrtc_peer *interface;
+ const godot_net_webrtc_data_channel *interface;
public:
- static WebRTCPeer *_create() { return memnew(WebRTCPeerGDNative); }
- static void make_default() { WebRTCPeer::_create = WebRTCPeerGDNative::_create; }
-
- void set_native_webrtc_peer(const godot_net_webrtc_peer *p_impl);
+ void set_native_webrtc_data_channel(const godot_net_webrtc_data_channel *p_impl);
virtual void set_write_mode(WriteMode mode);
virtual WriteMode get_write_mode() const;
virtual bool was_string_packet() const;
- virtual ConnectionState get_connection_state() const;
- virtual Error create_offer();
- virtual Error set_remote_description(String type, String sdp);
- virtual Error set_local_description(String type, String sdp);
- virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName);
+ virtual ChannelState get_ready_state() const;
+ virtual String get_label() const;
+ virtual bool is_ordered() const;
+ virtual int get_id() const;
+ virtual int get_max_packet_life_time() const;
+ virtual int get_max_retransmits() const;
+ virtual String get_protocol() const;
+ virtual bool is_negotiated() const;
+
virtual Error poll();
+ virtual void close();
/** Inherited from PacketPeer: **/
virtual int get_available_packet_count() const;
@@ -69,10 +71,10 @@ public:
virtual int get_max_packet_size() const;
- WebRTCPeerGDNative();
- ~WebRTCPeerGDNative();
+ WebRTCDataChannelGDNative();
+ ~WebRTCDataChannelGDNative();
};
-#endif // WEBRTC_PEER_GDNATIVE_H
+#endif // WEBRTC_DATA_CHANNEL_GDNATIVE_H
#endif // WEBRTC_GDNATIVE_ENABLED
diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp
new file mode 100644
index 0000000000..2e7c64aa72
--- /dev/null
+++ b/modules/webrtc/webrtc_data_channel_js.cpp
@@ -0,0 +1,352 @@
+/*************************************************************************/
+/* webrtc_data_channel_js.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. */
+/*************************************************************************/
+
+#ifdef JAVASCRIPT_ENABLED
+
+#include "webrtc_data_channel_js.h"
+#include "emscripten.h"
+
+extern "C" {
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_ch_error(void *obj) {
+ WebRTCDataChannelJS *peer = static_cast<WebRTCDataChannelJS *>(obj);
+ peer->_on_error();
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_ch_open(void *obj) {
+ WebRTCDataChannelJS *peer = static_cast<WebRTCDataChannelJS *>(obj);
+ peer->_on_open();
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_ch_close(void *obj) {
+ WebRTCDataChannelJS *peer = static_cast<WebRTCDataChannelJS *>(obj);
+ peer->_on_close();
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_ch_message(void *obj, uint8_t *p_data, uint32_t p_size, bool p_is_string) {
+ WebRTCDataChannelJS *peer = static_cast<WebRTCDataChannelJS *>(obj);
+ peer->_on_message(p_data, p_size, p_is_string);
+}
+}
+
+void WebRTCDataChannelJS::_on_open() {
+ in_buffer.resize(16);
+}
+
+void WebRTCDataChannelJS::_on_close() {
+ close();
+}
+
+void WebRTCDataChannelJS::_on_error() {
+ close();
+}
+
+void WebRTCDataChannelJS::_on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string) {
+ if (in_buffer.space_left() < p_size + 5) {
+ ERR_EXPLAIN("Buffer full! Dropping data");
+ ERR_FAIL();
+ }
+
+ uint8_t is_string = p_is_string ? 1 : 0;
+ in_buffer.write((uint8_t *)&p_size, 4);
+ in_buffer.write((uint8_t *)&is_string, 1);
+ in_buffer.write(p_data, p_size);
+ queue_count++;
+}
+
+void WebRTCDataChannelJS::close() {
+ in_buffer.resize(0);
+ queue_count = 0;
+ _was_string = false;
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ if (!dict) return;
+ var channel = dict["channel"];
+ channel.onopen = null;
+ channel.onclose = null;
+ channel.onerror = null;
+ channel.onmessage = null;
+ channel.close();
+ }, _js_id);
+ /* clang-format on */
+}
+
+Error WebRTCDataChannelJS::poll() {
+ return OK;
+}
+
+WebRTCDataChannelJS::ChannelState WebRTCDataChannelJS::get_ready_state() const {
+ /* clang-format off */
+ return (ChannelState) EM_ASM_INT({
+ var dict = Module.IDHandler.get($0);
+ if (!dict) return 3; // CLOSED
+ var channel = dict["channel"];
+ switch(channel.readyState) {
+ case "connecting":
+ return 0;
+ case "open":
+ return 1;
+ case "closing":
+ return 2;
+ case "closed":
+ return 3;
+ }
+ return 3; // CLOSED
+ }, _js_id);
+ /* clang-format on */
+}
+
+int WebRTCDataChannelJS::get_available_packet_count() const {
+ return queue_count;
+}
+
+Error WebRTCDataChannelJS::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
+ ERR_FAIL_COND_V(get_ready_state() != STATE_OPEN, ERR_UNCONFIGURED);
+
+ if (queue_count == 0)
+ return ERR_UNAVAILABLE;
+
+ uint32_t to_read = 0;
+ uint32_t left = 0;
+ uint8_t is_string = 0;
+ r_buffer_size = 0;
+
+ in_buffer.read((uint8_t *)&to_read, 4);
+ --queue_count;
+ left = in_buffer.data_left();
+
+ if (left < to_read + 1) {
+ in_buffer.advance_read(left);
+ return FAILED;
+ }
+
+ in_buffer.read(&is_string, 1);
+ _was_string = is_string == 1;
+ in_buffer.read(packet_buffer, to_read);
+ *r_buffer = packet_buffer;
+ r_buffer_size = to_read;
+
+ return OK;
+}
+
+Error WebRTCDataChannelJS::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
+ ERR_FAIL_COND_V(get_ready_state() != STATE_OPEN, ERR_UNCONFIGURED);
+
+ int is_bin = _write_mode == WebRTCDataChannel::WRITE_MODE_BINARY ? 1 : 0;
+
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ var channel = dict["channel"];
+ var bytes_array = new Uint8Array($2);
+ var i = 0;
+
+ for(i=0; i<$2; i++) {
+ bytes_array[i] = getValue($1+i, 'i8');
+ }
+
+ if ($3) {
+ channel.send(bytes_array.buffer);
+ } else {
+ var string = new TextDecoder("utf-8").decode(bytes_array);
+ channel.send(string);
+ }
+ }, _js_id, p_buffer, p_buffer_size, is_bin);
+ /* clang-format on */
+
+ return OK;
+}
+
+int WebRTCDataChannelJS::get_max_packet_size() const {
+ return 1200;
+}
+
+void WebRTCDataChannelJS::set_write_mode(WriteMode p_mode) {
+ _write_mode = p_mode;
+}
+
+WebRTCDataChannel::WriteMode WebRTCDataChannelJS::get_write_mode() const {
+ return _write_mode;
+}
+
+bool WebRTCDataChannelJS::was_string_packet() const {
+ return _was_string;
+}
+
+String WebRTCDataChannelJS::get_label() const {
+ return _label;
+}
+
+/* clang-format off */
+#define _JS_GET(PROP) \
+EM_ASM_INT({ \
+ var dict = Module.IDHandler.get($0); \
+ if (!dict || !dict["channel"]) { \
+ return 0; \
+ }; \
+ return dict["channel"].PROP; \
+}, _js_id)
+/* clang-format on */
+
+bool WebRTCDataChannelJS::is_ordered() const {
+ return _JS_GET(ordered);
+}
+
+int WebRTCDataChannelJS::get_id() const {
+ return _JS_GET(id);
+}
+
+int WebRTCDataChannelJS::get_max_packet_life_time() const {
+ return _JS_GET(maxPacketLifeTime);
+}
+
+int WebRTCDataChannelJS::get_max_retransmits() const {
+ return _JS_GET(maxRetransmits);
+}
+
+String WebRTCDataChannelJS::get_protocol() const {
+ return _protocol;
+}
+
+bool WebRTCDataChannelJS::is_negotiated() const {
+ return _JS_GET(negotiated);
+}
+
+WebRTCDataChannelJS::WebRTCDataChannelJS() {
+ queue_count = 0;
+ _was_string = false;
+ _write_mode = WRITE_MODE_BINARY;
+ _js_id = 0;
+}
+
+WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) {
+ queue_count = 0;
+ _was_string = false;
+ _write_mode = WRITE_MODE_BINARY;
+ _js_id = js_id;
+
+ /* clang-format off */
+ EM_ASM({
+ var c_ptr = $0;
+ var dict = Module.IDHandler.get($1);
+ if (!dict) return;
+ var channel = dict["channel"];
+ dict["ptr"] = c_ptr;
+
+ channel.binaryType = "arraybuffer";
+ channel.onopen = function (evt) {
+ ccall("_emrtc_on_ch_open",
+ "void",
+ ["number"],
+ [c_ptr]
+ );
+ };
+ channel.onclose = function (evt) {
+ ccall("_emrtc_on_ch_close",
+ "void",
+ ["number"],
+ [c_ptr]
+ );
+ };
+ channel.onerror = function (evt) {
+ ccall("_emrtc_on_ch_error",
+ "void",
+ ["number"],
+ [c_ptr]
+ );
+ };
+ channel.onmessage = function(event) {
+ var buffer;
+ var is_string = 0;
+ if (event.data instanceof ArrayBuffer) {
+ buffer = new Uint8Array(event.data);
+ } else if (event.data instanceof Blob) {
+ console.error("Blob type not supported");
+ return;
+ } else if (typeof event.data === "string") {
+ is_string = 1;
+ var enc = new TextEncoder("utf-8");
+ buffer = new Uint8Array(enc.encode(event.data));
+ } else {
+ console.error("Unknown message type");
+ return;
+ }
+ var len = buffer.length*buffer.BYTES_PER_ELEMENT;
+ var out = Module._malloc(len);
+ Module.HEAPU8.set(buffer, out);
+ ccall("_emrtc_on_ch_message",
+ "void",
+ ["number", "number", "number", "number"],
+ [c_ptr, out, len, is_string]
+ );
+ Module._free(out);
+ }
+
+ }, this, js_id);
+ // Parse label
+ char *str;
+ str = (char *)EM_ASM_INT({
+ var dict = Module.IDHandler.get($0);
+ if (!dict || !dict["channel"]) return 0;
+ var str = dict["channel"].label;
+ var len = lengthBytesUTF8(str)+1;
+ var ptr = _malloc(str);
+ stringToUTF8(str, ptr, len+1);
+ return ptr;
+ }, js_id);
+ if(str != NULL) {
+ _label.parse_utf8(str);
+ EM_ASM({ _free($0) }, str);
+ }
+ str = (char *)EM_ASM_INT({
+ var dict = Module.IDHandler.get($0);
+ if (!dict || !dict["channel"]) return 0;
+ var str = dict["channel"].protocol;
+ var len = lengthBytesUTF8(str)+1;
+ var ptr = _malloc(str);
+ stringToUTF8(str, ptr, len+1);
+ return ptr;
+ }, js_id);
+ if(str != NULL) {
+ _protocol.parse_utf8(str);
+ EM_ASM({ _free($0) }, str);
+ }
+ /* clang-format on */
+}
+
+WebRTCDataChannelJS::~WebRTCDataChannelJS() {
+ close();
+ /* clang-format off */
+ EM_ASM({
+ Module.IDHandler.remove($0);
+ }, _js_id);
+ /* clang-format on */
+};
+#endif
diff --git a/modules/webrtc/webrtc_peer_js.h b/modules/webrtc/webrtc_data_channel_js.h
index 02f0c9b55d..b87f8e9326 100644
--- a/modules/webrtc/webrtc_peer_js.h
+++ b/modules/webrtc/webrtc_data_channel_js.h
@@ -1,12 +1,12 @@
/*************************************************************************/
-/* webrtc_peer_js.h */
+/* webrtc_data_channel_js.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
@@ -28,43 +28,53 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WEBRTC_PEER_JS_H
-#define WEBRTC_PEER_JS_H
-
#ifdef JAVASCRIPT_ENABLED
-#include "webrtc_peer.h"
+#ifndef WEBRTC_DATA_CHANNEL_JS_H
+#define WEBRTC_DATA_CHANNEL_JS_H
+
+#include "webrtc_data_channel.h"
-class WebRTCPeerJS : public WebRTCPeer {
+class WebRTCDataChannelJS : public WebRTCDataChannel {
+ GDCLASS(WebRTCDataChannelJS, WebRTCDataChannel);
private:
- enum {
- PACKET_BUFFER_SIZE = 65536 - 5 // 4 bytes for the size, 1 for for type
- };
+ String _label;
+ String _protocol;
bool _was_string;
WriteMode _write_mode;
+ enum {
+ PACKET_BUFFER_SIZE = 65536 - 5 // 4 bytes for the size, 1 for for type
+ };
+
int _js_id;
RingBuffer<uint8_t> in_buffer;
int queue_count;
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
- ConnectionState _conn_state;
public:
- static WebRTCPeer *_create() { return memnew(WebRTCPeerJS); }
- static void make_default() { WebRTCPeer::_create = WebRTCPeerJS::_create; }
+ void _on_open();
+ void _on_close();
+ void _on_error();
+ void _on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string);
virtual void set_write_mode(WriteMode mode);
virtual WriteMode get_write_mode() const;
virtual bool was_string_packet() const;
- virtual ConnectionState get_connection_state() const;
- virtual Error create_offer();
- virtual Error set_remote_description(String type, String sdp);
- virtual Error set_local_description(String type, String sdp);
- virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName);
+ virtual ChannelState get_ready_state() const;
+ virtual String get_label() const;
+ virtual bool is_ordered() const;
+ virtual int get_id() const;
+ virtual int get_max_packet_life_time() const;
+ virtual int get_max_retransmits() const;
+ virtual String get_protocol() const;
+ virtual bool is_negotiated() const;
+
virtual Error poll();
+ virtual void close();
/** Inherited from PacketPeer: **/
virtual int get_available_packet_count() const;
@@ -73,16 +83,11 @@ public:
virtual int get_max_packet_size() const;
- void close();
- void _on_open();
- void _on_close();
- void _on_error();
- void _on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string);
-
- WebRTCPeerJS();
- ~WebRTCPeerJS();
+ WebRTCDataChannelJS();
+ WebRTCDataChannelJS(int js_id);
+ ~WebRTCDataChannelJS();
};
-#endif
+#endif // WEBRTC_DATA_CHANNEL_JS_H
-#endif // WEBRTC_PEER_JS_H
+#endif // JAVASCRIPT_ENABLED
diff --git a/modules/webrtc/webrtc_peer.cpp b/modules/webrtc/webrtc_peer_connection.cpp
index 30c4505df9..69c7a51a40 100644
--- a/modules/webrtc/webrtc_peer.cpp
+++ b/modules/webrtc/webrtc_peer_connection.cpp
@@ -1,12 +1,12 @@
/*************************************************************************/
-/* webrtc_peer.cpp */
+/* webrtc_peer_connection.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* 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 */
@@ -28,43 +28,37 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "webrtc_peer.h"
+#include "webrtc_peer_connection.h"
-WebRTCPeer *(*WebRTCPeer::_create)() = NULL;
+WebRTCPeerConnection *(*WebRTCPeerConnection::_create)() = NULL;
-Ref<WebRTCPeer> WebRTCPeer::create_ref() {
+Ref<WebRTCPeerConnection> WebRTCPeerConnection::create_ref() {
- if (!_create)
- return Ref<WebRTCPeer>();
- return Ref<WebRTCPeer>(_create());
+ return create();
}
-WebRTCPeer *WebRTCPeer::create() {
+WebRTCPeerConnection *WebRTCPeerConnection::create() {
if (!_create)
return NULL;
return _create();
}
-void WebRTCPeer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("create_offer"), &WebRTCPeer::create_offer);
- ClassDB::bind_method(D_METHOD("set_local_description", "type", "sdp"), &WebRTCPeer::set_local_description);
- ClassDB::bind_method(D_METHOD("set_remote_description", "type", "sdp"), &WebRTCPeer::set_remote_description);
- ClassDB::bind_method(D_METHOD("poll"), &WebRTCPeer::poll);
- ClassDB::bind_method(D_METHOD("add_ice_candidate", "media", "index", "name"), &WebRTCPeer::add_ice_candidate);
-
- ClassDB::bind_method(D_METHOD("was_string_packet"), &WebRTCPeer::was_string_packet);
- ClassDB::bind_method(D_METHOD("set_write_mode", "write_mode"), &WebRTCPeer::set_write_mode);
- ClassDB::bind_method(D_METHOD("get_write_mode"), &WebRTCPeer::get_write_mode);
- ClassDB::bind_method(D_METHOD("get_connection_state"), &WebRTCPeer::get_connection_state);
-
- ADD_SIGNAL(MethodInfo("offer_created", PropertyInfo(Variant::STRING, "type"), PropertyInfo(Variant::STRING, "sdp")));
- ADD_SIGNAL(MethodInfo("new_ice_candidate", PropertyInfo(Variant::STRING, "media"), PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::STRING, "name")));
+void WebRTCPeerConnection::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("initialize", "configuration"), &WebRTCPeerConnection::initialize, DEFVAL(Dictionary()));
+ ClassDB::bind_method(D_METHOD("create_data_channel", "label", "options"), &WebRTCPeerConnection::create_data_channel, DEFVAL(Dictionary()));
+ ClassDB::bind_method(D_METHOD("create_offer"), &WebRTCPeerConnection::create_offer);
+ ClassDB::bind_method(D_METHOD("set_local_description", "type", "sdp"), &WebRTCPeerConnection::set_local_description);
+ ClassDB::bind_method(D_METHOD("set_remote_description", "type", "sdp"), &WebRTCPeerConnection::set_remote_description);
+ ClassDB::bind_method(D_METHOD("add_ice_candidate", "media", "index", "name"), &WebRTCPeerConnection::add_ice_candidate);
+ ClassDB::bind_method(D_METHOD("poll"), &WebRTCPeerConnection::poll);
+ ClassDB::bind_method(D_METHOD("close"), &WebRTCPeerConnection::close);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "write_mode", PROPERTY_HINT_ENUM), "set_write_mode", "get_write_mode");
+ ClassDB::bind_method(D_METHOD("get_connection_state"), &WebRTCPeerConnection::get_connection_state);
- BIND_ENUM_CONSTANT(WRITE_MODE_TEXT);
- BIND_ENUM_CONSTANT(WRITE_MODE_BINARY);
+ ADD_SIGNAL(MethodInfo("session_description_created", PropertyInfo(Variant::STRING, "type"), PropertyInfo(Variant::STRING, "sdp")));
+ ADD_SIGNAL(MethodInfo("ice_candidate_created", PropertyInfo(Variant::STRING, "media"), PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::STRING, "name")));
+ ADD_SIGNAL(MethodInfo("data_channel_received", PropertyInfo(Variant::OBJECT, "channel")));
BIND_ENUM_CONSTANT(STATE_NEW);
BIND_ENUM_CONSTANT(STATE_CONNECTING);
@@ -74,8 +68,8 @@ void WebRTCPeer::_bind_methods() {
BIND_ENUM_CONSTANT(STATE_CLOSED);
}
-WebRTCPeer::WebRTCPeer() {
+WebRTCPeerConnection::WebRTCPeerConnection() {
}
-WebRTCPeer::~WebRTCPeer() {
+WebRTCPeerConnection::~WebRTCPeerConnection() {
}
diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h
new file mode 100644
index 0000000000..7be1390dab
--- /dev/null
+++ b/modules/webrtc/webrtc_peer_connection.h
@@ -0,0 +1,74 @@
+/*************************************************************************/
+/* webrtc_peer_connection.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef WEBRTC_PEER_CONNECTION_H
+#define WEBRTC_PEER_CONNECTION_H
+
+#include "core/io/packet_peer.h"
+#include "modules/webrtc/webrtc_data_channel.h"
+
+class WebRTCPeerConnection : public Reference {
+ GDCLASS(WebRTCPeerConnection, Reference);
+
+public:
+ enum ConnectionState {
+ STATE_NEW,
+ STATE_CONNECTING,
+ STATE_CONNECTED,
+ STATE_DISCONNECTED,
+ STATE_FAILED,
+ STATE_CLOSED
+ };
+
+protected:
+ static void _bind_methods();
+ static WebRTCPeerConnection *(*_create)();
+
+public:
+ virtual ConnectionState get_connection_state() const = 0;
+
+ virtual Error initialize(Dictionary p_config = Dictionary()) = 0;
+ virtual Ref<WebRTCDataChannel> create_data_channel(String p_label, Dictionary p_options = Dictionary()) = 0;
+ virtual Error create_offer() = 0;
+ virtual Error set_remote_description(String type, String sdp) = 0;
+ virtual Error set_local_description(String type, String sdp) = 0;
+ virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) = 0;
+ virtual Error poll() = 0;
+ virtual void close() = 0;
+
+ static Ref<WebRTCPeerConnection> create_ref();
+ static WebRTCPeerConnection *create();
+
+ WebRTCPeerConnection();
+ ~WebRTCPeerConnection();
+};
+
+VARIANT_ENUM_CAST(WebRTCPeerConnection::ConnectionState);
+#endif // WEBRTC_PEER_CONNECTION_H
diff --git a/modules/webrtc/webrtc_peer_connection_gdnative.cpp b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
new file mode 100644
index 0000000000..af98aa750a
--- /dev/null
+++ b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
@@ -0,0 +1,124 @@
+/*************************************************************************/
+/* webrtc_peer_connection_gdnative.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. */
+/*************************************************************************/
+
+#ifdef WEBRTC_GDNATIVE_ENABLED
+
+#include "webrtc_peer_connection_gdnative.h"
+
+#include "core/io/resource_loader.h"
+#include "modules/gdnative/nativescript/nativescript.h"
+#include "webrtc_data_channel_gdnative.h"
+
+const godot_net_webrtc_library *WebRTCPeerConnectionGDNative::default_library = NULL;
+
+Error WebRTCPeerConnectionGDNative::set_default_library(const godot_net_webrtc_library *p_lib) {
+ if (default_library) {
+ const godot_net_webrtc_library *old = default_library;
+ default_library = NULL;
+ old->unregistered();
+ }
+ default_library = p_lib;
+ return OK; // Maybe add version check and fail accordingly
+}
+
+WebRTCPeerConnection *WebRTCPeerConnectionGDNative::_create() {
+
+ WebRTCPeerConnectionGDNative *obj = memnew(WebRTCPeerConnectionGDNative);
+ ERR_EXPLAIN("Default GDNative WebRTC implementation not defined.");
+ ERR_FAIL_COND_V(!default_library, obj);
+
+ // Call GDNative constructor
+ Error err = (Error)default_library->create_peer_connection(obj);
+ ERR_EXPLAIN("GDNative default library constructor returned an error");
+ ERR_FAIL_COND_V(err != OK, obj);
+
+ return obj;
+}
+
+void WebRTCPeerConnectionGDNative::_bind_methods() {
+}
+
+WebRTCPeerConnectionGDNative::WebRTCPeerConnectionGDNative() {
+ interface = NULL;
+}
+
+WebRTCPeerConnectionGDNative::~WebRTCPeerConnectionGDNative() {
+}
+
+Error WebRTCPeerConnectionGDNative::initialize(Dictionary p_config) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->initialize(interface->data, (const godot_dictionary *)&p_config);
+}
+
+Ref<WebRTCDataChannel> WebRTCPeerConnectionGDNative::create_data_channel(String p_label, Dictionary p_options) {
+ ERR_FAIL_COND_V(interface == NULL, NULL);
+ return (WebRTCDataChannel *)interface->create_data_channel(interface->data, p_label.utf8().get_data(), (const godot_dictionary *)&p_options);
+}
+
+Error WebRTCPeerConnectionGDNative::create_offer() {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->create_offer(interface->data);
+}
+
+Error WebRTCPeerConnectionGDNative::set_local_description(String p_type, String p_sdp) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->set_local_description(interface->data, p_type.utf8().get_data(), p_sdp.utf8().get_data());
+}
+
+Error WebRTCPeerConnectionGDNative::set_remote_description(String p_type, String p_sdp) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->set_remote_description(interface->data, p_type.utf8().get_data(), p_sdp.utf8().get_data());
+}
+
+Error WebRTCPeerConnectionGDNative::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->add_ice_candidate(interface->data, sdpMidName.utf8().get_data(), sdpMlineIndexName, sdpName.utf8().get_data());
+}
+
+Error WebRTCPeerConnectionGDNative::poll() {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->poll(interface->data);
+}
+
+void WebRTCPeerConnectionGDNative::close() {
+ ERR_FAIL_COND(interface == NULL);
+ interface->close(interface->data);
+}
+
+WebRTCPeerConnection::ConnectionState WebRTCPeerConnectionGDNative::get_connection_state() const {
+ ERR_FAIL_COND_V(interface == NULL, STATE_DISCONNECTED);
+ return (ConnectionState)interface->get_connection_state(interface->data);
+}
+
+void WebRTCPeerConnectionGDNative::set_native_webrtc_peer_connection(const godot_net_webrtc_peer_connection *p_impl) {
+ interface = p_impl;
+}
+
+#endif // WEBRTC_GDNATIVE_ENABLED
diff --git a/modules/webrtc/webrtc_peer_connection_gdnative.h b/modules/webrtc/webrtc_peer_connection_gdnative.h
new file mode 100644
index 0000000000..0a281c3d89
--- /dev/null
+++ b/modules/webrtc/webrtc_peer_connection_gdnative.h
@@ -0,0 +1,73 @@
+/*************************************************************************/
+/* webrtc_peer_connection_gdnative.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifdef WEBRTC_GDNATIVE_ENABLED
+
+#ifndef WEBRTC_PEER_CONNECTION_GDNATIVE_H
+#define WEBRTC_PEER_CONNECTION_GDNATIVE_H
+
+#include "modules/gdnative/include/net/godot_net.h"
+#include "webrtc_peer_connection.h"
+
+class WebRTCPeerConnectionGDNative : public WebRTCPeerConnection {
+ GDCLASS(WebRTCPeerConnectionGDNative, WebRTCPeerConnection);
+
+protected:
+ static void _bind_methods();
+ static WebRTCPeerConnection *_create();
+
+private:
+ static const godot_net_webrtc_library *default_library;
+ const godot_net_webrtc_peer_connection *interface;
+
+public:
+ static Error set_default_library(const godot_net_webrtc_library *p_library);
+ static void make_default() { WebRTCPeerConnection::_create = WebRTCPeerConnectionGDNative::_create; }
+
+ void set_native_webrtc_peer_connection(const godot_net_webrtc_peer_connection *p_impl);
+
+ virtual ConnectionState get_connection_state() const;
+
+ virtual Error initialize(Dictionary p_config = Dictionary());
+ virtual Ref<WebRTCDataChannel> create_data_channel(String p_label, Dictionary p_options = Dictionary());
+ virtual Error create_offer();
+ virtual Error set_remote_description(String type, String sdp);
+ virtual Error set_local_description(String type, String sdp);
+ virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName);
+ virtual Error poll();
+ virtual void close();
+
+ WebRTCPeerConnectionGDNative();
+ ~WebRTCPeerConnectionGDNative();
+};
+
+#endif // WEBRTC_PEER_CONNECTION_GDNATIVE_H
+
+#endif // WEBRTC_GDNATIVE_ENABLED
diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp
new file mode 100644
index 0000000000..9758ab3644
--- /dev/null
+++ b/modules/webrtc/webrtc_peer_connection_js.cpp
@@ -0,0 +1,314 @@
+/*************************************************************************/
+/* webrtc_peer_connection_js.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. */
+/*************************************************************************/
+
+#ifdef JAVASCRIPT_ENABLED
+
+#include "webrtc_peer_connection_js.h"
+
+#include "webrtc_data_channel_js.h"
+
+#include "core/io/json.h"
+#include "emscripten.h"
+
+extern "C" {
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_ice_candidate(void *obj, char *p_MidName, int p_MlineIndexName, char *p_sdpName) {
+ WebRTCPeerConnectionJS *peer = static_cast<WebRTCPeerConnectionJS *>(obj);
+ peer->emit_signal("ice_candidate_created", String(p_MidName), p_MlineIndexName, String(p_sdpName));
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_session_description_created(void *obj, char *p_type, char *p_offer) {
+ WebRTCPeerConnectionJS *peer = static_cast<WebRTCPeerConnectionJS *>(obj);
+ peer->emit_signal("session_description_created", String(p_type), String(p_offer));
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_connection_state_changed(void *obj) {
+ WebRTCPeerConnectionJS *peer = static_cast<WebRTCPeerConnectionJS *>(obj);
+ peer->_on_connection_state_changed();
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_on_error() {
+ ERR_PRINT("RTCPeerConnection error!");
+}
+
+EMSCRIPTEN_KEEPALIVE void _emrtc_emit_channel(void *obj, int p_id) {
+ WebRTCPeerConnectionJS *peer = static_cast<WebRTCPeerConnectionJS *>(obj);
+ peer->emit_signal("data_channel_received", Ref<WebRTCDataChannelJS>(new WebRTCDataChannelJS(p_id)));
+}
+}
+
+void _emrtc_create_pc(int p_id, const Dictionary &p_config) {
+ String config = JSON::print(p_config);
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ var c_ptr = dict["ptr"];
+ var config = JSON.parse(UTF8ToString($1));
+ // Setup local connaction
+ var conn = null;
+ try {
+ conn = new RTCPeerConnection(config);
+ } catch (e) {
+ console.log(e);
+ return;
+ }
+ conn.oniceconnectionstatechange = function(event) {
+ if (!Module.IDHandler.get($0)) return;
+ ccall("_emrtc_on_connection_state_changed", "void", ["number"], [c_ptr]);
+ };
+ conn.onicecandidate = function(event) {
+ if (!Module.IDHandler.get($0)) return;
+ if (!event.candidate) return;
+
+ var c = event.candidate;
+ // should emit on ice candidate
+ ccall("_emrtc_on_ice_candidate",
+ "void",
+ ["number", "string", "number", "string"],
+ [c_ptr, c.sdpMid, c.sdpMLineIndex, c.candidate]
+ );
+ };
+ conn.ondatachannel = function (evt) {
+ var dict = Module.IDHandler.get($0);
+ if (!dict) {
+ return;
+ }
+ var id = Module.IDHandler.add({"channel": evt.channel, "ptr": null});
+ ccall("_emrtc_emit_channel",
+ "void",
+ ["number", "number"],
+ [c_ptr, id]
+ );
+ };
+ dict["conn"] = conn;
+ }, p_id, config.utf8().get_data());
+ /* clang-format on */
+}
+
+void WebRTCPeerConnectionJS::_on_connection_state_changed() {
+ /* clang-format off */
+ _conn_state = (ConnectionState)EM_ASM_INT({
+ var dict = Module.IDHandler.get($0);
+ if (!dict) return 5; // CLOSED
+ var conn = dict["conn"];
+ switch(conn.iceConnectionState) {
+ case "new":
+ return 0;
+ case "checking":
+ return 1;
+ case "connected":
+ case "completed":
+ return 2;
+ case "disconnected":
+ return 3;
+ case "failed":
+ return 4;
+ case "closed":
+ return 5;
+ }
+ return 5; // CLOSED
+ }, _js_id);
+ /* clang-format on */
+}
+
+void WebRTCPeerConnectionJS::close() {
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ if (!dict) return;
+ if (dict["conn"]) {
+ dict["conn"].close();
+ }
+ }, _js_id);
+ /* clang-format on */
+ _conn_state = STATE_CLOSED;
+}
+
+Error WebRTCPeerConnectionJS::create_offer() {
+ ERR_FAIL_COND_V(_conn_state != STATE_NEW, FAILED);
+
+ _conn_state = STATE_CONNECTING;
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ var conn = dict["conn"];
+ var c_ptr = dict["ptr"];
+ var onError = function(error) {
+ console.error(error);
+ ccall("_emrtc_on_error", "void", [], []);
+ };
+ var onCreated = function(offer) {
+ ccall("_emrtc_session_description_created",
+ "void",
+ ["number", "string", "string"],
+ [c_ptr, offer.type, offer.sdp]
+ );
+ };
+ conn.createOffer().then(onCreated).catch(onError);
+ }, _js_id);
+ /* clang-format on */
+ return OK;
+}
+
+Error WebRTCPeerConnectionJS::set_local_description(String type, String sdp) {
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ var conn = dict["conn"];
+ var c_ptr = dict["ptr"];
+ var type = UTF8ToString($1);
+ var sdp = UTF8ToString($2);
+ var onError = function(error) {
+ console.error(error);
+ ccall("_emrtc_on_error", "void", [], []);
+ };
+ conn.setLocalDescription({
+ "sdp": sdp,
+ "type": type
+ }).catch(onError);
+ }, _js_id, type.utf8().get_data(), sdp.utf8().get_data());
+ /* clang-format on */
+ return OK;
+}
+
+Error WebRTCPeerConnectionJS::set_remote_description(String type, String sdp) {
+ if (type == "offer") {
+ ERR_FAIL_COND_V(_conn_state != STATE_NEW, FAILED);
+ _conn_state = STATE_CONNECTING;
+ }
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ var conn = dict["conn"];
+ var c_ptr = dict["ptr"];
+ var type = UTF8ToString($1);
+ var sdp = UTF8ToString($2);
+
+ var onError = function(error) {
+ console.error(error);
+ ccall("_emrtc_on_error", "void", [], []);
+ };
+ var onCreated = function(offer) {
+ ccall("_emrtc_session_description_created",
+ "void",
+ ["number", "string", "string"],
+ [c_ptr, offer.type, offer.sdp]
+ );
+ };
+ var onSet = function() {
+ if (type != "offer") {
+ return;
+ }
+ conn.createAnswer().then(onCreated);
+ };
+ conn.setRemoteDescription({
+ "sdp": sdp,
+ "type": type
+ }).then(onSet).catch(onError);
+ }, _js_id, type.utf8().get_data(), sdp.utf8().get_data());
+ /* clang-format on */
+ return OK;
+}
+
+Error WebRTCPeerConnectionJS::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) {
+ /* clang-format off */
+ EM_ASM({
+ var dict = Module.IDHandler.get($0);
+ var conn = dict["conn"];
+ var c_ptr = dict["ptr"];
+ var sdpMidName = UTF8ToString($1);
+ var sdpMlineIndexName = UTF8ToString($2);
+ var sdpName = UTF8ToString($3);
+ conn.addIceCandidate(new RTCIceCandidate({
+ "candidate": sdpName,
+ "sdpMid": sdpMidName,
+ "sdpMlineIndex": sdpMlineIndexName
+ }));
+ }, _js_id, sdpMidName.utf8().get_data(), sdpMlineIndexName, sdpName.utf8().get_data());
+ /* clang-format on */
+ return OK;
+}
+
+Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
+ _emrtc_create_pc(_js_id, p_config);
+ return OK;
+}
+
+Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(String p_channel, Dictionary p_channel_config) {
+ String config = JSON::print(p_channel_config);
+ /* clang-format off */
+ int id = EM_ASM_INT({
+ try {
+ var dict = Module.IDHandler.get($0);
+ if (!dict) return 0;
+ var label = UTF8ToString($1);
+ var config = JSON.parse(UTF8ToString($2));
+ var conn = dict["conn"];
+ return Module.IDHandler.add({
+ "channel": conn.createDataChannel(label, config),
+ "ptr": null
+ })
+ } catch (e) {
+ return 0;
+ }
+ }, _js_id, p_channel.utf8().get_data(), config.utf8().get_data());
+ /* clang-format on */
+ ERR_FAIL_COND_V(id == 0, NULL);
+ return memnew(WebRTCDataChannelJS(id));
+}
+
+Error WebRTCPeerConnectionJS::poll() {
+ return OK;
+}
+
+WebRTCPeerConnection::ConnectionState WebRTCPeerConnectionJS::get_connection_state() const {
+ return _conn_state;
+}
+
+WebRTCPeerConnectionJS::WebRTCPeerConnectionJS() {
+ _conn_state = STATE_NEW;
+
+ /* clang-format off */
+ _js_id = EM_ASM_INT({
+ return Module.IDHandler.add({"conn": null, "ptr": $0});
+ }, this);
+ /* clang-format on */
+ Dictionary config;
+ _emrtc_create_pc(_js_id, config);
+}
+
+WebRTCPeerConnectionJS::~WebRTCPeerConnectionJS() {
+ close();
+ /* clang-format off */
+ EM_ASM({
+ Module.IDHandler.remove($0);
+ }, _js_id);
+ /* clang-format on */
+};
+#endif
diff --git a/modules/webrtc/webrtc_peer_connection_js.h b/modules/webrtc/webrtc_peer_connection_js.h
new file mode 100644
index 0000000000..43c0e3d6ee
--- /dev/null
+++ b/modules/webrtc/webrtc_peer_connection_js.h
@@ -0,0 +1,66 @@
+/*************************************************************************/
+/* webrtc_peer_connection_js.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef WEBRTC_PEER_CONNECTION_JS_H
+#define WEBRTC_PEER_CONNECTION_JS_H
+
+#ifdef JAVASCRIPT_ENABLED
+
+#include "webrtc_peer_connection.h"
+
+class WebRTCPeerConnectionJS : public WebRTCPeerConnection {
+
+private:
+ int _js_id;
+ ConnectionState _conn_state;
+
+public:
+ static WebRTCPeerConnection *_create() { return memnew(WebRTCPeerConnectionJS); }
+ static void make_default() { WebRTCPeerConnection::_create = WebRTCPeerConnectionJS::_create; }
+
+ void _on_connection_state_changed();
+ virtual ConnectionState get_connection_state() const;
+
+ virtual Error initialize(Dictionary configuration = Dictionary());
+ virtual Ref<WebRTCDataChannel> create_data_channel(String p_channel_name, Dictionary p_channel_config = Dictionary());
+ virtual Error create_offer();
+ virtual Error set_remote_description(String type, String sdp);
+ virtual Error set_local_description(String type, String sdp);
+ virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName);
+ virtual Error poll();
+ virtual void close();
+
+ WebRTCPeerConnectionJS();
+ ~WebRTCPeerConnectionJS();
+};
+
+#endif
+
+#endif // WEBRTC_PEER_CONNECTION_JS_H
diff --git a/modules/webrtc/webrtc_peer_js.cpp b/modules/webrtc/webrtc_peer_js.cpp
deleted file mode 100644
index 1282e075ab..0000000000
--- a/modules/webrtc/webrtc_peer_js.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-/*************************************************************************/
-/* webrtc_peer_js.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifdef JAVASCRIPT_ENABLED
-
-#include "webrtc_peer_js.h"
-#include "emscripten.h"
-
-extern "C" {
-EMSCRIPTEN_KEEPALIVE void _emrtc_on_ice_candidate(void *obj, char *p_MidName, int p_MlineIndexName, char *p_sdpName) {
- WebRTCPeerJS *peer = static_cast<WebRTCPeerJS *>(obj);
- peer->emit_signal("new_ice_candidate", String(p_MidName), p_MlineIndexName, String(p_sdpName));
-}
-
-EMSCRIPTEN_KEEPALIVE void _emrtc_offer_created(void *obj, char *p_type, char *p_offer) {
- WebRTCPeerJS *peer = static_cast<WebRTCPeerJS *>(obj);
- peer->emit_signal("offer_created", String(p_type), String(p_offer));
-}
-
-EMSCRIPTEN_KEEPALIVE void _emrtc_on_error(void *obj) {
- WebRTCPeerJS *peer = static_cast<WebRTCPeerJS *>(obj);
- peer->_on_error();
-}
-
-EMSCRIPTEN_KEEPALIVE void _emrtc_on_open(void *obj) {
- WebRTCPeerJS *peer = static_cast<WebRTCPeerJS *>(obj);
- peer->_on_open();
-}
-
-EMSCRIPTEN_KEEPALIVE void _emrtc_on_close(void *obj) {
- WebRTCPeerJS *peer = static_cast<WebRTCPeerJS *>(obj);
- peer->_on_close();
-}
-
-EMSCRIPTEN_KEEPALIVE void _emrtc_on_message(void *obj, uint8_t *p_data, uint32_t p_size, bool p_is_string) {
- WebRTCPeerJS *peer = static_cast<WebRTCPeerJS *>(obj);
- peer->_on_message(p_data, p_size, p_is_string);
-}
-
-EMSCRIPTEN_KEEPALIVE void _emrtc_bind_channel(int p_id) {
- /* clang-format off */
- EM_ASM({
- if (!Module.IDHandler.has($0)) {
- return; // Godot Object is gone!
- }
- var dict = Module.IDHandler.get($0);
- var channel = dict["channel"];
- var c_ptr = dict["ptr"];
-
- channel.onopen = function (evt) {
- ccall("_emrtc_on_open",
- "void",
- ["number"],
- [c_ptr]
- );
- };
- channel.onclose = function (evt) {
- ccall("_emrtc_on_close",
- "void",
- ["number"],
- [c_ptr]
- );
- };
- channel.onerror = function (evt) {
- ccall("_emrtc_on_error",
- "void",
- ["number"],
- [c_ptr]
- );
- };
-
- channel.binaryType = "arraybuffer";
- channel.onmessage = function(event) {
- var buffer;
- var is_string = 0;
- if (event.data instanceof ArrayBuffer) {
-
- buffer = new Uint8Array(event.data);
-
- } else if (event.data instanceof Blob) {
-
- alert("Blob type not supported");
- return;
-
- } else if (typeof event.data === "string") {
-
- is_string = 1;
- var enc = new TextEncoder("utf-8");
- buffer = new Uint8Array(enc.encode(event.data));
-
- } else {
-
- alert("Unknown message type");
- return;
-
- }
- var len = buffer.length*buffer.BYTES_PER_ELEMENT;
- var out = Module._malloc(len);
- Module.HEAPU8.set(buffer, out);
- ccall("_emrtc_on_message",
- "void",
- ["number", "number", "number", "number"],
- [c_ptr, out, len, is_string]
- );
- Module._free(out);
- }
- }, p_id);
- /* clang-format on */
-}
-}
-
-void _emrtc_create_pc(int p_id) {
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- var c_ptr = dict["ptr"];
- // Setup local connaction
- var conn = new RTCPeerConnection();
- conn.onicecandidate = function(event) {
- if (!Module.IDHandler.get($0)) return;
- if (!event.candidate) return;
-
- var c = event.candidate;
- // should emit on ice candidate
- ccall("_emrtc_on_ice_candidate",
- "void",
- ["number", "string", "number", "string"],
- [c_ptr, c.sdpMid, c.sdpMLineIndex, c.candidate]
- );
- };
- conn.ondatachannel = function (evt) {
- var dict = Module.IDHandler.get($0);
- if (!dict || dict["channel"]) {
- return;
- }
- var channel = evt.channel;
- dict["channel"] = channel;
- ccall("_emrtc_bind_channel",
- "void",
- ["number"],
- [$0]
- );
- };
- dict["conn"] = conn;
- }, p_id);
- /* clang-format on */
-}
-
-void WebRTCPeerJS::_on_open() {
- in_buffer.resize(16);
- _conn_state = STATE_CONNECTED;
-}
-
-void WebRTCPeerJS::_on_close() {
- close();
-}
-
-void WebRTCPeerJS::_on_error() {
- close();
- _conn_state = STATE_FAILED;
-}
-
-void WebRTCPeerJS::_on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string) {
- if (in_buffer.space_left() < p_size + 5) {
- ERR_EXPLAIN("Buffer full! Dropping data");
- ERR_FAIL();
- }
-
- uint8_t is_string = p_is_string ? 1 : 0;
- in_buffer.write((uint8_t *)&p_size, 4);
- in_buffer.write((uint8_t *)&is_string, 1);
- in_buffer.write(p_data, p_size);
- queue_count++;
-}
-
-void WebRTCPeerJS::close() {
- in_buffer.resize(0);
- queue_count = 0;
- _was_string = false;
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- if (!dict) return;
- if (dict["channel"]) {
- dict["channel"].close();
- dict["channel"] = null;
- }
- if (dict["conn"]) {
- dict["conn"].close();
- }
- }, _js_id);
- /* clang-format on */
- _conn_state = STATE_CLOSED;
-}
-
-Error WebRTCPeerJS::create_offer() {
- ERR_FAIL_COND_V(_conn_state != STATE_NEW, FAILED);
-
- _conn_state = STATE_CONNECTING;
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- var conn = dict["conn"];
- var c_ptr = dict["ptr"];
- var onError = function(error) {
- console.log(error);
- ccall("_emrtc_on_error",
- "void",
- ["number"],
- [c_ptr]
- );
- };
- var onCreated = function(offer) {
- ccall("_emrtc_offer_created",
- "void",
- ["number", "string", "string"],
- [c_ptr, offer.type, offer.sdp]
- );
- };
-
- var channel = conn.createDataChannel("default");
- dict["channel"] = channel;
- ccall("_emrtc_bind_channel",
- "void",
- ["number"],
- [$0]
- );
- conn.createOffer().then(onCreated).catch(onError);
- }, _js_id);
- /* clang-format on */
- return OK;
-}
-
-Error WebRTCPeerJS::set_local_description(String type, String sdp) {
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- var conn = dict["conn"];
- var c_ptr = dict["ptr"];
- var type = UTF8ToString($1);
- var sdp = UTF8ToString($2);
- var onError = function(error) {
- console.log(error);
- ccall("_emrtc_on_error",
- "void",
- ["number"],
- [c_ptr]
- );
- };
- conn.setLocalDescription({
- "sdp": sdp,
- "type": type
- }).catch(onError);
- }, _js_id, type.utf8().get_data(), sdp.utf8().get_data());
- /* clang-format on */
- return OK;
-}
-
-Error WebRTCPeerJS::set_remote_description(String type, String sdp) {
- if (type == "offer") {
- ERR_FAIL_COND_V(_conn_state != STATE_NEW, FAILED);
- _conn_state = STATE_CONNECTING;
- }
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- var conn = dict["conn"];
- var c_ptr = dict["ptr"];
- var type = UTF8ToString($1);
- var sdp = UTF8ToString($2);
-
- var onError = function(error) {
- console.log(error);
- ccall("_emrtc_on_error",
- "void",
- ["number"],
- [c_ptr]
- );
- };
- var onCreated = function(offer) {
- ccall("_emrtc_offer_created",
- "void",
- ["number", "string", "string"],
- [c_ptr, offer.type, offer.sdp]
- );
- };
- var onSet = function() {
- if (type != "offer") {
- return;
- }
- conn.createAnswer().then(onCreated);
- };
- conn.setRemoteDescription({
- "sdp": sdp,
- "type": type
- }).then(onSet).catch(onError);
- }, _js_id, type.utf8().get_data(), sdp.utf8().get_data());
- /* clang-format on */
- return OK;
-}
-
-Error WebRTCPeerJS::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) {
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- var conn = dict["conn"];
- var c_ptr = dict["ptr"];
- var sdpMidName = UTF8ToString($1);
- var sdpMlineIndexName = UTF8ToString($2);
- var sdpName = UTF8ToString($3);
- conn.addIceCandidate(new RTCIceCandidate({
- "candidate": sdpName,
- "sdpMid": sdpMidName,
- "sdpMlineIndex": sdpMlineIndexName
- }));
- }, _js_id, sdpMidName.utf8().get_data(), sdpMlineIndexName, sdpName.utf8().get_data());
- /* clang-format on */
- return OK;
-}
-
-Error WebRTCPeerJS::poll() {
- return OK;
-}
-
-WebRTCPeer::ConnectionState WebRTCPeerJS::get_connection_state() const {
- return _conn_state;
-}
-
-int WebRTCPeerJS::get_available_packet_count() const {
- return queue_count;
-}
-
-Error WebRTCPeerJS::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
- ERR_FAIL_COND_V(_conn_state != STATE_CONNECTED, ERR_UNCONFIGURED);
-
- if (queue_count == 0)
- return ERR_UNAVAILABLE;
-
- uint32_t to_read = 0;
- uint32_t left = 0;
- uint8_t is_string = 0;
- r_buffer_size = 0;
-
- in_buffer.read((uint8_t *)&to_read, 4);
- --queue_count;
- left = in_buffer.data_left();
-
- if (left < to_read + 1) {
- in_buffer.advance_read(left);
- return FAILED;
- }
-
- in_buffer.read(&is_string, 1);
- _was_string = is_string == 1;
- in_buffer.read(packet_buffer, to_read);
- *r_buffer = packet_buffer;
- r_buffer_size = to_read;
-
- return OK;
-}
-
-Error WebRTCPeerJS::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
- ERR_FAIL_COND_V(_conn_state != STATE_CONNECTED, ERR_UNCONFIGURED);
-
- int is_bin = _write_mode == WebRTCPeer::WRITE_MODE_BINARY ? 1 : 0;
-
- /* clang-format off */
- EM_ASM({
- var dict = Module.IDHandler.get($0);
- var channel = dict["channel"];
- var bytes_array = new Uint8Array($2);
- var i = 0;
-
- for(i=0; i<$2; i++) {
- bytes_array[i] = getValue($1+i, 'i8');
- }
-
- if ($3) {
- channel.send(bytes_array.buffer);
- } else {
- var string = new TextDecoder("utf-8").decode(bytes_array);
- channel.send(string);
- }
- }, _js_id, p_buffer, p_buffer_size, is_bin);
- /* clang-format on */
-
- return OK;
-}
-
-int WebRTCPeerJS::get_max_packet_size() const {
- return 1200;
-}
-
-void WebRTCPeerJS::set_write_mode(WriteMode p_mode) {
- _write_mode = p_mode;
-}
-
-WebRTCPeer::WriteMode WebRTCPeerJS::get_write_mode() const {
- return _write_mode;
-}
-
-bool WebRTCPeerJS::was_string_packet() const {
- return _was_string;
-}
-
-WebRTCPeerJS::WebRTCPeerJS() {
- queue_count = 0;
- _was_string = false;
- _write_mode = WRITE_MODE_BINARY;
- _conn_state = STATE_NEW;
-
- /* clang-format off */
- _js_id = EM_ASM_INT({
- return Module.IDHandler.add({"conn": null, "ptr": $0, "channel": null});
- }, this);
- /* clang-format on */
- _emrtc_create_pc(_js_id);
-}
-
-WebRTCPeerJS::~WebRTCPeerJS() {
- close();
- /* clang-format off */
- EM_ASM({
- Module.IDHandler.remove($0);
- }, _js_id);
- /* clang-format on */
-};
-#endif
diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub
index 12b4969cf7..d9e60eb6f1 100644
--- a/modules/websocket/SCsub
+++ b/modules/websocket/SCsub
@@ -9,90 +9,85 @@ env_lws = env_modules.Clone()
if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # already builtin for javascript
thirdparty_dir = "#thirdparty/libwebsockets/"
- helper_dir = "#thirdparty/libwebsockets/win32helpers/"
+ helper_dir = "win32helpers/"
thirdparty_sources = [
- "lib/core/adopt.c",
- "lib/core/alloc.c",
- "lib/core/connect.c",
- "lib/core/context.c",
- "lib/core/dummy-callback.c",
- "lib/core/libwebsockets.c",
- "lib/core/output.c",
- "lib/core/pollfd.c",
- "lib/core/service.c",
-
- "lib/event-libs/poll/poll.c",
-
- "lib/misc/base64-decode.c",
- "lib/misc/lejp.c",
- "lib/misc/sha-1.c",
-
- "lib/roles/h1/ops-h1.c",
- "lib/roles/http/header.c",
- "lib/roles/http/client/client.c",
- "lib/roles/http/client/client-handshake.c",
- "lib/roles/http/server/fops-zip.c",
- "lib/roles/http/server/lejp-conf.c",
- "lib/roles/http/server/parsers.c",
- "lib/roles/http/server/server.c",
- "lib/roles/listen/ops-listen.c",
- "lib/roles/pipe/ops-pipe.c",
- "lib/roles/raw-skt/ops-raw-skt.c",
- "lib/roles/raw-file/ops-raw-file.c",
-
- "lib/roles/ws/client-ws.c",
- "lib/roles/ws/client-parser-ws.c",
- "lib/roles/ws/ops-ws.c",
- "lib/roles/ws/server-ws.c",
-
- "lib/tls/tls.c",
- "lib/tls/tls-client.c",
- "lib/tls/tls-server.c",
-
- "lib/tls/mbedtls/wrapper/library/ssl_cert.c",
- "lib/tls/mbedtls/wrapper/library/ssl_pkey.c",
- "lib/tls/mbedtls/wrapper/library/ssl_stack.c",
- "lib/tls/mbedtls/wrapper/library/ssl_methods.c",
- "lib/tls/mbedtls/wrapper/library/ssl_lib.c",
- "lib/tls/mbedtls/wrapper/library/ssl_x509.c",
- "lib/tls/mbedtls/wrapper/platform/ssl_port.c",
- "lib/tls/mbedtls/wrapper/platform/ssl_pm.c",
- "lib/tls/mbedtls/lws-genhash.c",
- "lib/tls/mbedtls/mbedtls-client.c",
- "lib/tls/mbedtls/lws-genrsa.c",
- "lib/tls/mbedtls/ssl.c",
- "lib/tls/mbedtls/mbedtls-server.c"
+ "core/alloc.c",
+ "core/context.c",
+ "core/libwebsockets.c",
+ "core/output.c",
+ "core/pollfd.c",
+ "core/service.c",
+
+ "event-libs/poll/poll.c",
+
+ "misc/base64-decode.c",
+ "misc/lejp.c",
+ "misc/sha-1.c",
+
+ "roles/h1/ops-h1.c",
+ "roles/http/header.c",
+ "roles/http/client/client.c",
+ "roles/http/client/client-handshake.c",
+ "roles/http/server/fops-zip.c",
+ "roles/http/server/lejp-conf.c",
+ "roles/http/server/parsers.c",
+ "roles/http/server/server.c",
+ "roles/listen/ops-listen.c",
+ "roles/pipe/ops-pipe.c",
+ "roles/raw/ops-raw.c",
+
+ "roles/ws/client-ws.c",
+ "roles/ws/client-parser-ws.c",
+ "roles/ws/ops-ws.c",
+ "roles/ws/server-ws.c",
+
+ "tls/tls.c",
+ "tls/tls-client.c",
+ "tls/tls-server.c",
+
+ "tls/mbedtls/wrapper/library/ssl_cert.c",
+ "tls/mbedtls/wrapper/library/ssl_pkey.c",
+ "tls/mbedtls/wrapper/library/ssl_stack.c",
+ "tls/mbedtls/wrapper/library/ssl_methods.c",
+ "tls/mbedtls/wrapper/library/ssl_lib.c",
+ "tls/mbedtls/wrapper/library/ssl_x509.c",
+ "tls/mbedtls/wrapper/platform/ssl_port.c",
+ "tls/mbedtls/wrapper/platform/ssl_pm.c",
+ "tls/mbedtls/lws-genhash.c",
+ "tls/mbedtls/mbedtls-client.c",
+ "tls/mbedtls/lws-genrsa.c",
+ "tls/mbedtls/ssl.c",
+ "tls/mbedtls/mbedtls-server.c"
]
if env["platform"] == "android": # Builtin getifaddrs
- thirdparty_sources += ["lib/misc/getifaddrs.c"]
-
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources += ["misc/getifaddrs.c"]
if env["platform"] == "windows" or env["platform"] == "uwp": # Winsock
- thirdparty_sources += Glob(thirdparty_dir + "lib/plat/windows/*.c") + [helper_dir + src for src in ["getopt.c", "getopt_long.c", "gettimeofday.c"]]
+ thirdparty_sources += ["plat/lws-plat-win.c", helper_dir + "getopt.c", helper_dir + "getopt_long.c", helper_dir + "gettimeofday.c"]
else: # Unix socket
- thirdparty_sources += Glob(thirdparty_dir + "lib/plat/unix/*.c")
+ thirdparty_sources += ["plat/lws-plat-unix.c"]
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_lws.Append(CPPPATH=[thirdparty_dir + 'include/'])
+ env_lws.Prepend(CPPPATH=[thirdparty_dir])
if env['builtin_mbedtls']:
mbedtls_includes = "#thirdparty/mbedtls/include"
env_lws.Prepend(CPPPATH=[mbedtls_includes])
- wrapper_includes = ["#thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
+ wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
env_lws.Prepend(CPPPATH=wrapper_includes)
if env["platform"] == "windows" or env["platform"] == "uwp":
- env_lws.Append(CPPPATH=[helper_dir])
+ env_lws.Prepend(CPPPATH=[thirdparty_dir + helper_dir])
if env["platform"] == "uwp":
env_lws.Append(CPPFLAGS=["/DLWS_MINGW_SUPPORT"])
env_thirdparty = env_lws.Clone()
env_thirdparty.disable_warnings()
- env_thirdparty.Append(CPPPATH=[thirdparty_dir + 'lib/'])
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
env_lws.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp
index d09558ab22..08df76293b 100644
--- a/modules/websocket/lws_client.cpp
+++ b/modules/websocket/lws_client.cpp
@@ -32,11 +32,10 @@
#include "lws_client.h"
#include "core/io/ip.h"
-#include "core/io/stream_peer_ssl.h"
#include "core/project_settings.h"
#if defined(LWS_OPENSSL_SUPPORT)
-// Not openssl, just the mbedtls wrapper
-#include "openssl/ssl.h"
+#include "core/io/stream_peer_ssl.h"
+#include "tls/mbedtls/wrapper/include/openssl/ssl.h"
#endif
Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocols) {
diff --git a/modules/xatlas_unwrap/SCsub b/modules/xatlas_unwrap/SCsub
index 7a40945f27..50e3cb1551 100644
--- a/modules/xatlas_unwrap/SCsub
+++ b/modules/xatlas_unwrap/SCsub
@@ -13,7 +13,7 @@ if env['builtin_xatlas']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_xatlas_unwrap.Append(CPPPATH=[thirdparty_dir])
+ env_xatlas_unwrap.Prepend(CPPPATH=[thirdparty_dir])
# upstream uses c++11
if (not env.msvc):
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 6c67067db7..b7641172e4 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -214,13 +214,14 @@ def configure(env):
lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
## Compile flags
-
- if env['android_stl']:
+ # Disable exceptions and rtti on non-tools (template) builds
+ if env['tools'] or env['android_stl']:
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/include"])
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"])
env.Append(CXXFLAGS=['-frtti', "-std=gnu++14"])
else:
env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions'])
+ # Don't use dynamic_cast, necessary with no-rtti.
env.Append(CPPFLAGS=['-DNO_SAFE_CAST'])
ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
@@ -299,9 +300,9 @@ def configure(env):
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
'/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
- env.Append(CPPPATH=['#platform/android'])
+ env.Prepend(CPPPATH=['#platform/android'])
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL'])
- env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl'])
+ env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'GLESv2', 'android', 'log', 'z', 'dl'])
# Return NDK version string in source.properties (adapted from the Chromium project).
def get_ndk_version(path):
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 2a3d0843a8..b987b3aebd 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -617,7 +617,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String dst_path = p_path.replace_first("res://", "assets/");
store_in_apk(ed, dst_path, p_data, _should_compress_asset(p_path, p_data) ? Z_DEFLATED : 0);
- ed->ep->step("File: " + p_path, 3 + p_file * 100 / p_total);
+ if (ed->ep->step("File: " + p_path, 3 + p_file * 100 / p_total)) {
+ return ERR_SKIP;
+ }
return OK;
}
@@ -1255,7 +1257,9 @@ public:
}
//export_temp
- ep.step("Exporting APK", 0);
+ if (ep.step("Exporting APK", 0)) {
+ return ERR_SKIP;
+ }
const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
const bool use_reverse = devices[p_device].api_level >= 21;
@@ -1278,7 +1282,9 @@ public:
String package_name = p_preset->get("package/unique_name");
if (remove_prev) {
- ep.step("Uninstalling...", 1);
+ if (ep.step("Uninstalling...", 1)) {
+ return ERR_SKIP;
+ }
print_line("Uninstalling previous version: " + devices[p_device].name);
@@ -1291,7 +1297,9 @@ public:
}
print_line("Installing to device (please wait...): " + devices[p_device].name);
- ep.step("Installing to device (please wait...)", 2);
+ if (ep.step("Installing to device (please wait...)", 2)) {
+ return ERR_SKIP;
+ }
args.clear();
args.push_back("-s");
@@ -1357,7 +1365,9 @@ public:
}
}
- ep.step("Running on Device...", 3);
+ if (ep.step("Running on Device...", 3)) {
+ return ERR_SKIP;
+ }
args.clear();
args.push_back("-s");
args.push_back(devices[p_device].id);
@@ -1763,7 +1773,7 @@ public:
String src_apk;
- EditorProgress ep("export", "Exporting for Android", 105);
+ EditorProgress ep("export", "Exporting for Android", 105, true);
if (bool(p_preset->get("custom_package/use_custom_build"))) { //custom build
//re-generate build.gradle and AndroidManifest.xml
@@ -1855,7 +1865,9 @@ public:
FileAccess *src_f = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- ep.step("Creating APK", 0);
+ if (ep.step("Creating APK", 0)) {
+ return ERR_SKIP;
+ }
unzFile pkg = unzOpen2(src_apk.utf8().get_data(), &io);
if (!pkg) {
@@ -1864,7 +1876,6 @@ public:
return ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!pkg, ERR_CANT_OPEN);
int ret = unzGoToFirstFile(pkg);
zlib_filefunc_def io2 = io;
@@ -1998,7 +2009,9 @@ public:
ret = unzGoToNextFile(pkg);
}
- ep.step("Adding Files...", 1);
+ if (ep.step("Adding Files...", 1)) {
+ return ERR_SKIP;
+ }
Error err = OK;
Vector<String> cl = cmdline.strip_edges().split(" ");
for (int i = 0; i < cl.size(); i++) {
@@ -2136,14 +2149,18 @@ public:
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
}
- ep.step("Signing debug APK...", 103);
+ if (ep.step("Signing debug APK...", 103)) {
+ return ERR_SKIP;
+ }
} else {
keystore = release_keystore;
password = release_password;
user = release_username;
- ep.step("Signing release APK...", 103);
+ if (ep.step("Signing release APK...", 103)) {
+ return ERR_SKIP;
+ }
}
if (!FileAccess::exists(keystore)) {
@@ -2175,7 +2192,9 @@ public:
return ERR_CANT_CREATE;
}
- ep.step("Verifying APK...", 104);
+ if (ep.step("Verifying APK...", 104)) {
+ return ERR_SKIP;
+ }
args.clear();
args.push_back("-verify");
@@ -2195,7 +2214,9 @@ public:
static const int ZIP_ALIGNMENT = 4;
- ep.step("Aligning APK...", 105);
+ if (ep.step("Aligning APK...", 105)) {
+ return ERR_SKIP;
+ }
unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
if (!tmp_unaligned) {
@@ -2204,7 +2225,6 @@ public:
return ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN);
ret = unzGoToFirstFile(tmp_unaligned);
io2 = io;
diff --git a/platform/android/java/AndroidManifest.xml b/platform/android/java/AndroidManifest.xml
index 613d24fbd2..9997950137 100644
--- a/platform/android/java/AndroidManifest.xml
+++ b/platform/android/java/AndroidManifest.xml
@@ -22,7 +22,7 @@
<!--Anything in this line after the icon will be erased when doing custom build. If you want to add tags manually, do before it.-->
<application android:label="@string/godot_project_name_string" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@drawable/icon">
-<!--The following values are replaced when Godot exports, modifying them here has no effect. Do theses changes in the-->
+<!--The following values are replaced when Godot exports, modifying them here has no effect. Do these changes in the-->
<!--export preset. Adding new ones is fine.-->
<activity android:name="org.godotengine.godot.Godot"
diff --git a/platform/android/java/gradlew.bat b/platform/android/java/gradlew.bat
index e95643d6a2..f9553162f1 100644
--- a/platform/android/java/gradlew.bat
+++ b/platform/android/java/gradlew.bat
@@ -1,84 +1,84 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java
index 31ca9a8500..81c98bcc79 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java
@@ -68,8 +68,8 @@ public class GodotLib {
public static native void singleton(String p_name, Object p_object);
public static native void method(String p_sname, String p_name, String p_ret, String[] p_params);
public static native String getGlobal(String p_key);
- public static native void callobject(int p_ID, String p_method, Object[] p_params);
- public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
+ public static native void callobject(int p_id, String p_method, Object[] p_params);
+ public static native void calldeferred(int p_id, String p_method, Object[] p_params);
public static native void requestPermissionResult(String p_permission, boolean p_result);
public static native void setVirtualKeyboardHeight(int p_height);
diff --git a/platform/android/java_godot_io_wrapper.cpp b/platform/android/java_godot_io_wrapper.cpp
index 0c41b85939..ade7c03d58 100644
--- a/platform/android/java_godot_io_wrapper.cpp
+++ b/platform/android/java_godot_io_wrapper.cpp
@@ -52,7 +52,7 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc
_get_locale = p_env->GetMethodID(cls, "getLocale", "()Ljava/lang/String;");
_get_model = p_env->GetMethodID(cls, "getModel", "()Ljava/lang/String;");
_get_screen_DPI = p_env->GetMethodID(cls, "getScreenDPI", "()I");
- _get_unique_ID = p_env->GetMethodID(cls, "getUniqueID", "()Ljava/lang/String;");
+ _get_unique_id = p_env->GetMethodID(cls, "getUniqueID", "()Ljava/lang/String;");
_show_keyboard = p_env->GetMethodID(cls, "showKeyboard", "(Ljava/lang/String;)V");
_hide_keyboard = p_env->GetMethodID(cls, "hideKeyboard", "()V");
_set_screen_orientation = p_env->GetMethodID(cls, "setScreenOrientation", "(I)V");
@@ -122,9 +122,9 @@ int GodotIOJavaWrapper::get_screen_dpi() {
}
String GodotIOJavaWrapper::get_unique_id() {
- if (_get_unique_ID) {
+ if (_get_unique_id) {
JNIEnv *env = ThreadAndroid::get_env();
- jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_unique_ID);
+ jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_unique_id);
return jstring_to_string(s, env);
} else {
return String();
diff --git a/platform/android/java_godot_io_wrapper.h b/platform/android/java_godot_io_wrapper.h
index 920c433b08..100e50fd66 100644
--- a/platform/android/java_godot_io_wrapper.h
+++ b/platform/android/java_godot_io_wrapper.h
@@ -50,7 +50,7 @@ private:
jmethodID _get_locale = 0;
jmethodID _get_model = 0;
jmethodID _get_screen_DPI = 0;
- jmethodID _get_unique_ID = 0;
+ jmethodID _get_unique_id = 0;
jmethodID _show_keyboard = 0;
jmethodID _hide_keyboard = 0;
jmethodID _set_screen_orientation = 0;
diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h
index 3a03294b08..f99935bf7c 100644
--- a/platform/android/java_godot_lib_jni.h
+++ b/platform/android/java_godot_lib_jni.h
@@ -35,7 +35,7 @@
#include <jni.h>
// These functions can be called from within JAVA and are the means by which our JAVA implementation calls back into our C++ code.
-// See java/src/org/godotengine/godot/GodotLib.java for the JAVA side of this (yes thats why we have the long names)
+// See java/src/org/godotengine/godot/GodotLib.java for the JAVA side of this (yes that's why we have the long names)
extern "C" {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jobject obj, jobject activity, jobject p_asset_manager, jboolean p_use_apk_expansion);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ondestroy(JNIEnv *env);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 93d39859f2..ff1632cba8 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -277,7 +277,7 @@ Size2 OS_Android::get_window_size() const {
return Vector2(default_videomode.width, default_videomode.height);
}
-String OS_Android::get_name() {
+String OS_Android::get_name() const {
return "Android";
}
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index d2198b0579..4dbc96f4da 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -139,7 +139,7 @@ public:
virtual Size2 get_window_size() const;
- virtual String get_name();
+ virtual String get_name() const;
virtual MainLoop *get_main_loop() const;
virtual bool can_draw() const;
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 874b1ab1fb..f33c77a407 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -137,7 +137,7 @@ def configure(env):
if not env['builtin_miniupnpc']:
# No pkgconfig file so far, hardcode default paths.
- env.Append(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
+ env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
@@ -147,7 +147,7 @@ def configure(env):
## Flags
- env.Append(CPPPATH=['#platform/haiku'])
+ env.Prepend(CPPPATH=['#platform/haiku'])
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
# env.Append(CPPFLAGS=['-DFREETYPE_ENABLED'])
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index f3fed6669b..438b50053f 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -69,7 +69,7 @@ void OS_Haiku::run() {
main_loop->finish();
}
-String OS_Haiku::get_name() {
+String OS_Haiku::get_name() const {
return "Haiku";
}
diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h
index 6ab006843a..e1d4cf8d87 100644
--- a/platform/haiku/os_haiku.h
+++ b/platform/haiku/os_haiku.h
@@ -74,7 +74,7 @@ public:
OS_Haiku();
void run();
- virtual String get_name();
+ virtual String get_name() const;
virtual MainLoop *get_main_loop() const;
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index d56e28a4af..d9f710e456 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -115,10 +115,12 @@ def configure(env):
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
- if env['ios_exceptions']:
- env.Append(CCFLAGS=['-fexceptions'])
- else:
- env.Append(CCFLAGS=['-fno-exceptions'])
+ # Disable exceptions on non-tools (template) builds
+ if not env['tools']:
+ if env['ios_exceptions']:
+ env.Append(CCFLAGS=['-fexceptions'])
+ else:
+ env.Append(CCFLAGS=['-fno-exceptions'])
## Link flags
@@ -165,12 +167,12 @@ def configure(env):
if env['icloud']:
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
- env.Append(CPPPATH=['$IPHONESDK/usr/include',
- '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
- '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
- ])
+ env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
+ '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
+ '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
+ ])
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
- env.Append(CPPPATH=['#platform/iphone'])
+ env.Prepend(CPPPATH=['#platform/iphone'])
env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DCOREAUDIO_ENABLED'])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 85d4b9e847..ba405ab7ae 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -819,7 +819,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
String dest_dir = p_path.get_base_dir() + "/";
String binary_name = p_path.get_file().get_basename();
- EditorProgress ep("export", "Exporting for iOS", 5);
+ EditorProgress ep("export", "Exporting for iOS", 5, true);
String team_id = p_preset->get("application/app_store_team_id");
ERR_EXPLAIN("App Store Team ID not specified - cannot configure the project.");
@@ -868,14 +868,18 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
memdelete(da);
}
- ep.step("Making .pck", 0);
+ if (ep.step("Making .pck", 0)) {
+ return ERR_SKIP;
+ }
String pack_path = dest_dir + binary_name + ".pck";
Vector<SharedObject> libraries;
Error err = save_pack(p_preset, pack_path, &libraries);
if (err)
return err;
- ep.step("Extracting and configuring Xcode project", 1);
+ if (ep.step("Extracting and configuring Xcode project", 1)) {
+ return ERR_SKIP;
+ }
String library_to_use = "libgodot.iphone." + String(p_debug ? "debug" : "release") + ".fat.a";
@@ -920,7 +924,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
EditorNode::add_io_error("Could not open export template (not a zip file?):\n" + src_pkg_name);
return ERR_CANT_OPEN;
}
- ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN);
+
int ret = unzGoToFirstFile(src_pkg_zip);
Vector<uint8_t> project_file_data;
while (ret == UNZ_OK) {
@@ -1053,7 +1057,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
memdelete(f);
#ifdef OSX_ENABLED
- ep.step("Code-signing dylibs", 2);
+ if (ep.step("Code-signing dylibs", 2)) {
+ return ERR_SKIP;
+ }
DirAccess *dylibs_dir = DirAccess::open(dest_dir + binary_name + "/dylibs");
ERR_FAIL_COND_V(!dylibs_dir, ERR_CANT_OPEN);
CodesignData codesign_data(p_preset, p_debug);
@@ -1061,7 +1067,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
memdelete(dylibs_dir);
ERR_FAIL_COND_V(err, err);
- ep.step("Making .xcarchive", 3);
+ if (ep.step("Making .xcarchive", 3)) {
+ return ERR_SKIP;
+ }
String archive_path = p_path.get_basename() + ".xcarchive";
List<String> archive_args;
archive_args.push_back("-project");
@@ -1080,7 +1088,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
err = OS::get_singleton()->execute("xcodebuild", archive_args, true);
ERR_FAIL_COND_V(err, err);
- ep.step("Making .ipa", 4);
+ if (ep.step("Making .ipa", 4)) {
+ return ERR_SKIP;
+ }
List<String> export_args;
export_args.push_back("-exportArchive");
export_args.push_back("-archivePath");
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index e25efc813b..6a65cadf09 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -84,14 +84,14 @@ void OSIPhone::set_data_dir(String p_dir) {
memdelete(da);
};
-void OSIPhone::set_unique_id(String p_ID) {
+void OSIPhone::set_unique_id(String p_id) {
- unique_ID = p_ID;
+ unique_id = p_id;
};
String OSIPhone::get_unique_id() const {
- return unique_ID;
+ return unique_id;
};
void OSIPhone::initialize_core() {
@@ -495,7 +495,7 @@ String OSIPhone::get_user_data_dir() const {
return data_dir;
};
-String OSIPhone::get_name() {
+String OSIPhone::get_name() const {
return "iOS";
};
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 49c6475cf9..017125209c 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -107,7 +107,7 @@ private:
void queue_event(const Ref<InputEvent> &p_event);
String data_dir;
- String unique_ID;
+ String unique_id;
String locale_code;
InputDefault *input;
@@ -174,7 +174,7 @@ public:
void set_data_dir(String p_dir);
- virtual String get_name();
+ virtual String get_name() const;
Error shell_open(String p_uri);
@@ -183,7 +183,7 @@ public:
void set_locale(String p_locale);
String get_locale() const;
- void set_unique_id(String p_ID);
+ void set_unique_id(String p_id);
String get_unique_id() const;
virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index c7acbde3f7..145ac42863 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -103,17 +103,19 @@ def configure(env):
## Compile flags
- env.Append(CPPPATH=['#platform/javascript'])
+ env.Prepend(CPPPATH=['#platform/javascript'])
env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED'])
# No multi-threading (SharedArrayBuffer) available yet,
# once feasible also consider memory buffer size issues.
env.Append(CPPDEFINES=['NO_THREADS'])
- # These flags help keep the file size down.
- env.Append(CCFLAGS=['-fno-exceptions', '-fno-rtti'])
- # Don't use dynamic_cast, necessary with no-rtti.
- env.Append(CPPDEFINES=['NO_SAFE_CAST'])
+ # Disable exceptions and rtti on non-tools (template) builds
+ if not env['tools']:
+ # These flags help keep the file size down.
+ env.Append(CCFLAGS=['-fno-exceptions', '-fno-rtti'])
+ # Don't use dynamic_cast, necessary with no-rtti.
+ env.Append(CPPDEFINES=['NO_SAFE_CAST'])
if env['javascript_eval']:
env.Append(CPPDEFINES=['JAVASCRIPT_EVAL_ENABLED'])
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 34781ce365..c69e6f0cb8 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -1035,7 +1035,7 @@ void OS_JavaScript::finalize() {
// Miscellaneous
-Error OS_JavaScript::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
+Error OS_JavaScript::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
ERR_EXPLAIN("OS::execute() is not available on the HTML5 platform");
ERR_FAIL_V(ERR_UNAVAILABLE);
@@ -1159,7 +1159,7 @@ Error OS_JavaScript::shell_open(String p_uri) {
return OK;
}
-String OS_JavaScript::get_name() {
+String OS_JavaScript::get_name() const {
return "HTML5";
}
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index a9f9e23463..a0c7c31f2d 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -137,7 +137,7 @@ public:
void run_async();
bool main_loop_iterate();
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
@@ -146,7 +146,7 @@ public:
virtual void set_icon(const Ref<Image> &p_icon);
String get_executable_path() const;
virtual Error shell_open(String p_uri);
- virtual String get_name();
+ virtual String get_name() const;
virtual bool can_draw() const;
virtual String get_resource_dir() const;
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index ed8a955ae5..e19fdf1b9f 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -77,7 +77,12 @@ static void handle_crash(int sig) {
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
String _execpath = OS::get_singleton()->get_executable_path();
- String msg = GLOBAL_GET("debug/settings/crash_handler/message");
+
+ String msg;
+ const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
+ if (proj_settings) {
+ msg = proj_settings->get("debug/settings/crash_handler/message");
+ }
// Dump the backtrace to stderr with a message to the user
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 8024897195..4c88f91d13 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -126,7 +126,7 @@ def configure(env):
## Flags
- env.Append(CPPPATH=['#platform/osx'])
+ env.Prepend(CPPPATH=['#platform/osx'])
env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo'])
env.Append(LIBS=['pthread'])
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 1a63d6ff75..9dabbb12fc 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -121,7 +121,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine"));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.icns"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0"));
@@ -409,7 +409,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
String src_pkg_name;
- EditorProgress ep("export", "Exporting for OSX", 3);
+ EditorProgress ep("export", "Exporting for OSX", 3, true);
if (p_debug)
src_pkg_name = p_preset->get("custom_package/debug");
@@ -432,7 +432,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
FileAccess *src_f = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- ep.step("Creating app", 0);
+ if (ep.step("Creating app", 0)) {
+ return ERR_SKIP;
+ }
unzFile src_pkg_zip = unzOpen2(src_pkg_name.utf8().get_data(), &io);
if (!src_pkg_zip) {
@@ -441,7 +443,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
return ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN);
int ret = unzGoToFirstFile(src_pkg_zip);
String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + ".64";
@@ -543,11 +544,21 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
iconpath = ProjectSettings::get_singleton()->get("application/config/icon");
if (iconpath != "") {
- Ref<Image> icon;
- icon.instance();
- icon->load(iconpath);
- if (!icon->empty()) {
- _make_icon(icon, data);
+ if (iconpath.get_extension() == "icns") {
+ FileAccess *icon = FileAccess::open(iconpath, FileAccess::READ);
+ if (icon) {
+ data.resize(icon->get_len());
+ icon->get_buffer(&data.write[0], icon->get_len());
+ icon->close();
+ memdelete(icon);
+ }
+ } else {
+ Ref<Image> icon;
+ icon.instance();
+ icon->load(iconpath);
+ if (!icon->empty()) {
+ _make_icon(icon, data);
+ }
}
}
//bleh?
@@ -617,7 +628,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
if (err == OK) {
- ep.step("Making PKG", 1);
+ if (ep.step("Making PKG", 1)) {
+ return ERR_SKIP;
+ }
if (export_format == "dmg") {
String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck";
@@ -639,7 +652,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
if (err == OK && identity != "") {
- ep.step("Code signing bundle", 2);
+ if (ep.step("Code signing bundle", 2)) {
+ return ERR_SKIP;
+ }
// the order in which we code sign is important, this is a bit of a shame or we could do this in our loop that extracts the files from our ZIP
@@ -664,7 +679,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
// and finally create a DMG
if (err == OK) {
- ep.step("Making DMG", 3);
+ if (ep.step("Making DMG", 3)) {
+ return ERR_SKIP;
+ }
err = _create_dmg(p_path, pkg_name, tmp_app_path_name);
}
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 125a88ab6d..212966af11 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -165,7 +165,7 @@ public:
void wm_minimized(bool p_minimized);
- virtual String get_name();
+ virtual String get_name() const;
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
@@ -186,6 +186,7 @@ public:
virtual Size2 get_window_size() const;
virtual Size2 get_real_window_size() const;
+ virtual void set_native_icon(const String &p_filename);
virtual void set_icon(const Ref<Image> &p_icon);
virtual MainLoop *get_main_loop() const;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index fec524c04b..113c6636f0 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1551,7 +1551,7 @@ void OS_OSX::delete_main_loop() {
main_loop = NULL;
}
-String OS_OSX::get_name() {
+String OS_OSX::get_name() const {
return "OSX";
}
@@ -1858,6 +1858,31 @@ void OS_OSX::set_window_title(const String &p_title) {
[window_object setTitle:[NSString stringWithUTF8String:p_title.utf8().get_data()]];
}
+void OS_OSX::set_native_icon(const String &p_filename) {
+
+ FileAccess *f = FileAccess::open(p_filename, FileAccess::READ);
+ ERR_FAIL_COND(!f);
+
+ Vector<uint8_t> data;
+ uint32_t len = f->get_len();
+ data.resize(len);
+ f->get_buffer((uint8_t *)&data.write[0], len);
+ memdelete(f);
+
+ NSData *icon_data = [[[NSData alloc] initWithBytes:&data.write[0] length:len] autorelease];
+ if (!icon_data) {
+ ERR_EXPLAIN("Error reading icon data");
+ ERR_FAIL();
+ }
+ NSImage *icon = [[[NSImage alloc] initWithData:icon_data] autorelease];
+ if (!icon) {
+ ERR_EXPLAIN("Error loading icon");
+ ERR_FAIL();
+ }
+
+ [NSApp setApplicationIconImage:icon];
+}
+
void OS_OSX::set_icon(const Ref<Image> &p_icon) {
Ref<Image> img = p_icon;
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 5306a2bf69..08c2eb6aaf 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -201,7 +201,7 @@ def configure(env):
if not env['builtin_miniupnpc']:
# No pkgconfig file so far, hardcode default paths.
- env.Append(CPPPATH=["/usr/include/miniupnpc"])
+ env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
@@ -215,7 +215,7 @@ def configure(env):
if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
- env.Append(CPPPATH=['#platform/server'])
+ env.Prepend(CPPPATH=['#platform/server'])
env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
if (platform.system() == "Darwin"):
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 53f2a65c8e..12e53054bc 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -190,7 +190,7 @@ bool OS_Server::can_draw() const {
return false; //can never draw
};
-String OS_Server::get_name() {
+String OS_Server::get_name() const {
return "Server";
}
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 7441064790..e3488a693d 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -93,7 +93,7 @@ protected:
virtual void set_main_loop(MainLoop *p_main_loop);
public:
- virtual String get_name();
+ virtual String get_name() const;
virtual void set_mouse_show(bool p_show);
virtual void set_mouse_grab(bool p_grab);
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 17f8242466..00f419f4f0 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -77,7 +77,7 @@ def configure(env):
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
- env.Append(CPPPATH=[angle_root + '/include'])
+ env.Prepend(CPPPATH=[angle_root + '/include'])
jobs = str(env.GetOption("num_jobs"))
angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
@@ -137,7 +137,7 @@ def configure(env):
## Compile flags
- env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
+ env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows'])
env.Append(CPPFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
env.Append(CPPFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
winver = "0x0602" # Windows 8 is the minimum target for UWP build
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index a0ab398f89..cdcad33f6d 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -187,7 +187,7 @@ class AppxPackager {
public:
void set_progress_task(String p_task) { progress_task = p_task; }
void init(FileAccess *p_fa);
- void add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress = false);
+ Error add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress = false);
void finish();
AppxPackager();
@@ -468,10 +468,12 @@ void AppxPackager::init(FileAccess *p_fa) {
tmp_content_types_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpcontenttypes.xml");
}
-void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
+Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
if (p_file_no >= 1 && p_total_files >= 1) {
- EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files);
+ if (EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files)) {
+ return ERR_SKIP;
+ }
}
FileMeta meta;
@@ -584,6 +586,8 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
package->store_buffer(file_buffer.ptr(), file_buffer.size());
file_metadata.push_back(meta);
+
+ return OK;
}
void AppxPackager::finish() {
@@ -1008,9 +1012,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
AppxPackager *packager = (AppxPackager *)p_userdata;
String dst_path = p_path.replace_first("res://", "game/");
- packager->add_file(dst_path, p_data.ptr(), p_data.size(), p_file, p_total, _should_compress_asset(p_path, p_data));
-
- return OK;
+ return packager->add_file(dst_path, p_data.ptr(), p_data.size(), p_file, p_total, _should_compress_asset(p_path, p_data));
}
public:
@@ -1230,7 +1232,7 @@ public:
String src_appx;
- EditorProgress ep("export", "Exporting for Windows Universal", 7);
+ EditorProgress ep("export", "Exporting for Windows Universal", 7, true);
if (p_debug)
src_appx = p_preset->get("custom_template/debug");
@@ -1280,7 +1282,9 @@ public:
FileAccess *src_f = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- ep.step("Creating package...", 0);
+ if (ep.step("Creating package...", 0)) {
+ return ERR_SKIP;
+ }
unzFile pkg = unzOpen2(src_appx.utf8().get_data(), &io);
@@ -1292,7 +1296,9 @@ public:
int ret = unzGoToFirstFile(pkg);
- ep.step("Copying template files...", 1);
+ if (ep.step("Copying template files...", 1)) {
+ return ERR_SKIP;
+ }
EditorNode::progress_add_task("template_files", "Template files", 100);
packager.set_progress_task("template_files");
@@ -1341,14 +1347,19 @@ public:
print_line("ADDING: " + path);
- packager.add_file(path, data.ptr(), data.size(), template_file_no++, template_files_amount, _should_compress_asset(path, data));
+ err = packager.add_file(path, data.ptr(), data.size(), template_file_no++, template_files_amount, _should_compress_asset(path, data));
+ if (err != OK) {
+ return err;
+ }
ret = unzGoToNextFile(pkg);
}
EditorNode::progress_end_task("template_files");
- ep.step("Creating command line...", 2);
+ if (ep.step("Creating command line...", 2)) {
+ return ERR_SKIP;
+ }
Vector<String> cl = ((String)p_preset->get("command_line/extra_args")).strip_edges().split(" ");
for (int i = 0; i < cl.size(); i++) {
@@ -1382,9 +1393,14 @@ public:
print_line(itos(i) + " param: " + cl[i]);
}
- packager.add_file("__cl__.cl", clf.ptr(), clf.size(), -1, -1, false);
+ err = packager.add_file("__cl__.cl", clf.ptr(), clf.size(), -1, -1, false);
+ if (err != OK) {
+ return err;
+ }
- ep.step("Adding project files...", 3);
+ if (ep.step("Adding project files...", 3)) {
+ return ERR_SKIP;
+ }
EditorNode::progress_add_task("project_files", "Project Files", 100);
packager.set_progress_task("project_files");
@@ -1393,7 +1409,9 @@ public:
EditorNode::progress_end_task("project_files");
- ep.step("Closing package...", 7);
+ if (ep.step("Closing package...", 7)) {
+ return ERR_SKIP;
+ }
unzClose(pkg);
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 82f09032f5..f9d22481dd 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -530,7 +530,7 @@ OS::VideoMode OS_UWP::get_video_mode(int p_screen) const {
void OS_UWP::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
}
-String OS_UWP::get_name() {
+String OS_UWP::get_name() const {
return "UWP";
}
@@ -713,7 +713,7 @@ void OS_UWP::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
// TODO
}
-Error OS_UWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
+Error OS_UWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
return FAILED;
};
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 00f79efb04..1bb68bc75d 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -195,7 +195,7 @@ public:
virtual MainLoop *get_main_loop() const;
- virtual String get_name();
+ virtual String get_name() const;
virtual Date get_date(bool utc) const;
virtual Time get_time(bool utc) const;
@@ -208,7 +208,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
virtual Error kill(const ProcessID &p_pid);
virtual bool has_environment(const String &p_var) const;
diff --git a/platform/windows/crash_handler_windows.cpp b/platform/windows/crash_handler_windows.cpp
index 4006c4c60e..0716ee67f4 100644
--- a/platform/windows/crash_handler_windows.cpp
+++ b/platform/windows/crash_handler_windows.cpp
@@ -166,11 +166,16 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
line.SizeOfStruct = sizeof(line);
IMAGE_NT_HEADERS *h = ImageNtHeader(base);
DWORD image_type = h->FileHeader.Machine;
- int n = 0;
- String msg = GLOBAL_GET("debug/settings/crash_handler/message");
+
+ String msg;
+ const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
+ if (proj_settings) {
+ msg = proj_settings->get("debug/settings/crash_handler/message");
+ }
fprintf(stderr, "Dumping the backtrace. %ls\n", msg.c_str());
+ int n = 0;
do {
if (skip_first) {
skip_first = false;
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 5c38eebf04..4b4b507499 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -201,7 +201,7 @@ def configure_msvc(env, manual_msvc_config):
env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++
if manual_msvc_config: # should be automatic if SCons found it
if os.getenv("WindowsSdkDir") is not None:
- env.Append(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
+ env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
else:
print("Missing environment variable: WindowsSdkDir")
@@ -239,7 +239,7 @@ def configure_msvc(env, manual_msvc_config):
env.AppendUnique(LINKFLAGS=['/LTCG'])
if manual_msvc_config:
- env.Append(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
+ env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
# Incremental linking fix
@@ -342,7 +342,7 @@ def configure_mingw(env):
def configure(env):
# At this point the env has been set up with basic tools/compilers.
- env.Append(CPPPATH=['#platform/windows'])
+ env.Prepend(CPPPATH=['#platform/windows'])
print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 0b61770d87..e3494a1dbf 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -705,7 +705,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
} else if (mouse_mode != MOUSE_MODE_CAPTURED) {
- // for reasons unknown to mankind, wheel comes in screen cordinates
+ // for reasons unknown to mankind, wheel comes in screen coordinates
POINT coords;
coords.x = mb->get_position().x;
coords.y = mb->get_position().y;
@@ -2119,7 +2119,7 @@ void OS_Windows::request_attention() {
FlashWindowEx(&info);
}
-String OS_Windows::get_name() {
+String OS_Windows::get_name() const {
return "Windows";
}
@@ -2577,6 +2577,117 @@ String OS_Windows::get_executable_path() const {
return s;
}
+void OS_Windows::set_native_icon(const String &p_filename) {
+
+ FileAccess *f = FileAccess::open(p_filename, FileAccess::READ);
+ ERR_FAIL_COND(!f);
+
+ ICONDIR *icon_dir = (ICONDIR *)memalloc(sizeof(ICONDIR));
+ int pos = 0;
+
+ icon_dir->idReserved = f->get_32();
+ pos += sizeof(WORD);
+ f->seek(pos);
+
+ icon_dir->idType = f->get_32();
+ pos += sizeof(WORD);
+ f->seek(pos);
+
+ if (icon_dir->idType != 1) {
+ ERR_EXPLAIN("Invalid icon file format!");
+ ERR_FAIL();
+ }
+
+ icon_dir->idCount = f->get_32();
+ pos += sizeof(WORD);
+ f->seek(pos);
+
+ icon_dir = (ICONDIR *)memrealloc(icon_dir, 3 * sizeof(WORD) + icon_dir->idCount * sizeof(ICONDIRENTRY));
+ f->get_buffer((uint8_t *)&icon_dir->idEntries[0], icon_dir->idCount * sizeof(ICONDIRENTRY));
+
+ int small_icon_index = -1; // Select 16x16 with largest color count
+ int small_icon_cc = 0;
+ int big_icon_index = -1; // Select largest
+ int big_icon_width = 16;
+ int big_icon_cc = 0;
+
+ for (int i = 0; i < icon_dir->idCount; i++) {
+ int colors = (icon_dir->idEntries[i].bColorCount == 0) ? 32768 : icon_dir->idEntries[i].bColorCount;
+ int width = (icon_dir->idEntries[i].bWidth == 0) ? 256 : icon_dir->idEntries[i].bWidth;
+ if (width == 16) {
+ if (colors >= small_icon_cc) {
+ small_icon_index = i;
+ small_icon_cc = colors;
+ }
+ }
+ if (width >= big_icon_width) {
+ if (colors >= big_icon_cc) {
+ big_icon_index = i;
+ big_icon_width = width;
+ big_icon_cc = colors;
+ }
+ }
+ }
+
+ if (big_icon_index == -1) {
+ ERR_EXPLAIN("No valid icons found!");
+ ERR_FAIL();
+ }
+
+ if (small_icon_index == -1) {
+ WARN_PRINTS("No small icon found, reusing " + itos(big_icon_width) + "x" + itos(big_icon_width) + " @" + itos(big_icon_cc) + " icon!");
+ small_icon_index = big_icon_index;
+ small_icon_cc = big_icon_cc;
+ }
+
+ // Read the big icon
+ DWORD bytecount_big = icon_dir->idEntries[big_icon_index].dwBytesInRes;
+ Vector<uint8_t> data_big;
+ data_big.resize(bytecount_big);
+ pos = icon_dir->idEntries[big_icon_index].dwImageOffset;
+ f->seek(pos);
+ f->get_buffer((uint8_t *)&data_big.write[0], bytecount_big);
+ HICON icon_big = CreateIconFromResource((PBYTE)&data_big.write[0], bytecount_big, TRUE, 0x00030000);
+ if (!icon_big) {
+ ERR_EXPLAIN("Could not create " + itos(big_icon_width) + "x" + itos(big_icon_width) + " @" + itos(big_icon_cc) + " icon, error: " + format_error_message(GetLastError()));
+ ERR_FAIL();
+ }
+
+ // Read the small icon
+ DWORD bytecount_small = icon_dir->idEntries[small_icon_index].dwBytesInRes;
+ Vector<uint8_t> data_small;
+ data_small.resize(bytecount_small);
+ pos = icon_dir->idEntries[small_icon_index].dwImageOffset;
+ f->seek(pos);
+ f->get_buffer((uint8_t *)&data_small.write[0], bytecount_small);
+ HICON icon_small = CreateIconFromResource((PBYTE)&data_small.write[0], bytecount_small, TRUE, 0x00030000);
+ if (!icon_small) {
+ ERR_EXPLAIN("Could not create 16x16 @" + itos(small_icon_cc) + " icon, error: " + format_error_message(GetLastError()));
+ ERR_FAIL();
+ }
+
+ // Online tradition says to be sure last error is cleared and set the small icon first
+ int err = 0;
+ SetLastError(err);
+
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)icon_small);
+ err = GetLastError();
+ if (err) {
+ ERR_EXPLAIN("Error setting ICON_SMALL: " + format_error_message(err));
+ ERR_FAIL();
+ }
+
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)icon_big);
+ err = GetLastError();
+ if (err) {
+ ERR_EXPLAIN("Error setting ICON_BIG: " + format_error_message(err));
+ ERR_FAIL();
+ }
+
+ memdelete(f);
+ memdelete(icon_dir);
+}
+
void OS_Windows::set_icon(const Ref<Image> &p_icon) {
ERR_FAIL_COND(!p_icon.is_valid());
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 0e0b9bf3f6..0aacbcb9ff 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -58,6 +58,25 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
+typedef struct {
+ BYTE bWidth; // Width, in pixels, of the image
+ BYTE bHeight; // Height, in pixels, of the image
+ BYTE bColorCount; // Number of colors in image (0 if >=8bpp)
+ BYTE bReserved; // Reserved ( must be 0)
+ WORD wPlanes; // Color Planes
+ WORD wBitCount; // Bits per pixel
+ DWORD dwBytesInRes; // How many bytes in this resource?
+ DWORD dwImageOffset; // Where in the file is this image?
+} ICONDIRENTRY, *LPICONDIRENTRY;
+
+typedef struct {
+ WORD idReserved; // Reserved (must be 0)
+ WORD idType; // Resource Type (1 for icons)
+ WORD idCount; // How many images?
+ ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em)
+} ICONDIR, *LPICONDIR;
+
class JoypadWindows;
class OS_Windows : public OS {
@@ -246,7 +265,7 @@ public:
virtual MainLoop *get_main_loop() const;
- virtual String get_name();
+ virtual String get_name() const;
virtual Date get_date(bool utc) const;
virtual Time get_time(bool utc) const;
@@ -276,6 +295,8 @@ public:
CursorShape get_cursor_shape() const;
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
void GetMaskBitmaps(HBITMAP hSourceBitmap, COLORREF clrTransparent, OUT HBITMAP &hAndMaskBitmap, OUT HBITMAP &hXorMaskBitmap);
+
+ void set_native_icon(const String &p_filename);
void set_icon(const Ref<Image> &p_icon);
virtual String get_executable_path() const;
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index aadf7ee36d..9718b03164 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -191,6 +191,7 @@ Error ContextGL_X11::initialize() {
swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa);
+ XStoreName(x11_display, x11_window, "Godot Engine");
ERR_FAIL_COND_V(!x11_window, ERR_UNCONFIGURED);
set_class_hint(x11_display, x11_window);
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index 1e7f393bdd..ca7251078f 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -53,7 +53,12 @@ static void handle_crash(int sig) {
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
String _execpath = OS::get_singleton()->get_executable_path();
- String msg = GLOBAL_GET("debug/settings/crash_handler/message");
+
+ String msg;
+ const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
+ if (proj_settings) {
+ msg = proj_settings->get("debug/settings/crash_handler/message");
+ }
// Dump the backtrace to stderr with a message to the user
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
@@ -96,12 +101,10 @@ static void handle_crash(int sig) {
String output = "";
// Try to get the file/line number using addr2line
- if (OS::get_singleton()) {
- int ret;
- Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret);
- if (err == OK) {
- output.erase(output.length() - 1, 1);
- }
+ int ret;
+ Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret);
+ if (err == OK) {
+ output.erase(output.length() - 1, 1);
}
fprintf(stderr, "[%ld] %s (%ls)\n", i, fname, output.c_str());
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index f8ae5e9acb..933ee6b72e 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -275,7 +275,7 @@ def configure(env):
if not env['builtin_miniupnpc']:
# No pkgconfig file so far, hardcode default paths.
- env.Append(CPPPATH=["/usr/include/miniupnpc"])
+ env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
@@ -316,7 +316,7 @@ def configure(env):
if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
- env.Append(CPPPATH=['#platform/x11'])
+ env.Prepend(CPPPATH=['#platform/x11'])
env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
env.Append(LIBS=['GL', 'pthread'])
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 8d857de239..f034b2389b 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -503,55 +503,57 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
current_cursor = CURSOR_ARROW;
- if (cursor_theme) {
- for (int i = 0; i < CURSOR_MAX; i++) {
-
- static const char *cursor_file[] = {
- "left_ptr",
- "xterm",
- "hand2",
- "cross",
- "watch",
- "left_ptr_watch",
- "fleur",
- "hand1",
- "X_cursor",
- "sb_v_double_arrow",
- "sb_h_double_arrow",
- "size_bdiag",
- "size_fdiag",
- "hand1",
- "sb_v_double_arrow",
- "sb_h_double_arrow",
- "question_arrow"
- };
+ for (int i = 0; i < CURSOR_MAX; i++) {
- img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
- if (img[i]) {
- cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
- } else {
- print_verbose("Failed loading custom cursor: " + String(cursor_file[i]));
- }
+ static const char *cursor_file[] = {
+ "left_ptr",
+ "xterm",
+ "hand2",
+ "cross",
+ "watch",
+ "left_ptr_watch",
+ "fleur",
+ "hand1",
+ "X_cursor",
+ "sb_v_double_arrow",
+ "sb_h_double_arrow",
+ "size_bdiag",
+ "size_fdiag",
+ "hand1",
+ "sb_v_double_arrow",
+ "sb_h_double_arrow",
+ "question_arrow"
+ };
+
+ img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
+ if (img[i]) {
+ cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
+ } else {
+ print_verbose("Failed loading custom cursor: " + String(cursor_file[i]));
}
}
{
- Pixmap cursormask;
- XGCValues xgc;
- GC gc;
- XColor col;
- Cursor cursor;
+ // Creating an empty/transparent cursor
+
+ // Create 1x1 bitmap
+ Pixmap cursormask = XCreatePixmap(x11_display,
+ RootWindow(x11_display, DefaultScreen(x11_display)), 1, 1, 1);
- cursormask = XCreatePixmap(x11_display, RootWindow(x11_display, DefaultScreen(x11_display)), 1, 1, 1);
+ // Fill with zero
+ XGCValues xgc;
xgc.function = GXclear;
- gc = XCreateGC(x11_display, cursormask, GCFunction, &xgc);
+ GC gc = XCreateGC(x11_display, cursormask, GCFunction, &xgc);
XFillRectangle(x11_display, cursormask, gc, 0, 0, 1, 1);
- col.pixel = 0;
- col.red = 0;
- col.flags = 4;
- cursor = XCreatePixmapCursor(x11_display,
- cursormask, cursormask,
+
+ // Color value doesn't matter. Mask zero means no foreground or background will be drawn
+ XColor col = {};
+
+ Cursor cursor = XCreatePixmapCursor(x11_display,
+ cursormask, // source (using cursor mask as placeholder, since it'll all be ignored)
+ cursormask, // mask
&col, &col, 0, 0);
+
XFreePixmap(x11_display, cursormask);
XFreeGC(x11_display, gc);
@@ -1176,15 +1178,33 @@ Point2 OS_X11::get_window_position() const {
int x, y;
Window child;
XTranslateCoordinates(x11_display, x11_window, DefaultRootWindow(x11_display), 0, 0, &x, &y, &child);
-
- int screen = get_current_screen();
- Point2i screen_position = get_screen_position(screen);
-
- return Point2i(x - screen_position.x, y - screen_position.y);
+ return Point2i(x, y);
}
void OS_X11::set_window_position(const Point2 &p_position) {
- XMoveWindow(x11_display, x11_window, p_position.x, p_position.y);
+ int x = 0;
+ int y = 0;
+ if (get_borderless_window() == false) {
+ //exclude window decorations
+ XSync(x11_display, False);
+ Atom prop = XInternAtom(x11_display, "_NET_FRAME_EXTENTS", True);
+ if (prop != None) {
+ Atom type;
+ int format;
+ unsigned long len;
+ unsigned long remaining;
+ unsigned char *data = NULL;
+ if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
+ if (format == 32 && len == 4) {
+ long *extents = (long *)data;
+ x = extents[0];
+ y = extents[2];
+ }
+ XFree(data);
+ }
+ }
+ }
+ XMoveWindow(x11_display, x11_window, p_position.x - x, p_position.y - y);
update_real_mouse_position();
}
@@ -1201,15 +1221,20 @@ Size2 OS_X11::get_real_window_size() const {
int w = xwa.width;
int h = xwa.height;
Atom prop = XInternAtom(x11_display, "_NET_FRAME_EXTENTS", True);
- Atom type;
- int format;
- unsigned long len;
- unsigned long remaining;
- unsigned char *data = NULL;
- if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
- long *extents = (long *)data;
- w += extents[0] + extents[1]; // left, right
- h += extents[2] + extents[3]; // top, bottom
+ if (prop != None) {
+ Atom type;
+ int format;
+ unsigned long len;
+ unsigned long remaining;
+ unsigned char *data = NULL;
+ if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
+ if (format == 32 && len == 4) {
+ long *extents = (long *)data;
+ w += extents[0] + extents[1]; // left, right
+ h += extents[2] + extents[3]; // top, bottom
+ }
+ XFree(data);
+ }
}
return Size2(w, h);
}
@@ -2571,7 +2596,7 @@ String OS_X11::get_clipboard() const {
return ret;
}
-String OS_X11::get_name() {
+String OS_X11::get_name() const {
return "X11";
}
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index a54851d4e7..ad35cdb4f9 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -216,7 +216,7 @@ protected:
bool is_window_maximize_allowed();
public:
- virtual String get_name();
+ virtual String get_name() const;
virtual void set_cursor_shape(CursorShape p_shape);
virtual CursorShape get_cursor_shape() const;
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 943c2b1383..50da6a4967 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -115,7 +115,7 @@ bool PowerX11::make_proc_acpi_key_val(char **_ptr, char **_key, char **_val) {
*(ptr++) = '\0'; /* terminate the key. */
- while ((*ptr == ' ') && (*ptr != '\0')) {
+ while (*ptr == ' ') {
ptr++; /* skip whitespace. */
}
diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp
index bd7bb97b03..009d664462 100644
--- a/scene/2d/canvas_modulate.cpp
+++ b/scene/2d/canvas_modulate.cpp
@@ -70,7 +70,7 @@ void CanvasModulate::_bind_methods() {
void CanvasModulate::set_color(const Color &p_color) {
color = p_color;
- if (is_inside_tree()) {
+ if (is_visible_in_tree()) {
VS::get_singleton()->canvas_set_modulate(get_canvas(), color);
}
}
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index f43d97eb2a..375375285d 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -251,9 +251,9 @@ void CollisionObject2D::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape2
s.index = total_subshapes;
s.shape = p_shape;
if (area) {
- Physics2DServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform);
+ Physics2DServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
} else {
- Physics2DServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform);
+ Physics2DServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
}
sd.shapes.push_back(s);
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 721b52edaa..ff27e0a29a 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -978,7 +978,7 @@ void CPUParticles2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
if (!redraw)
- return; // dont add to render list
+ return; // don't add to render list
RID texrid;
if (texture.is_valid()) {
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index 73692e0535..ba06b3ebff 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -120,8 +120,12 @@ void Line2D::clear_points() {
}
}
-void Line2D::add_point(Vector2 pos) {
- _points.append(pos);
+void Line2D::add_point(Vector2 pos, int atpos) {
+ if (atpos < 0 || _points.size() < atpos) {
+ _points.append(pos);
+ } else {
+ _points.insert(atpos, pos);
+ }
update();
}
@@ -318,7 +322,7 @@ void Line2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_count"), &Line2D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "position"), &Line2D::add_point);
+ ClassDB::bind_method(D_METHOD("add_point", "position", "at_position"), &Line2D::add_point, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("remove_point", "i"), &Line2D::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Line2D::clear_points);
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index 32befab2d3..8a6f7b2dc5 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -72,7 +72,7 @@ public:
void clear_points();
- void add_point(Vector2 pos);
+ void add_point(Vector2 pos, int atpos = -1);
void remove_point(int i);
void set_width(float width);
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index baf5b5967b..9a6b63b9a3 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -105,6 +105,11 @@ void ParallaxLayer::_notification(int p_what) {
orig_scale = get_scale();
_update_mirroring();
} break;
+ case NOTIFICATION_EXIT_TREE: {
+
+ set_position(orig_offset);
+ set_scale(orig_scale);
+ } break;
}
}
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 4097006b33..e062067248 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -264,7 +264,7 @@ void PathFollow2D::_validate_property(PropertyInfo &property) const {
if (path && path->get_curve().is_valid())
max = path->get_curve()->get_baked_length();
- property.hint_string = "0," + rtos(max) + ",0.01,or_greater";
+ property.hint_string = "0," + rtos(max) + ",0.01,or_lesser";
}
}
@@ -306,8 +306,8 @@ void PathFollow2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lookahead", "lookahead"), &PathFollow2D::set_lookahead);
ClassDB::bind_method(D_METHOD("get_lookahead"), &PathFollow2D::get_lookahead);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01,or_greater"), "set_offset", "get_offset");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001,or_greater", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01,or_lesser"), "set_offset", "get_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001,or_lesser", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotate"), "set_rotate", "is_rotating");
@@ -319,8 +319,24 @@ void PathFollow2D::_bind_methods() {
void PathFollow2D::set_offset(float p_offset) {
offset = p_offset;
- if (path)
+ if (path) {
+ if (path->get_curve().is_valid() && path->get_curve()->get_baked_length()) {
+ float path_length = path->get_curve()->get_baked_length();
+
+ if (loop) {
+ while (offset > path_length)
+ offset -= path_length;
+
+ while (offset < 0)
+ offset += path_length;
+
+ } else {
+ offset = CLAMP(offset, 0, path_length);
+ }
+ }
+
_update_transform();
+ }
_change_notify("offset");
_change_notify("unit_offset");
}
diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h
index cf9877e6f8..d24c0a1561 100644
--- a/scene/2d/skeleton_2d.h
+++ b/scene/2d/skeleton_2d.h
@@ -39,6 +39,9 @@ class Bone2D : public Node2D {
GDCLASS(Bone2D, Node2D)
friend class Skeleton2D;
+#ifdef TOOLS_ENABLED
+ friend class AnimatedValuesBackup;
+#endif
Bone2D *parent_bone;
Skeleton2D *skeleton;
@@ -71,6 +74,9 @@ class Skeleton2D : public Node2D {
GDCLASS(Skeleton2D, Node2D);
friend class Bone2D;
+#ifdef TOOLS_ENABLED
+ friend class AnimatedValuesBackup;
+#endif
struct Bone {
bool operator<(const Bone &p_bone) const {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 885c9ea8bc..3dc0f46676 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -491,7 +491,7 @@ void TileMap::update_dirty_quadrants() {
shape_idx++;
#ifdef DEBUG_ENABLED
} else {
- print_error("The TileSet asigned to the TileMap " + get_name() + " has an invalid convex shape.");
+ print_error("The TileSet assigned to the TileMap " + get_name() + " has an invalid convex shape.");
#endif
}
}
@@ -749,7 +749,10 @@ void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_
void TileMap::_set_celld(const Vector2 &p_pos, const Dictionary &p_data) {
- set_cell(p_pos.x, p_pos.y, p_data["id"], p_data["flip_h"], p_data["flip_y"], p_data["transpose"], p_data["auto_coord"]);
+ Variant v_pos_x = p_pos.x, v_pos_y = p_pos.y, v_tile = p_data["id"], v_flip_h = p_data["flip_h"], v_flip_v = p_data["flip_y"], v_transpose = p_data["transpose"], v_autotile_coord = p_data["auto_coord"];
+ const Variant *args[7] = { &v_pos_x, &v_pos_y, &v_tile, &v_flip_h, &v_flip_v, &v_transpose, &v_autotile_coord };
+ Variant::CallError ce;
+ call("set_cell", args, 7, ce);
}
void TileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, Vector2 p_autotile_coord) {
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index e5346c4c53..52fa96ee4a 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -379,11 +379,11 @@ String ARVRController::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin == NULL) {
- return TTR("ARVRController must have an ARVROrigin node as its parent");
+ return TTR("ARVRController must have an ARVROrigin node as its parent.");
};
if (controller_id == 0) {
- return TTR("The controller id must not be 0 or this controller will not be bound to an actual controller");
+ return TTR("The controller ID must not be 0 or this controller won't be bound to an actual controller.");
};
return String();
@@ -506,11 +506,11 @@ String ARVRAnchor::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin == NULL) {
- return TTR("ARVRAnchor must have an ARVROrigin node as its parent");
+ return TTR("ARVRAnchor must have an ARVROrigin node as its parent.");
};
if (anchor_id == 0) {
- return TTR("The anchor id must not be 0 or this anchor will not be bound to an actual anchor");
+ return TTR("The anchor ID must not be 0 or this anchor won't be bound to an actual anchor.");
};
return String();
@@ -545,7 +545,7 @@ String ARVROrigin::get_configuration_warning() const {
return String();
if (tracked_camera == NULL)
- return TTR("ARVROrigin requires an ARVRCamera child node");
+ return TTR("ARVROrigin requires an ARVRCamera child node.");
return String();
};
@@ -583,6 +583,10 @@ void ARVROrigin::set_world_scale(float p_world_scale) {
};
void ARVROrigin::_notification(int p_what) {
+ // get our ARVRServer
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL(arvr_server);
+
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
set_process_internal(true);
@@ -591,10 +595,6 @@ void ARVROrigin::_notification(int p_what) {
set_process_internal(false);
}; break;
case NOTIFICATION_INTERNAL_PROCESS: {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL(arvr_server);
-
// set our world origin to our node transform
arvr_server->set_world_origin(get_global_transform());
@@ -611,6 +611,14 @@ void ARVROrigin::_notification(int p_what) {
default:
break;
};
+
+ // send our notification to all active ARVR interfaces, they may need to react to it also
+ for (int i = 0; i < arvr_server->get_interface_count(); i++) {
+ Ref<ARVRInterface> interface = arvr_server->get_interface(i);
+ if (interface.is_valid() && interface->is_initialized()) {
+ interface->notification(p_what);
+ }
+ }
};
ARVROrigin::ARVROrigin() {
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 54d7681a3a..e360de5b8e 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -524,6 +524,7 @@ void Camera::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_doppler_tracking", "mode"), &Camera::set_doppler_tracking);
ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &Camera::get_doppler_tracking);
ClassDB::bind_method(D_METHOD("get_frustum"), &Camera::get_frustum);
+ ClassDB::bind_method(D_METHOD("get_camera_rid"), &Camera::get_camera);
ClassDB::bind_method(D_METHOD("set_cull_mask_bit", "layer", "enable"), &Camera::set_cull_mask_bit);
ClassDB::bind_method(D_METHOD("get_cull_mask_bit", "layer"), &Camera::get_cull_mask_bit);
@@ -722,8 +723,9 @@ void ClippedCamera::set_process_mode(ProcessMode p_mode) {
if (process_mode == p_mode) {
return;
}
- set_process_internal(p_mode == CLIP_PROCESS_IDLE);
- set_physics_process_internal(p_mode == CLIP_PROCESS_PHYSICS);
+ process_mode = p_mode;
+ set_process_internal(process_mode == CLIP_PROCESS_IDLE);
+ set_physics_process_internal(process_mode == CLIP_PROCESS_PHYSICS);
}
ClippedCamera::ProcessMode ClippedCamera::get_process_mode() const {
return process_mode;
@@ -786,7 +788,7 @@ void ClippedCamera::_notification(int p_what) {
float csafe, cunsafe;
if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, csafe, cunsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) {
- clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from).normalized() * csafe);
+ clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * csafe);
}
_update_camera();
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index f542b021be..fc46cf5bdb 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -259,9 +259,9 @@ void CollisionObject::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape> &
s.index = total_subshapes;
s.shape = p_shape;
if (area) {
- PhysicsServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform);
+ PhysicsServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
} else {
- PhysicsServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform);
+ PhysicsServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
}
sd.shapes.push_back(s);
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 6bb2b547c7..3190e1e0b2 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -65,7 +65,6 @@ void CollisionShape::make_convex_from_brothers() {
}
void CollisionShape::_update_in_shape_owner(bool p_xform_only) {
-
parent->shape_owner_set_transform(owner_id, get_transform());
if (p_xform_only)
return;
@@ -228,7 +227,10 @@ void CollisionShape::_update_debug_shape() {
}
void CollisionShape::_shape_changed() {
- if (get_tree()->is_debugging_collisions_hint() && !debug_shape_dirty) {
+ // If this is a heightfield shape our center may have changed
+ _update_in_shape_owner(true);
+
+ if (is_inside_tree() && get_tree()->is_debugging_collisions_hint() && !debug_shape_dirty) {
debug_shape_dirty = true;
call_deferred("_update_debug_shape");
}
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index d4e242dcb7..138c446fea 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -212,7 +212,7 @@ String CPUParticles::get_configuration_warning() const {
get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) {
if (warnings != String())
warnings += "\n";
- warnings += "- " + TTR("CPUParticles animation requires the usage of a SpatialMaterial with \"Billboard Particles\" enabled.");
+ warnings += "- " + TTR("CPUParticles animation requires the usage of a SpatialMaterial whose Billboard Mode is set to \"Particle Billboard\".");
}
return warnings;
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index ed533ee7a4..2377068ede 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -152,6 +152,7 @@ PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const {
void Light::set_bake_mode(BakeMode p_mode) {
bake_mode = p_mode;
+ VS::get_singleton()->light_set_use_gi(light, p_mode != BAKE_DISABLED);
}
Light::BakeMode Light::get_bake_mode() const {
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index 5a3c8223ff..612d91c6e1 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -340,16 +340,12 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
};
Vector3 entry = Geometry::get_closest_point_to_segment(begin_poly->entry, edge);
- begin_poly->edges[i].C->distance = begin_poly->entry.distance_to(entry);
+ begin_poly->edges[i].C->distance = begin_point.distance_to(entry);
begin_poly->edges[i].C->entry = entry;
#else
begin_poly->edges[i].C->distance = begin_poly->center.distance_to(begin_poly->edges[i].C->center);
#endif
open_list.push_back(begin_poly->edges[i].C);
-
- if (begin_poly->edges[i].C == end_poly) {
- found_route = true;
- }
}
}
@@ -370,28 +366,7 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
float cost = p->distance;
#ifdef USE_ENTRY_POINT
- int es = p->edges.size();
-
- float shortest_distance = 1e30;
-
- for (int i = 0; i < es; i++) {
- Polygon::Edge &e = p->edges.write[i];
-
- if (!e.C)
- continue;
-
- Vector3 edge[2] = {
- _get_vertex(p->edges[i].point),
- _get_vertex(p->edges[(i + 1) % es].point)
- };
-
- Vector3 edge_point = Geometry::get_closest_point_to_segment(p->entry, edge);
- float dist = p->entry.distance_to(edge_point);
- if (dist < shortest_distance)
- shortest_distance = dist;
- }
-
- cost += shortest_distance;
+ cost += p->entry.distance_to(end_point);
#else
cost += p->center.distance_to(end_point);
#endif
@@ -404,6 +379,12 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
Polygon *p = least_cost_poly->get();
//open the neighbours for search
+ if (p == end_poly) {
+ //oh my reached end! stop algorithm
+ found_route = true;
+ break;
+ }
+
for (int i = 0; i < p->edges.size(); i++) {
Polygon::Edge &e = p->edges.write[i];
@@ -411,7 +392,17 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
if (!e.C)
continue;
+#ifdef USE_ENTRY_POINT
+ Vector3 edge[2] = {
+ _get_vertex(p->edges[i].point),
+ _get_vertex(p->edges[(i + 1) % p->edges.size()].point)
+ };
+
+ Vector3 entry = Geometry::get_closest_point_to_segment(p->entry, edge);
+ float distance = p->entry.distance_to(entry) + p->distance;
+#else
float distance = p->center.distance_to(e.C->center) + p->distance;
+#endif
if (e.C->prev_edge != -1) {
//oh this was visited already, can we win the cost?
@@ -420,25 +411,22 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
e.C->prev_edge = e.C_edge;
e.C->distance = distance;
+#ifdef USE_ENTRY_POINT
+ e.C->entry = entry;
+#endif
}
} else {
//add to open neighbours
e.C->prev_edge = e.C_edge;
e.C->distance = distance;
+#ifdef USE_ENTRY_POINT
+ e.C->entry = entry;
+#endif
open_list.push_back(e.C);
-
- if (e.C == end_poly) {
- //oh my reached end! stop algorithm
- found_route = true;
- break;
- }
}
}
- if (found_route)
- break;
-
open_list.erase(least_cost_poly);
}
@@ -539,8 +527,12 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector
path.push_back(end_point);
while (true) {
int prev = p->prev_edge;
+#ifdef USE_ENTRY_POINT
+ Vector3 point = p->entry;
+#else
int prev_n = (p->prev_edge + 1) % p->edges.size();
Vector3 point = (_get_vertex(p->edges[prev].point) + _get_vertex(p->edges[prev_n].point)) * 0.5;
+#endif
path.push_back(point);
p = p->edges[prev].C;
if (p == begin_poly)
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 93731c4023..f82543b789 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -73,6 +73,41 @@ int NavigationMesh::get_sample_partition_type() const {
return static_cast<int>(partition_type);
}
+void NavigationMesh::set_parsed_geometry_type(int p_value) {
+ ERR_FAIL_COND(p_value >= PARSED_GEOMETRY_MAX);
+ parsed_geometry_type = static_cast<ParsedGeometryType>(p_value);
+ _change_notify();
+}
+
+int NavigationMesh::get_parsed_geometry_type() const {
+ return parsed_geometry_type;
+}
+
+void NavigationMesh::set_collision_mask(uint32_t p_mask) {
+
+ collision_mask = p_mask;
+}
+
+uint32_t NavigationMesh::get_collision_mask() const {
+
+ return collision_mask;
+}
+
+void NavigationMesh::set_collision_mask_bit(int p_bit, bool p_value) {
+
+ uint32_t mask = get_collision_mask();
+ if (p_value)
+ mask |= 1 << p_bit;
+ else
+ mask &= ~(1 << p_bit);
+ set_collision_mask(mask);
+}
+
+bool NavigationMesh::get_collision_mask_bit(int p_bit) const {
+
+ return get_collision_mask() & (1 << p_bit);
+}
+
void NavigationMesh::set_cell_size(float p_value) {
cell_size = p_value;
}
@@ -204,6 +239,7 @@ bool NavigationMesh::get_filter_walkable_low_height_spans() const {
void NavigationMesh::set_vertices(const PoolVector<Vector3> &p_vertices) {
vertices = p_vertices;
+ _change_notify();
}
PoolVector<Vector3> NavigationMesh::get_vertices() const {
@@ -217,6 +253,7 @@ void NavigationMesh::_set_polygons(const Array &p_array) {
for (int i = 0; i < p_array.size(); i++) {
polygons.write[i].indices = p_array[i];
}
+ _change_notify();
}
Array NavigationMesh::_get_polygons() const {
@@ -235,6 +272,7 @@ void NavigationMesh::add_polygon(const Vector<int> &p_polygon) {
Polygon polygon;
polygon.indices = p_polygon;
polygons.push_back(polygon);
+ _change_notify();
}
int NavigationMesh::get_polygon_count() const {
@@ -340,6 +378,15 @@ void NavigationMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sample_partition_type", "sample_partition_type"), &NavigationMesh::set_sample_partition_type);
ClassDB::bind_method(D_METHOD("get_sample_partition_type"), &NavigationMesh::get_sample_partition_type);
+ ClassDB::bind_method(D_METHOD("set_parsed_geometry_type", "geometry_type"), &NavigationMesh::set_parsed_geometry_type);
+ ClassDB::bind_method(D_METHOD("get_parsed_geometry_type"), &NavigationMesh::get_parsed_geometry_type);
+
+ ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &NavigationMesh::set_collision_mask);
+ ClassDB::bind_method(D_METHOD("get_collision_mask"), &NavigationMesh::get_collision_mask);
+
+ ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &NavigationMesh::set_collision_mask_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &NavigationMesh::get_collision_mask_bit);
+
ClassDB::bind_method(D_METHOD("set_cell_size", "cell_size"), &NavigationMesh::set_cell_size);
ClassDB::bind_method(D_METHOD("get_cell_size"), &NavigationMesh::get_cell_size);
@@ -405,30 +452,45 @@ void NavigationMesh::_bind_methods() {
BIND_CONSTANT(SAMPLE_PARTITION_MONOTONE);
BIND_CONSTANT(SAMPLE_PARTITION_LAYERS);
+ BIND_CONSTANT(PARSED_GEOMETRY_MESH_INSTANCES);
+ BIND_CONSTANT(PARSED_GEOMETRY_STATIC_COLLIDERS);
+ BIND_CONSTANT(PARSED_GEOMETRY_BOTH);
+
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons");
ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type");
-
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/size", PROPERTY_HINT_RANGE, "0.1,1.0,0.01"), "set_cell_size", "get_cell_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/height", PROPERTY_HINT_RANGE, "0.1,1.0,0.01"), "set_cell_height", "get_cell_height");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/height", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_height", "get_agent_height");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/radius", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_radius", "get_agent_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_climb", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_max_climb", "get_agent_max_climb");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/parsed_geometry_type", PROPERTY_HINT_ENUM, "Mesh Instances,Static Colliders,Both"), "set_parsed_geometry_type", "get_parsed_geometry_type");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/size", PROPERTY_HINT_RANGE, "0.1,1.0,0.01,or_greater"), "set_cell_size", "get_cell_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/height", PROPERTY_HINT_RANGE, "0.1,1.0,0.01,or_greater"), "set_cell_height", "get_cell_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/height", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_height", "get_agent_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/radius", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_radius", "get_agent_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_climb", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_max_climb", "get_agent_max_climb");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_slope", PROPERTY_HINT_RANGE, "0.0,90.0,0.1"), "set_agent_max_slope", "get_agent_max_slope");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01"), "set_region_min_size", "get_region_min_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01"), "set_region_merge_size", "get_region_merge_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01"), "set_edge_max_length", "get_edge_max_length");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01"), "set_edge_max_error", "get_edge_max_error");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0"), "set_verts_per_poly", "get_verts_per_poly");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_detail_sample_distance", "get_detail_sample_distance");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_detail_sample_max_error", "get_detail_sample_max_error");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_min_size", "get_region_min_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_merge_size", "get_region_merge_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater"), "set_edge_max_length", "get_edge_max_length");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_max_error", "get_detail_sample_max_error");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/filter_walkable_low_height_spans"), "set_filter_walkable_low_height_spans", "get_filter_walkable_low_height_spans");
}
+void NavigationMesh::_validate_property(PropertyInfo &property) const {
+ if (property.name == "geometry/collision_mask") {
+ if (parsed_geometry_type == PARSED_GEOMETRY_MESH_INSTANCES) {
+ property.usage = 0;
+ return;
+ }
+ }
+}
+
NavigationMesh::NavigationMesh() {
cell_size = 0.3f;
cell_height = 0.2f;
@@ -445,7 +507,8 @@ NavigationMesh::NavigationMesh() {
detail_sample_max_error = 1.0f;
partition_type = SAMPLE_PARTITION_WATERSHED;
-
+ parsed_geometry_type = PARSED_GEOMETRY_MESH_INSTANCES;
+ collision_mask = 0xFFFFFFFF;
filter_low_hanging_obstacles = false;
filter_ledge_spans = false;
filter_walkable_low_height_spans = false;
@@ -566,8 +629,17 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_na
navigation->navmesh_remove(nav_id);
nav_id = -1;
}
+
+ if (navmesh.is_valid()) {
+ navmesh->remove_change_receptor(this);
+ }
+
navmesh = p_navmesh;
+ if (navmesh.is_valid()) {
+ navmesh->add_change_receptor(this);
+ }
+
if (navigation && navmesh.is_valid() && enabled) {
nav_id = navigation->navmesh_add(navmesh, get_relative_transform(navigation), this);
}
@@ -617,6 +689,11 @@ void NavigationMeshInstance::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
}
+void NavigationMeshInstance::_changed_callback(Object *p_changed, const char *p_prop) {
+ update_gizmo();
+ update_configuration_warning();
+}
+
NavigationMeshInstance::NavigationMeshInstance() {
debug_view = NULL;
@@ -625,3 +702,8 @@ NavigationMeshInstance::NavigationMeshInstance() {
enabled = true;
set_notify_transform(true);
}
+
+NavigationMeshInstance::~NavigationMeshInstance() {
+ if (navmesh.is_valid())
+ navmesh->remove_change_receptor(this);
+}
diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h
index 74531e2423..5fbf3998ff 100644
--- a/scene/3d/navigation_mesh.h
+++ b/scene/3d/navigation_mesh.h
@@ -57,6 +57,7 @@ class NavigationMesh : public Resource {
protected:
static void _bind_methods();
+ virtual void _validate_property(PropertyInfo &property) const;
void _set_polygons(const Array &p_array);
Array _get_polygons() const;
@@ -69,6 +70,13 @@ public:
SAMPLE_PARTITION_MAX
};
+ enum ParsedGeometryType {
+ PARSED_GEOMETRY_MESH_INSTANCES = 0,
+ PARSED_GEOMETRY_STATIC_COLLIDERS,
+ PARSED_GEOMETRY_BOTH,
+ PARSED_GEOMETRY_MAX
+ };
+
protected:
float cell_size;
float cell_height;
@@ -85,6 +93,8 @@ protected:
float detail_sample_max_error;
SamplePartitionType partition_type;
+ ParsedGeometryType parsed_geometry_type;
+ uint32_t collision_mask;
bool filter_low_hanging_obstacles;
bool filter_ledge_spans;
@@ -95,6 +105,15 @@ public:
void set_sample_partition_type(int p_value);
int get_sample_partition_type() const;
+ void set_parsed_geometry_type(int p_value);
+ int get_parsed_geometry_type() const;
+
+ void set_collision_mask(uint32_t p_mask);
+ uint32_t get_collision_mask() const;
+
+ void set_collision_mask_bit(int p_bit, bool p_value);
+ bool get_collision_mask_bit(int p_bit) const;
+
void set_cell_size(float p_value);
float get_cell_size() const;
@@ -174,6 +193,7 @@ class NavigationMeshInstance : public Spatial {
protected:
void _notification(int p_what);
static void _bind_methods();
+ void _changed_callback(Object *p_changed, const char *p_prop);
public:
void set_enabled(bool p_enabled);
@@ -185,6 +205,7 @@ public:
String get_configuration_warning() const;
NavigationMeshInstance();
+ ~NavigationMeshInstance();
};
#endif // NAVIGATION_MESH_H
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 57ab01f7be..156560f802 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -268,7 +268,7 @@ String Particles::get_configuration_warning() const {
process->get_param_texture(ParticlesMaterial::PARAM_ANIM_SPEED).is_valid() || process->get_param_texture(ParticlesMaterial::PARAM_ANIM_OFFSET).is_valid())) {
if (warnings != String())
warnings += "\n";
- warnings += "- " + TTR("Particles animation requires the usage of a SpatialMaterial with \"Billboard Particles\" enabled.");
+ warnings += "- " + TTR("Particles animation requires the usage of a SpatialMaterial whose Billboard Mode is set to \"Particle Billboard\".");
}
}
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index e2dc89aa6e..57af951110 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -1181,19 +1181,16 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
while (p_max_slides) {
Collision collision;
-
bool found_collision = false;
- int test_type = 0;
-
- do {
+ for (int i = 0; i < 2; ++i) {
bool collided;
- if (test_type == 0) { //collide
+ if (i == 0) { //collide
collided = move_and_collide(motion, p_infinite_inertia, collision);
if (!collided) {
motion = Vector3(); //clear because no collision happened and motion completed
}
- } else {
+ } else { //separate raycasts (if any)
collided = separate_raycast_shapes(p_infinite_inertia, collision);
if (collided) {
collision.remainder = motion; //keep
@@ -1219,7 +1216,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
floor_velocity = collision.collider_vel;
if (p_stop_on_slope) {
- if ((lv_n + p_floor_direction).length() < 0.01) {
+ if ((lv_n + p_floor_direction).length() < 0.01 && collision.travel.length() < 1) {
Transform gt = get_global_transform();
gt.origin -= collision.travel;
set_global_transform(gt);
@@ -1240,21 +1237,18 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
motion = motion.slide(p_floor_direction);
lv = lv.slide(p_floor_direction);
} else {
-
Vector3 n = collision.normal;
motion = motion.slide(n);
lv = lv.slide(n);
}
- for (int i = 0; i < 3; i++) {
- if (locked_axis & (1 << i)) {
- lv[i] = 0;
+ for (int j = 0; j < 3; j++) {
+ if (locked_axis & (1 << j)) {
+ lv[j] = 0;
}
}
}
-
- ++test_type;
- } while (!p_stop_on_slope && test_type < 2);
+ }
if (!found_collision || motion == Vector3())
break;
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index 589af98062..aa6030d44e 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -317,7 +317,7 @@ protected:
static void _bind_methods();
public:
- bool move_and_collide(const Vector3 &p_motion, bool p_infinite_inertia, Collision &r_collisionz, bool p_exclude_raycast_shapes = true, bool p_test_only = false);
+ bool move_and_collide(const Vector3 &p_motion, bool p_infinite_inertia, Collision &r_collision, bool p_exclude_raycast_shapes = true, bool p_test_only = false);
bool test_move(const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia);
bool separate_raycast_shapes(bool p_infinite_inertia, Collision &r_collision);
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 15c089ec10..e192e040f2 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -162,7 +162,7 @@ void Skeleton::_update_process_order() {
//now check process order
int pass_count = 0;
while (pass_count < len * len) {
- //using bubblesort because of simplicity, it wont run every frame though.
+ //using bubblesort because of simplicity, it won't run every frame though.
//bublesort worst case is O(n^2), and this may be an infinite loop if cyclic
bool swapped = false;
for (int i = 0; i < len; i++) {
diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp
index d6a0595519..909d4fda34 100644
--- a/scene/3d/soft_body.cpp
+++ b/scene/3d/soft_body.cpp
@@ -405,7 +405,7 @@ String SoftBody::get_configuration_warning() const {
if (!warning.empty())
warning += "\n\n";
- warning += TTR("This body will be ignored until you set a mesh");
+ warning += TTR("This body will be ignored until you set a mesh.");
}
Transform t = get_transform();
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 395f7b9b35..efd418e3c7 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -676,26 +676,29 @@ void Spatial::set_identity() {
void Spatial::look_at(const Vector3 &p_target, const Vector3 &p_up) {
- Transform lookat;
- lookat.origin = get_global_transform().origin;
- if (lookat.origin == p_target) {
+ Vector3 origin(get_global_transform().origin);
+ look_at_from_position(origin, p_target, p_up);
+}
+
+void Spatial::look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up) {
+
+ if (p_pos == p_target) {
ERR_EXPLAIN("Node origin and target are in the same position, look_at() failed");
ERR_FAIL();
}
- if (p_up.cross(p_target - lookat.origin) == Vector3()) {
+ if (p_up.cross(p_target - p_pos) == Vector3()) {
ERR_EXPLAIN("Up vector and direction between node origin and target are aligned, look_at() failed");
ERR_FAIL();
}
- lookat = lookat.looking_at(p_target, p_up);
- set_global_transform(lookat);
-}
-
-void Spatial::look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up) {
Transform lookat;
lookat.origin = p_pos;
+
+ Vector3 original_scale(get_global_transform().basis.get_scale());
lookat = lookat.looking_at(p_target, p_up);
+ // as basis was normalized, we just need to apply original scale back
+ lookat.basis.scale(original_scale);
set_global_transform(lookat);
}
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 1e3470cd90..60f8806b25 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -314,8 +314,9 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
if (start_request_travel) {
if (!playing) {
+ String node_name = start_request;
start_request = StringName();
- ERR_EXPLAIN("Can't travel to '" + String(start_request) + "' if state machine is not active.");
+ ERR_EXPLAIN("Can't travel to '" + node_name + "' if state machine is not playing.");
ERR_FAIL_V(0);
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 016db15b73..75088c79fe 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -34,12 +34,23 @@
#include "core/message_queue.h"
#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
+
#ifdef TOOLS_ENABLED
+#include "editor/editor_settings.h"
+#include "scene/2d/skeleton_2d.h"
+
void AnimatedValuesBackup::update_skeletons() {
for (int i = 0; i < entries.size(); i++) {
if (entries[i].bone_idx != -1) {
+ // 3D bone
Object::cast_to<Skeleton>(entries[i].object)->notification(Skeleton::NOTIFICATION_UPDATE_SKELETON);
+ } else {
+ Bone2D *bone = Object::cast_to<Bone2D>(entries[i].object);
+ if (bone && bone->skeleton) {
+ // 2D bone
+ bone->skeleton->_update_transform();
+ }
}
}
}
@@ -1197,7 +1208,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
// Animation reset BUT played backwards, set position to the end
c.current.pos = c.current.from->animation->get_length();
} else if (!p_from_end && c.current.pos == c.current.from->animation->get_length()) {
- // Animation resumed but already ended, set position to the beggining
+ // Animation resumed but already ended, set position to the beginning
c.current.pos = 0;
}
}
@@ -1510,13 +1521,19 @@ NodePath AnimationPlayer::get_root() const {
void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
+#ifdef TOOLS_ENABLED
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
+#else
+ const String quote_style = "\"";
+#endif
+
String pf = p_function;
if (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") {
List<StringName> al;
get_animation_list(&al);
for (List<StringName>::Element *E = al.front(); E; E = E->next()) {
- r_options->push_back("\"" + String(E->get()) + "\"");
+ r_options->push_back(quote_style + String(E->get()) + quote_style);
}
}
Node::get_argument_options(p_function, p_idx, r_options);
diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp
index 4da3e6ee28..06d6806f03 100644
--- a/scene/animation/skeleton_ik.cpp
+++ b/scene/animation/skeleton_ik.cpp
@@ -37,20 +37,20 @@
#ifndef _3D_DISABLED
FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::find_child(const BoneId p_bone_id) {
- for (int i = childs.size() - 1; 0 <= i; --i) {
- if (p_bone_id == childs[i].bone) {
- return &childs.write[i];
+ for (int i = children.size() - 1; 0 <= i; --i) {
+ if (p_bone_id == children[i].bone) {
+ return &children.write[i];
}
}
return NULL;
}
FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::add_child(const BoneId p_bone_id) {
- const int infant_child_id = childs.size();
- childs.resize(infant_child_id + 1);
- childs.write[infant_child_id].bone = p_bone_id;
- childs.write[infant_child_id].parent_item = this;
- return &childs.write[infant_child_id];
+ const int infant_child_id = children.size();
+ children.resize(infant_child_id + 1);
+ children.write[infant_child_id].bone = p_bone_id;
+ children.write[infant_child_id].parent_item = this;
+ return &children.write[infant_child_id];
}
/// Build a chain that starts from the root to tip
@@ -144,8 +144,8 @@ void FabrikInverseKinematic::update_chain(const Skeleton *p_sk, ChainItem *p_cha
p_chain_item->initial_transform = p_sk->get_bone_global_pose(p_chain_item->bone);
p_chain_item->current_pos = p_chain_item->initial_transform.origin;
- for (int i = p_chain_item->childs.size() - 1; 0 <= i; --i) {
- update_chain(p_sk, &p_chain_item->childs.write[i]);
+ for (int i = p_chain_item->children.size() - 1; 0 <= i; --i) {
+ update_chain(p_sk, &p_chain_item->children.write[i]);
}
}
@@ -210,9 +210,9 @@ void FabrikInverseKinematic::solve_simple_forwards(Chain &r_chain, bool p_solve_
while (sub_chain_root) { // Reach the tip
sub_chain_root->current_pos = origin;
- if (!sub_chain_root->childs.empty()) {
+ if (!sub_chain_root->children.empty()) {
- ChainItem &child(sub_chain_root->childs.write[0]);
+ ChainItem &child(sub_chain_root->children.write[0]);
// Is not tip
// So calculate next origin location
@@ -302,10 +302,10 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
Transform new_bone_pose(ci->initial_transform);
new_bone_pose.origin = ci->current_pos;
- if (!ci->childs.empty()) {
+ if (!ci->children.empty()) {
/// Rotate basis
- const Vector3 initial_ori((ci->childs[0].initial_transform.origin - ci->initial_transform.origin).normalized());
+ const Vector3 initial_ori((ci->children[0].initial_transform.origin - ci->initial_transform.origin).normalized());
const Vector3 rot_axis(initial_ori.cross(ci->current_ori).normalized());
if (rot_axis[0] != 0 && rot_axis[1] != 0 && rot_axis[2] != 0) {
@@ -322,8 +322,8 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
p_task->skeleton->set_bone_global_pose(ci->bone, new_bone_pose);
- if (!ci->childs.empty())
- ci = &ci->childs.write[0];
+ if (!ci->children.empty())
+ ci = &ci->children.write[0];
else
ci = NULL;
}
diff --git a/scene/animation/skeleton_ik.h b/scene/animation/skeleton_ik.h
index 228184a2df..5d48b7be33 100644
--- a/scene/animation/skeleton_ik.h
+++ b/scene/animation/skeleton_ik.h
@@ -49,7 +49,7 @@ class FabrikInverseKinematic {
struct ChainItem {
- Vector<ChainItem> childs;
+ Vector<ChainItem> children;
ChainItem *parent_item;
// Bone info
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 144e58d8b9..2def9fe8fc 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -32,8 +32,7 @@
#include "core/engine.h"
-
-void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames,int p_amount) {
+void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) {
int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
@@ -66,10 +65,8 @@ void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames,int p_amount) {
}
}
-
void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
-
//get data
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
@@ -94,15 +91,14 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
//set volume for next mix
mix_volume_db = target_volume;
- _mix_to_bus(buffer,buffer_size);
-
+ _mix_to_bus(buffer, buffer_size);
}
void AudioStreamPlayer::_mix_audio() {
if (use_fadeout) {
- _mix_to_bus(fadeout_buffer.ptr(),fadeout_buffer.size());
- use_fadeout=false;
+ _mix_to_bus(fadeout_buffer.ptr(), fadeout_buffer.size());
+ use_fadeout = false;
}
if (!stream_playback.is_valid() || !active ||
@@ -121,7 +117,7 @@ void AudioStreamPlayer::_mix_audio() {
if (setstop) {
_mix_internal(true);
stream_playback->stop();
- setstop=false;
+ setstop = false;
}
if (setseek >= 0.0 && !stop_has_priority) {
@@ -154,7 +150,7 @@ void AudioStreamPlayer::_notification(int p_what) {
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
if (!active || (setseek < 0 && !stream_playback->is_playing())) {
- active = false;
+ active = false;
set_process_internal(false);
emit_signal("finished");
}
@@ -200,7 +196,7 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
vol += vol_inc;
}
- use_fadeout=true;
+ use_fadeout = true;
}
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
@@ -252,7 +248,7 @@ void AudioStreamPlayer::play(float p_from_pos) {
if (stream_playback.is_valid()) {
//mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks
setseek = p_from_pos;
- stop_has_priority=false;
+ stop_has_priority = false;
active = true;
set_process_internal(true);
}
@@ -268,8 +264,8 @@ void AudioStreamPlayer::seek(float p_seconds) {
void AudioStreamPlayer::stop() {
if (stream_playback.is_valid() && active) {
- setstop=true;
- stop_has_priority=true;
+ setstop = true;
+ stop_has_priority = true;
}
}
@@ -357,7 +353,7 @@ void AudioStreamPlayer::_validate_property(PropertyInfo &property) const {
if (property.name == "bus") {
String options;
- for (int i = 0; i <AudioServer::get_singleton()->get_bus_count(); i++) {
+ for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
if (i > 0)
options += ",";
String name = AudioServer::get_singleton()->get_bus_name(i);
@@ -442,8 +438,8 @@ AudioStreamPlayer::AudioStreamPlayer() {
stream_paused_fade = false;
mix_target = MIX_TARGET_STEREO;
fadeout_buffer.resize(512);
- setstop=false;
- use_fadeout=false;
+ setstop = false;
+ use_fadeout = false;
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
}
diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h
index 0b782b67e7..7987bd7e7d 100644
--- a/scene/audio/audio_stream_player.h
+++ b/scene/audio/audio_stream_player.h
@@ -112,7 +112,6 @@ public:
Ref<AudioStreamPlayback> get_stream_playback();
-
AudioStreamPlayer();
~AudioStreamPlayer();
};
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index d68cdd5f8d..5669743ec1 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -56,185 +56,53 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
if (status.disabled) // no interaction with disabled button
return;
- Ref<InputEventMouseButton> b = p_event;
+ Ref<InputEventMouseButton> mouse_button = p_event;
+ bool ui_accept = p_event->is_action("ui_accept") && !p_event->is_echo();
- if (b.is_valid()) {
- if (((1 << (b->get_button_index() - 1)) & button_mask) == 0)
- return;
-
- if (status.pressing_button)
- return;
-
- if (action_mode == ACTION_MODE_BUTTON_PRESS) {
-
- if (b->is_pressed()) {
-
- emit_signal("button_down");
-
- if (!toggle_mode) { //mouse press attempt
-
- status.press_attempt = true;
- status.pressing_inside = true;
+ 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");
+ }
- pressed();
- if (get_script_instance()) {
- Variant::CallError ce;
- get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
+ 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;
}
-
- _unpress_group();
- emit_signal("pressed");
-
- } else {
-
status.pressed = !status.pressed;
- pressed();
-
_unpress_group();
- emit_signal("pressed");
-
toggled(status.pressed);
- if (get_script_instance()) {
- get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, status.pressed);
- }
- emit_signal("toggled", status.pressed);
+ pressed();
}
-
} else {
-
- emit_signal("button_up");
-
- /* this is pointless if (status.press_attempt && status.pressing_inside) {
- //released();
- emit_signal("released");
+ if (!p_event->is_pressed()) {
+ pressed();
}
-*/
- status.press_attempt = false;
}
- update();
- return;
}
- if (b->is_pressed()) {
-
- status.press_attempt = true;
- status.pressing_inside = true;
- emit_signal("button_down");
-
- } else {
-
+ if (!p_event->is_pressed()) { // pressed state should be correct with button_up signal
emit_signal("button_up");
-
- if (status.press_attempt && status.pressing_inside) {
-
- if (!toggle_mode) { //mouse press attempt
-
- pressed();
- if (get_script_instance()) {
- Variant::CallError ce;
- get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
- }
-
- _unpress_group();
- emit_signal("pressed");
-
- } else {
-
- status.pressed = !status.pressed;
-
- pressed();
- _unpress_group();
- emit_signal("pressed");
-
- toggled(status.pressed);
- if (get_script_instance()) {
- get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, status.pressed);
- }
- emit_signal("toggled", status.pressed);
- }
- }
-
status.press_attempt = false;
}
update();
+ return;
}
- Ref<InputEventMouseMotion> mm = p_event;
-
- if (mm.is_valid()) {
- if (status.press_attempt && status.pressing_button == 0) {
+ Ref<InputEventMouseMotion> mouse_motion = p_event;
+ if (mouse_motion.is_valid()) {
+ if (status.press_attempt) {
bool last_press_inside = status.pressing_inside;
- status.pressing_inside = has_point(mm->get_position());
- if (last_press_inside != status.pressing_inside)
+ status.pressing_inside = has_point(mouse_motion->get_position());
+ if (last_press_inside != status.pressing_inside) {
update();
- }
- }
-
- if (!mm.is_valid() && !b.is_valid()) {
-
- if (p_event->is_echo()) {
- return;
- }
-
- if (status.disabled) {
- return;
- }
-
- if (status.press_attempt && status.pressing_button == 0) {
- return;
- }
-
- if (p_event->is_action("ui_accept")) {
-
- if (p_event->is_pressed()) {
-
- status.pressing_button++;
- status.press_attempt = true;
- status.pressing_inside = true;
- emit_signal("button_down");
-
- } else if (status.press_attempt) {
-
- if (status.pressing_button)
- status.pressing_button--;
-
- if (status.pressing_button)
- return;
-
- status.press_attempt = false;
- status.pressing_inside = false;
-
- emit_signal("button_up");
-
- if (!toggle_mode) { //mouse press attempt
-
- pressed();
- if (get_script_instance()) {
- Variant::CallError ce;
- get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
- }
-
- _unpress_group();
- emit_signal("pressed");
- } else {
-
- status.pressed = !status.pressed;
-
- pressed();
- _unpress_group();
- emit_signal("pressed");
-
- toggled(status.pressed);
- if (get_script_instance()) {
- get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, status.pressed);
- }
- emit_signal("toggled", status.pressed);
- }
}
-
- accept_event();
- update();
}
}
}
@@ -255,7 +123,6 @@ void BaseButton::_notification(int p_what) {
if (status.press_attempt) {
status.press_attempt = false;
- status.pressing_button = 0;
update();
}
}
@@ -268,9 +135,8 @@ void BaseButton::_notification(int p_what) {
if (p_what == NOTIFICATION_FOCUS_EXIT) {
- if (status.pressing_button && status.press_attempt) {
+ if (status.press_attempt) {
status.press_attempt = false;
- status.pressing_button = 0;
status.hovering = false;
update();
} else if (status.hovering) {
@@ -282,10 +148,7 @@ void BaseButton::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
}
- if (p_what == NOTIFICATION_EXIT_TREE) {
- }
-
- if (p_what == NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree()) {
+ if (p_what == NOTIFICATION_EXIT_TREE || (p_what == NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree())) {
if (!toggle_mode) {
status.pressed = false;
@@ -293,21 +156,23 @@ void BaseButton::_notification(int p_what) {
status.hovering = false;
status.press_attempt = false;
status.pressing_inside = false;
- status.pressing_button = 0;
}
}
void BaseButton::pressed() {
- if (get_script_instance())
- get_script_instance()->call("pressed");
+ if (get_script_instance()) {
+ get_script_instance()->call(SceneStringNames::get_singleton()->_pressed);
+ }
+ emit_signal("pressed");
}
void BaseButton::toggled(bool p_pressed) {
if (get_script_instance()) {
- get_script_instance()->call("toggled", p_pressed);
+ get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, p_pressed);
}
+ emit_signal("toggled", p_pressed);
}
void BaseButton::set_disabled(bool p_disabled) {
@@ -321,7 +186,6 @@ void BaseButton::set_disabled(bool p_disabled) {
}
status.press_attempt = false;
status.pressing_inside = false;
- status.pressing_button = 0;
}
update();
_change_notify("disabled");
@@ -344,6 +208,10 @@ void BaseButton::set_pressed(bool p_pressed) {
if (p_pressed) {
_unpress_group();
}
+ if (toggle_mode) {
+ toggled(status.pressed);
+ }
+
update();
}
@@ -379,7 +247,7 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
bool pressing;
if (status.press_attempt) {
- pressing = status.pressing_inside;
+ pressing = (status.pressing_inside || keep_pressed_outside);
if (status.pressed)
pressing = !pressing;
} else {
@@ -449,6 +317,16 @@ Control::FocusMode BaseButton::get_enabled_focus_mode() const {
return enabled_focus_mode;
}
+void BaseButton::set_keep_pressed_outside(bool p_on) {
+
+ keep_pressed_outside = p_on;
+}
+
+bool BaseButton::is_keep_pressed_outside() const {
+
+ return keep_pressed_outside;
+}
+
void BaseButton::set_shortcut(const Ref<ShortCut> &p_shortcut) {
if (shortcut.is_null() == p_shortcut.is_null())
@@ -531,6 +409,8 @@ void BaseButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_draw_mode"), &BaseButton::get_draw_mode);
ClassDB::bind_method(D_METHOD("set_enabled_focus_mode", "mode"), &BaseButton::set_enabled_focus_mode);
ClassDB::bind_method(D_METHOD("get_enabled_focus_mode"), &BaseButton::get_enabled_focus_mode);
+ ClassDB::bind_method(D_METHOD("set_keep_pressed_outside", "enabled"), &BaseButton::set_keep_pressed_outside);
+ ClassDB::bind_method(D_METHOD("is_keep_pressed_outside"), &BaseButton::is_keep_pressed_outside);
ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &BaseButton::set_shortcut);
ClassDB::bind_method(D_METHOD("get_shortcut"), &BaseButton::get_shortcut);
@@ -552,6 +432,7 @@ void BaseButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "action_mode", PROPERTY_HINT_ENUM, "Button Press,Button Release"), "set_action_mode", "get_action_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "button_mask", PROPERTY_HINT_FLAGS, "Mouse Left, Mouse Right, Mouse Middle"), "set_button_mask", "get_button_mask");
ADD_PROPERTY(PropertyInfo(Variant::INT, "enabled_focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_enabled_focus_mode", "get_enabled_focus_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_shortcut", "get_shortcut");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
@@ -569,12 +450,12 @@ BaseButton::BaseButton() {
toggle_mode = false;
shortcut_in_tooltip = true;
+ keep_pressed_outside = false;
status.pressed = false;
status.press_attempt = false;
status.hovering = false;
status.pressing_inside = false;
status.disabled = false;
- status.pressing_button = 0;
set_focus_mode(FOCUS_ALL);
enabled_focus_mode = FOCUS_ALL;
action_mode = ACTION_MODE_BUTTON_RELEASE;
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index 9a00cc79f2..4762c27b28 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -52,6 +52,7 @@ private:
int button_mask;
bool toggle_mode;
bool shortcut_in_tooltip;
+ bool keep_pressed_outside;
FocusMode enabled_focus_mode;
Ref<ShortCut> shortcut;
@@ -64,7 +65,6 @@ private:
bool pressing_inside;
bool disabled;
- int pressing_button;
} status;
@@ -110,6 +110,9 @@ public:
void set_action_mode(ActionMode p_mode);
ActionMode get_action_mode() const;
+ void set_keep_pressed_outside(bool p_on);
+ bool is_keep_pressed_outside() const;
+
void set_button_mask(int p_mask);
int get_button_mask() const;
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index 35e3119473..a2d0f388c4 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -34,13 +34,15 @@
#include "servers/visual_server.h"
Size2 CheckButton::get_icon_size() const {
- Ref<Texture> on = Control::get_icon("on");
- Ref<Texture> off = Control::get_icon("off");
+
+ Ref<Texture> on = Control::get_icon(is_disabled() ? "on_disabled" : "on");
+ Ref<Texture> off = Control::get_icon(is_disabled() ? "off_disabled" : "off");
Size2 tex_size = Size2(0, 0);
if (!on.is_null())
tex_size = Size2(on->get_width(), on->get_height());
if (!off.is_null())
tex_size = Size2(MAX(tex_size.width, off->get_width()), MAX(tex_size.height, off->get_height()));
+
return tex_size;
}
@@ -49,9 +51,8 @@ Size2 CheckButton::get_minimum_size() const {
Size2 minsize = Button::get_minimum_size();
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
- if (get_text().length() > 0) {
+ if (get_text().length() > 0)
minsize.width += get_constant("hseparation");
- }
Ref<StyleBox> sb = get_stylebox("normal");
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(MARGIN_TOP) + sb->get_margin(MARGIN_BOTTOM));
@@ -67,8 +68,8 @@ void CheckButton::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<Texture> on = Control::get_icon("on");
- Ref<Texture> off = Control::get_icon("off");
+ Ref<Texture> on = Control::get_icon(is_disabled() ? "on_disabled" : "on");
+ Ref<Texture> off = Control::get_icon(is_disabled() ? "off_disabled" : "off");
Ref<StyleBox> sb = get_stylebox("normal");
Vector2 ofs;
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index accf8aa7c2..bca3471091 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -38,8 +38,6 @@
#include "editor_scale.h"
#include "editor_settings.h"
#endif
-
-#include "scene/gui/separator.h"
#include "scene/main/viewport.h"
void ColorPicker::_notification(int p_what) {
@@ -469,7 +467,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
set_pick_color(presets[index]);
_update_color();
emit_signal("color_changed", color);
- } else if (bev->is_pressed() && bev->get_button_index() == BUTTON_RIGHT) {
+ } else if (bev->is_pressed() && bev->get_button_index() == BUTTON_RIGHT && presets_enabled) {
int index = bev->get_position().x / (preset->get_size().x / presets.size());
Color clicked_preset = presets[index];
erase_preset(clicked_preset);
@@ -565,6 +563,31 @@ void ColorPicker::_html_focus_exit() {
_focus_exit();
}
+void ColorPicker::set_presets_enabled(bool p_enabled) {
+ presets_enabled = p_enabled;
+ if (!p_enabled) {
+ bt_add_preset->set_disabled(true);
+ bt_add_preset->set_focus_mode(FOCUS_NONE);
+ } else {
+ bt_add_preset->set_disabled(false);
+ bt_add_preset->set_focus_mode(FOCUS_ALL);
+ }
+}
+
+bool ColorPicker::are_presets_enabled() const {
+ return presets_enabled;
+}
+
+void ColorPicker::set_presets_visible(bool p_visible) {
+ presets_visible = p_visible;
+ preset_separator->set_visible(p_visible);
+ preset_container->set_visible(p_visible);
+}
+
+bool ColorPicker::are_presets_visible() const {
+ return presets_visible;
+}
+
void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPicker::set_pick_color);
@@ -575,6 +598,10 @@ void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_deferred_mode"), &ColorPicker::is_deferred_mode);
ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPicker::set_edit_alpha);
ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPicker::is_editing_alpha);
+ ClassDB::bind_method(D_METHOD("set_presets_enabled", "enabled"), &ColorPicker::set_presets_enabled);
+ ClassDB::bind_method(D_METHOD("are_presets_enabled"), &ColorPicker::are_presets_enabled);
+ ClassDB::bind_method(D_METHOD("set_presets_visible", "visible"), &ColorPicker::set_presets_visible);
+ ClassDB::bind_method(D_METHOD("are_presets_visible"), &ColorPicker::are_presets_visible);
ClassDB::bind_method(D_METHOD("add_preset", "color"), &ColorPicker::add_preset);
ClassDB::bind_method(D_METHOD("erase_preset", "color"), &ColorPicker::erase_preset);
ClassDB::bind_method(D_METHOD("get_presets"), &ColorPicker::get_presets);
@@ -598,6 +625,8 @@ void ColorPicker::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha");
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");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "presets_visible"), "set_presets_visible", "are_presets_visible");
ADD_SIGNAL(MethodInfo("color_changed", PropertyInfo(Variant::COLOR, "color")));
ADD_SIGNAL(MethodInfo("preset_added", PropertyInfo(Variant::COLOR, "color")));
@@ -613,6 +642,8 @@ ColorPicker::ColorPicker() :
raw_mode_enabled = false;
deferred_mode_enabled = false;
changing_color = false;
+ presets_enabled = true;
+ presets_visible = true;
screen = NULL;
HBoxContainer *hb_smpl = memnew(HBoxContainer);
@@ -725,18 +756,19 @@ ColorPicker::ColorPicker() :
set_pick_color(Color(1, 1, 1));
- add_child(memnew(HSeparator));
+ preset_separator = memnew(HSeparator);
+ add_child(preset_separator);
- HBoxContainer *bbc = memnew(HBoxContainer);
- add_child(bbc);
+ preset_container = memnew(HBoxContainer);
+ add_child(preset_container);
preset = memnew(TextureRect);
- bbc->add_child(preset);
+ preset_container->add_child(preset);
preset->connect("gui_input", this, "_preset_input");
preset->connect("draw", this, "_update_presets");
bt_add_preset = memnew(Button);
- bbc->add_child(bt_add_preset);
+ preset_container->add_child(bt_add_preset);
bt_add_preset->set_tooltip(TTR("Add current color as a preset."));
bt_add_preset->connect("pressed", this, "_add_preset_pressed");
}
@@ -758,23 +790,27 @@ void ColorPickerButton::_modal_closed() {
void ColorPickerButton::pressed() {
_update_picker();
- popup->set_position(get_global_position() - picker->get_combined_minimum_size());
+ popup->set_position(get_global_position() - picker->get_combined_minimum_size() * get_global_transform().get_scale());
+ popup->set_scale(get_global_transform().get_scale());
popup->popup();
picker->set_focus_on_line_edit();
}
void ColorPickerButton::_notification(int p_what) {
- if (p_what == NOTIFICATION_DRAW) {
+ switch (p_what) {
+ case NOTIFICATION_DRAW: {
- Ref<StyleBox> normal = get_stylebox("normal");
- Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
- draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
- draw_rect(r, color);
- }
+ Ref<StyleBox> normal = get_stylebox("normal");
+ Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
+ draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
+ draw_rect(r, color);
+ } break;
+ case MainLoop::NOTIFICATION_WM_QUIT_REQUEST: {
- if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST && popup) {
- popup->hide();
+ if (popup)
+ popup->hide();
+ } break;
}
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index b78844839a..b5ddf2d0c2 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -37,6 +37,7 @@
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/popup.h"
+#include "scene/gui/separator.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_rect.h"
@@ -52,6 +53,8 @@ private:
Control *w_edit;
TextureRect *sample;
TextureRect *preset;
+ HBoxContainer *preset_container;
+ HSeparator *preset_separator;
Button *bt_add_preset;
List<Color> presets;
ToolButton *btn_pick;
@@ -70,6 +73,8 @@ private:
bool deferred_mode_enabled;
bool updating;
bool changing_color;
+ bool presets_enabled;
+ bool presets_visible;
float h, s, v;
Color last_hsv;
@@ -114,6 +119,12 @@ public:
void set_deferred_mode(bool p_enabled);
bool is_deferred_mode() const;
+ void set_presets_enabled(bool p_enabled);
+ bool are_presets_enabled() const;
+
+ void set_presets_visible(bool p_visible);
+ bool are_presets_visible() const;
+
void set_focus_on_line_edit();
ColorPicker();
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 7f1ca58d58..1f9bfb9936 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -177,7 +177,7 @@ String Container::get_configuration_warning() const {
if (warning != String()) {
warning += "\n";
}
- warning += TTR("Container by itself serves no purpose unless a script configures it's children placement behavior.\nIf you dont't intend to add a script, then please use a plain 'Control' node instead.");
+ warning += TTR("Container by itself serves no purpose unless a script configures it's children placement behavior.\nIf you don't intend to add a script, then please use a plain 'Control' node instead.");
}
return warning;
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index c7cd2bb6d8..76275c2420 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -43,6 +43,7 @@
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
+#include "editor/plugins/canvas_item_editor_plugin.h"
#endif
#include <stdio.h>
@@ -66,6 +67,7 @@ Dictionary Control::_edit_get_state() const {
s["margins"] = margins;
return s;
}
+
void Control::_edit_set_state(const Dictionary &p_state) {
Dictionary state = p_state;
@@ -87,7 +89,12 @@ void Control::_edit_set_state(const Dictionary &p_state) {
}
void Control::_edit_set_position(const Point2 &p_position) {
+#ifdef TOOLS_ENABLED
+ set_position(p_position, CanvasItemEditor::get_singleton()->is_anchors_mode_enabled());
+#else
+ // Unlikely to happen. TODO: enclose all _edit_ functions into TOOLS_ENABLED
set_position(p_position);
+#endif
};
Point2 Control::_edit_get_position() const {
@@ -103,8 +110,14 @@ Size2 Control::_edit_get_scale() const {
}
void Control::_edit_set_rect(const Rect2 &p_edit_rect) {
+#ifdef TOOLS_ENABLED
+ set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snapped(Vector2(1, 1)), CanvasItemEditor::get_singleton()->is_anchors_mode_enabled());
+ set_size(p_edit_rect.size.snapped(Vector2(1, 1)), CanvasItemEditor::get_singleton()->is_anchors_mode_enabled());
+#else
+ // Unlikely to happen. TODO: enclose all _edit_ functions into TOOLS_ENABLED
set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snapped(Vector2(1, 1)));
set_size(p_edit_rect.size.snapped(Vector2(1, 1)));
+#endif
}
Rect2 Control::_edit_get_rect() const {
@@ -276,7 +289,7 @@ void Control::_update_minimum_size() {
Size2 minsize = get_combined_minimum_size();
if (minsize.x > data.size_cache.x ||
minsize.y > data.size_cache.y) {
- _size_changed();
+ set_size(data.size_cache);
}
data.updating_last_minimum_size = false;
@@ -1366,7 +1379,7 @@ void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bo
float previous_margin_pos = data.margin[p_margin] + data.anchor[p_margin] * parent_range;
float previous_opposite_margin_pos = data.margin[(p_margin + 2) % 4] + data.anchor[(p_margin + 2) % 4] * parent_range;
- data.anchor[p_margin] = CLAMP(p_anchor, 0.0, 1.0);
+ data.anchor[p_margin] = p_anchor;
if (((p_margin == MARGIN_LEFT || p_margin == MARGIN_TOP) && data.anchor[p_margin] > data.anchor[(p_margin + 2) % 4]) ||
((p_margin == MARGIN_RIGHT || p_margin == MARGIN_BOTTOM) && data.anchor[p_margin] < data.anchor[(p_margin + 2) % 4])) {
@@ -1395,15 +1408,7 @@ void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bo
}
void Control::_set_anchor(Margin p_margin, float p_anchor) {
-#ifdef TOOLS_ENABLED
- if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
- set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false));
- } else {
- set_anchor(p_margin, p_anchor, false);
- }
-#else
- set_anchor(p_margin, p_anchor, false);
-#endif
+ set_anchor(p_margin, p_anchor);
}
void Control::set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor) {
@@ -1412,7 +1417,7 @@ void Control::set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos
set_margin(p_margin, p_pos);
}
-void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
+void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margins) {
//Left
switch (p_preset) {
case PRESET_TOP_LEFT:
@@ -1423,21 +1428,21 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
case PRESET_LEFT_WIDE:
case PRESET_HCENTER_WIDE:
case PRESET_WIDE:
- set_anchor(MARGIN_LEFT, ANCHOR_BEGIN, p_keep_margin);
+ set_anchor(MARGIN_LEFT, ANCHOR_BEGIN, p_keep_margins);
break;
case PRESET_CENTER_TOP:
case PRESET_CENTER_BOTTOM:
case PRESET_CENTER:
case PRESET_VCENTER_WIDE:
- set_anchor(MARGIN_LEFT, 0.5, p_keep_margin);
+ set_anchor(MARGIN_LEFT, 0.5, p_keep_margins);
break;
case PRESET_TOP_RIGHT:
case PRESET_BOTTOM_RIGHT:
case PRESET_CENTER_RIGHT:
case PRESET_RIGHT_WIDE:
- set_anchor(MARGIN_LEFT, ANCHOR_END, p_keep_margin);
+ set_anchor(MARGIN_LEFT, ANCHOR_END, p_keep_margins);
break;
}
@@ -1451,21 +1456,21 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
case PRESET_TOP_WIDE:
case PRESET_VCENTER_WIDE:
case PRESET_WIDE:
- set_anchor(MARGIN_TOP, ANCHOR_BEGIN, p_keep_margin);
+ set_anchor(MARGIN_TOP, ANCHOR_BEGIN, p_keep_margins);
break;
case PRESET_CENTER_LEFT:
case PRESET_CENTER_RIGHT:
case PRESET_CENTER:
case PRESET_HCENTER_WIDE:
- set_anchor(MARGIN_TOP, 0.5, p_keep_margin);
+ set_anchor(MARGIN_TOP, 0.5, p_keep_margins);
break;
case PRESET_BOTTOM_LEFT:
case PRESET_BOTTOM_RIGHT:
case PRESET_CENTER_BOTTOM:
case PRESET_BOTTOM_WIDE:
- set_anchor(MARGIN_TOP, ANCHOR_END, p_keep_margin);
+ set_anchor(MARGIN_TOP, ANCHOR_END, p_keep_margins);
break;
}
@@ -1475,14 +1480,14 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
case PRESET_BOTTOM_LEFT:
case PRESET_CENTER_LEFT:
case PRESET_LEFT_WIDE:
- set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN, p_keep_margin);
+ set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN, p_keep_margins);
break;
case PRESET_CENTER_TOP:
case PRESET_CENTER_BOTTOM:
case PRESET_CENTER:
case PRESET_VCENTER_WIDE:
- set_anchor(MARGIN_RIGHT, 0.5, p_keep_margin);
+ set_anchor(MARGIN_RIGHT, 0.5, p_keep_margins);
break;
case PRESET_TOP_RIGHT:
@@ -1493,7 +1498,7 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
case PRESET_BOTTOM_WIDE:
case PRESET_HCENTER_WIDE:
case PRESET_WIDE:
- set_anchor(MARGIN_RIGHT, ANCHOR_END, p_keep_margin);
+ set_anchor(MARGIN_RIGHT, ANCHOR_END, p_keep_margins);
break;
}
@@ -1503,14 +1508,14 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
case PRESET_TOP_RIGHT:
case PRESET_CENTER_TOP:
case PRESET_TOP_WIDE:
- set_anchor(MARGIN_BOTTOM, ANCHOR_BEGIN, p_keep_margin);
+ set_anchor(MARGIN_BOTTOM, ANCHOR_BEGIN, p_keep_margins);
break;
case PRESET_CENTER_LEFT:
case PRESET_CENTER_RIGHT:
case PRESET_CENTER:
case PRESET_HCENTER_WIDE:
- set_anchor(MARGIN_BOTTOM, 0.5, p_keep_margin);
+ set_anchor(MARGIN_BOTTOM, 0.5, p_keep_margins);
break;
case PRESET_BOTTOM_LEFT:
@@ -1521,7 +1526,7 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
case PRESET_BOTTOM_WIDE:
case PRESET_VCENTER_WIDE:
case PRESET_WIDE:
- set_anchor(MARGIN_BOTTOM, ANCHOR_END, p_keep_margin);
+ set_anchor(MARGIN_BOTTOM, ANCHOR_END, p_keep_margins);
break;
}
}
@@ -1714,7 +1719,11 @@ Point2 Control::get_global_position() const {
return get_global_transform().get_origin();
}
-void Control::set_global_position(const Point2 &p_point) {
+void Control::_set_global_position(const Point2 &p_point) {
+ set_global_position(p_point);
+}
+
+void Control::set_global_position(const Point2 &p_point, bool p_keep_margins) {
Transform2D inv;
@@ -1723,7 +1732,7 @@ void Control::set_global_position(const Point2 &p_point) {
inv = data.parent_canvas_item->get_global_transform().affine_inverse();
}
- set_position(inv.xform(p_point));
+ set_position(inv.xform(p_point), p_keep_margins);
}
Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margins[4]) const {
@@ -1737,6 +1746,15 @@ Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margi
return result;
}
+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;
+ 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;
+ r_anchors[3] = (p_rect.position.y + p_rect.size.y - p_margins[3]) / parent_rect_size.y;
+}
+
void Control::_compute_margins(Rect2 p_rect, const float p_anchors[4], float (&r_margins)[4]) {
Size2 parent_rect_size = get_parent_anchorable_rect().size;
@@ -1746,13 +1764,28 @@ void Control::_compute_margins(Rect2 p_rect, const float p_anchors[4], float (&r
r_margins[3] = p_rect.position.y + p_rect.size.y - (p_anchors[3] * parent_rect_size.y);
}
-void Control::set_position(const Size2 &p_point) {
+void Control::_set_position(const Size2 &p_point) {
+ set_position(p_point);
+}
- _compute_margins(Rect2(p_point, data.size_cache), data.anchor, data.margin);
+void Control::set_position(const Size2 &p_point, bool p_keep_margins) {
+ if (p_keep_margins) {
+ _compute_anchors(Rect2(p_point, data.size_cache), data.margin, data.anchor);
+ _change_notify("anchor_left");
+ _change_notify("anchor_right");
+ _change_notify("anchor_top");
+ _change_notify("anchor_bottom");
+ } else {
+ _compute_margins(Rect2(p_point, data.size_cache), data.anchor, data.margin);
+ }
_size_changed();
}
-void Control::set_size(const Size2 &p_size) {
+void Control::_set_size(const Size2 &p_size) {
+ set_size(p_size);
+}
+
+void Control::set_size(const Size2 &p_size, bool p_keep_margins) {
Size2 new_size = p_size;
Size2 min = get_combined_minimum_size();
@@ -1761,7 +1794,15 @@ void Control::set_size(const Size2 &p_size) {
if (new_size.y < min.y)
new_size.y = min.y;
- _compute_margins(Rect2(data.pos_cache, new_size), data.anchor, data.margin);
+ if (p_keep_margins) {
+ _compute_anchors(Rect2(data.pos_cache, new_size), data.margin, data.anchor);
+ _change_notify("anchor_left");
+ _change_notify("anchor_right");
+ _change_notify("anchor_top");
+ _change_notify("anchor_bottom");
+ } else {
+ _compute_margins(Rect2(data.pos_cache, new_size), data.anchor, data.margin);
+ }
_size_changed();
}
@@ -1799,53 +1840,72 @@ Rect2 Control::get_anchorable_rect() const {
void Control::add_icon_override(const StringName &p_name, const Ref<Texture> &p_icon) {
- ERR_FAIL_COND(p_icon.is_null());
if (data.icon_override.has(p_name)) {
data.icon_override[p_name]->disconnect("changed", this, "_override_changed");
}
- data.icon_override[p_name] = p_icon;
- if (data.icon_override[p_name].is_valid()) {
- data.icon_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
+
+ // clear if "null" is passed instead of a icon
+ if (p_icon.is_null()) {
+ data.icon_override.erase(p_name);
+ } else {
+ data.icon_override[p_name] = p_icon;
+ if (data.icon_override[p_name].is_valid()) {
+ data.icon_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
+ }
}
notification(NOTIFICATION_THEME_CHANGED);
}
void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader) {
- ERR_FAIL_COND(p_shader.is_null());
+
if (data.shader_override.has(p_name)) {
data.shader_override[p_name]->disconnect("changed", this, "_override_changed");
}
- data.shader_override[p_name] = p_shader;
- if (data.shader_override[p_name].is_valid()) {
- data.shader_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
+
+ // clear if "null" is passed instead of a shader
+ if (p_shader.is_null()) {
+ data.shader_override.erase(p_name);
+ } else {
+ data.shader_override[p_name] = p_shader;
+ if (data.shader_override[p_name].is_valid()) {
+ data.shader_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
+ }
}
notification(NOTIFICATION_THEME_CHANGED);
}
void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> &p_style) {
- ERR_FAIL_COND(p_style.is_null());
if (data.style_override.has(p_name)) {
data.style_override[p_name]->disconnect("changed", this, "_override_changed");
}
- data.style_override[p_name] = p_style;
- if (data.style_override[p_name].is_valid()) {
- data.style_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
- }
+ // clear if "null" is passed instead of a style
+ if (p_style.is_null()) {
+ data.style_override.erase(p_name);
+ } else {
+ data.style_override[p_name] = p_style;
+ if (data.style_override[p_name].is_valid()) {
+ data.style_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
+ }
+ }
notification(NOTIFICATION_THEME_CHANGED);
}
void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_font) {
- ERR_FAIL_COND(p_font.is_null());
if (data.font_override.has(p_name)) {
data.font_override[p_name]->disconnect("changed", this, "_override_changed");
}
- data.font_override[p_name] = p_font;
- if (data.font_override[p_name].is_valid()) {
- data.font_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
- }
+ // clear if "null" is passed instead of a font
+ if (p_font.is_null()) {
+ data.font_override.erase(p_name);
+ } else {
+ data.font_override[p_name] = p_font;
+ if (data.font_override[p_name].is_valid()) {
+ data.font_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
+ }
+ }
notification(NOTIFICATION_THEME_CHANGED);
}
void Control::add_color_override(const StringName &p_name, const Color &p_color) {
@@ -2634,6 +2694,12 @@ bool Control::is_visibility_clip_disabled() const {
void Control::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
+#ifdef TOOLS_ENABLED
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
+#else
+ const String quote_style = "\"";
+#endif
+
Node::get_argument_options(p_function, p_idx, r_options);
if (p_idx == 0) {
@@ -2651,7 +2717,7 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List
sn.sort_custom<StringName::AlphCompare>();
for (List<StringName>::Element *E = sn.front(); E; E = E->next()) {
- r_options->push_back("\"" + E->get() + "\"");
+ r_options->push_back(quote_style + E->get() + quote_style);
}
}
}
@@ -2696,20 +2762,23 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event);
ClassDB::bind_method(D_METHOD("get_minimum_size"), &Control::get_minimum_size);
ClassDB::bind_method(D_METHOD("get_combined_minimum_size"), &Control::get_combined_minimum_size);
- ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_margin"), &Control::set_anchors_preset, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_margins"), &Control::set_anchors_preset, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_margins_preset", "preset", "resize_mode", "margin"), &Control::set_margins_preset, DEFVAL(PRESET_MODE_MINSIZE), DEFVAL(0));
ClassDB::bind_method(D_METHOD("set_anchors_and_margins_preset", "preset", "resize_mode", "margin"), &Control::set_anchors_and_margins_preset, DEFVAL(PRESET_MODE_MINSIZE), DEFVAL(0));
- ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor", "keep_margin", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor"), &Control::_set_anchor);
+ ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor", "keep_margin", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_anchor", "margin"), &Control::get_anchor);
ClassDB::bind_method(D_METHOD("set_margin", "margin", "offset"), &Control::set_margin);
ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_begin", "position"), &Control::set_begin);
ClassDB::bind_method(D_METHOD("set_end", "position"), &Control::set_end);
- ClassDB::bind_method(D_METHOD("set_position", "position"), &Control::set_position);
- ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size);
+ ClassDB::bind_method(D_METHOD("set_position", "position", "keep_margins"), &Control::set_position, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("_set_position", "margin"), &Control::_set_position);
+ ClassDB::bind_method(D_METHOD("set_size", "size", "keep_margins"), &Control::set_size, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("_set_size", "size"), &Control::_set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
- ClassDB::bind_method(D_METHOD("set_global_position", "position"), &Control::set_global_position);
+ ClassDB::bind_method(D_METHOD("set_global_position", "position", "keep_margins"), &Control::set_global_position, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("_set_global_position", "position"), &Control::_set_global_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_degrees", "degrees"), &Control::set_rotation_degrees);
ClassDB::bind_method(D_METHOD("set_scale", "scale"), &Control::set_scale);
@@ -2829,10 +2898,10 @@ void Control::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_clips_input"));
ADD_GROUP("Anchor", "anchor_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01,or_lesser,or_greater"), "_set_anchor", "get_anchor", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.01,or_lesser,or_greater"), "_set_anchor", "get_anchor", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.01,or_lesser,or_greater"), "_set_anchor", "get_anchor", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.01,or_lesser,or_greater"), "_set_anchor", "get_anchor", MARGIN_BOTTOM);
ADD_GROUP("Margin", "margin_");
ADD_PROPERTYI(PropertyInfo(Variant::INT, "margin_left", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_LEFT);
@@ -2845,9 +2914,9 @@ void Control::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "grow_vertical", PROPERTY_HINT_ENUM, "Begin,End,Both"), "set_v_grow_direction", "get_v_grow_direction");
ADD_GROUP("Rect", "rect_");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_global_position", PROPERTY_HINT_NONE, "", 0), "set_global_position", "get_global_position");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_position", "get_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_global_position", PROPERTY_HINT_NONE, "", 0), "_set_global_position", "get_global_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_degrees", "get_rotation_degrees");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_scale"), "set_scale", "get_scale");
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 5e33f6ba43..a6f9a442ae 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -217,6 +217,9 @@ private:
Control *_get_focus_neighbour(Margin p_margin, int p_count = 0);
void _set_anchor(Margin p_margin, float p_anchor);
+ void _set_position(const Point2 &p_point);
+ void _set_global_position(const Point2 &p_point);
+ void _set_size(const Size2 &p_size);
void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true);
void _theme_changed();
@@ -229,6 +232,7 @@ private:
Rect2 _compute_child_rect(const float p_anchors[4], const float p_margins[4]) const;
void _compute_margins(Rect2 p_rect, const float p_anchors[4], float (&r_margins)[4]);
+ void _compute_anchors(Rect2 p_rect, const float p_margins[4], float (&r_anchors)[4]);
void _size_changed();
String _get_tooltip() const;
@@ -325,7 +329,7 @@ public:
/* POSITIONING */
- void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin = true);
+ void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margins = true);
void set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode = PRESET_MODE_MINSIZE, int p_margin = 0);
void set_anchors_and_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode = PRESET_MODE_MINSIZE, int p_margin = 0);
@@ -343,12 +347,12 @@ public:
Point2 get_begin() const;
Point2 get_end() const;
- void set_position(const Point2 &p_point);
- void set_global_position(const Point2 &p_point);
+ void set_position(const Point2 &p_point, bool p_keep_margins = false);
+ void set_global_position(const Point2 &p_point, bool p_keep_margins = false);
Point2 get_position() const;
Point2 get_global_position() const;
- void set_size(const Size2 &p_size);
+ void set_size(const Size2 &p_size, bool p_keep_margins = false);
Size2 get_size() const;
Rect2 get_rect() const;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 026374ded1..406c8e4f48 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -470,6 +470,8 @@ Size2 ItemList::Item::get_icon_size() const {
void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
+ double prev_scroll = scroll_bar->get_value();
+
Ref<InputEventMouseMotion> mm = p_event;
if (defer_select_single >= 0 && mm.is_valid()) {
defer_select_single = -1;
@@ -767,6 +769,9 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
scroll_bar->set_value(scroll_bar->get_value() + scroll_bar->get_page() * pan_gesture->get_delta().y / 8);
}
+
+ if (scroll_bar->get_value() != prev_scroll)
+ accept_event(); //accept event if scroll changed
}
void ItemList::ensure_current_is_visible() {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 1e8d73b6a4..1f778bc516 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -56,6 +56,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed() && b->get_button_index() == BUTTON_RIGHT && context_menu_enabled) {
menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
+ menu->set_scale(get_global_transform().get_scale());
menu->popup();
grab_focus();
return;
@@ -67,6 +68,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
_reset_caret_blink_timer();
if (b->is_pressed()) {
+ accept_event(); //don't pass event further when clicked on text field
if (!text.empty() && is_editable() && _is_over_clear_button(b->get_position())) {
clear_button_status.press_attempt = true;
clear_button_status.pressing_inside = true;
@@ -158,6 +160,38 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (!k->is_pressed())
return;
+
+#ifdef APPLE_STYLE_KEYS
+ if (k->get_control() && !k->get_shift() && !k->get_alt() && !k->get_command()) {
+ uint32_t remap_key = KEY_UNKNOWN;
+ switch (k->get_scancode()) {
+ case KEY_F: {
+ remap_key = KEY_RIGHT;
+ } break;
+ case KEY_B: {
+ remap_key = KEY_LEFT;
+ } break;
+ case KEY_P: {
+ remap_key = KEY_UP;
+ } break;
+ case KEY_N: {
+ remap_key = KEY_DOWN;
+ } break;
+ case KEY_D: {
+ remap_key = KEY_DELETE;
+ } break;
+ case KEY_H: {
+ remap_key = KEY_BACKSPACE;
+ } break;
+ }
+
+ if (remap_key != KEY_UNKNOWN) {
+ k->set_scancode(remap_key);
+ k->set_control(false);
+ }
+ }
+#endif
+
unsigned int code = k->get_scancode();
if (k->get_command()) {
@@ -612,9 +646,7 @@ void LineEdit::_notification(int p_what) {
#endif
case NOTIFICATION_RESIZED: {
- if (expand_to_text_length) {
- window_pos = 0; //force scroll back since it's expanding to text length
- }
+ window_pos = 0;
set_cursor_position(get_cursor_position());
} break;
@@ -1327,7 +1359,27 @@ void LineEdit::select_all() {
void LineEdit::set_editable(bool p_editable) {
+ if (editable == p_editable)
+ return;
+
editable = p_editable;
+
+ // Reorganize context menu.
+ menu->clear();
+ if (editable)
+ menu->add_item(RTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
+ menu->add_item(RTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
+ if (editable)
+ menu->add_item(RTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
+ menu->add_separator();
+ menu->add_item(RTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
+ if (editable) {
+ menu->add_item(RTR("Clear"), MENU_CLEAR);
+ menu->add_separator();
+ menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
+ menu->add_item(RTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z);
+ }
+
update();
}
@@ -1623,7 +1675,6 @@ LineEdit::LineEdit() {
deselect();
set_focus_mode(FOCUS_ALL);
- editable = true;
set_default_cursor_shape(CURSOR_IBEAM);
set_mouse_filter(MOUSE_FILTER_STOP);
@@ -1638,15 +1689,8 @@ LineEdit::LineEdit() {
context_menu_enabled = true;
menu = memnew(PopupMenu);
add_child(menu);
- menu->add_item(RTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
- menu->add_item(RTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
- menu->add_item(RTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
- menu->add_separator();
- menu->add_item(RTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
- menu->add_item(RTR("Clear"), MENU_CLEAR);
- menu->add_separator();
- menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
- menu->add_item(RTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z);
+ editable = false; // initialise to opposite first, so we get past the early-out in set_editable
+ set_editable(true);
menu->connect("id_pressed", this, "menu_option");
expand_to_text_length = false;
}
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index 5f21d73ab2..e12cd55e6f 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -55,8 +55,9 @@ void MenuButton::pressed() {
Size2 size = get_size();
Point2 gp = get_global_position();
- popup->set_global_position(gp + Size2(0, size.height));
+ popup->set_global_position(gp + Size2(0, size.height * get_global_transform().get_scale().y));
popup->set_size(Size2(size.width, 0));
+ popup->set_scale(get_global_transform().get_scale());
popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
popup->popup();
}
@@ -135,7 +136,6 @@ MenuButton::MenuButton() {
popup = memnew(PopupMenu);
popup->hide();
add_child(popup);
- popup->set_as_toplevel(true);
popup->set_pass_on_modal_close_click(false);
popup->connect("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton.
popup->connect("popup_hide", this, "set_pressed", varray(false));
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 8c75393d01..694065497a 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -109,21 +109,21 @@ void OptionButton::_selected(int p_which) {
void OptionButton::pressed() {
Size2 size = get_size();
- popup->set_global_position(get_global_position() + Size2(0, size.height));
+ popup->set_global_position(get_global_position() + Size2(0, size.height * get_global_transform().get_scale().y));
popup->set_size(Size2(size.width, 0));
-
+ popup->set_scale(get_global_transform().get_scale());
popup->popup();
}
-void OptionButton::add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID) {
+void OptionButton::add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_id) {
- popup->add_icon_radio_check_item(p_icon, p_label, p_ID);
+ popup->add_icon_radio_check_item(p_icon, p_label, p_id);
if (popup->get_item_count() == 1)
select(0);
}
-void OptionButton::add_item(const String &p_label, int p_ID) {
+void OptionButton::add_item(const String &p_label, int p_id) {
- popup->add_radio_check_item(p_label, p_ID);
+ popup->add_radio_check_item(p_label, p_id);
if (popup->get_item_count() == 1)
select(0);
}
@@ -136,9 +136,9 @@ void OptionButton::set_item_icon(int p_idx, const Ref<Texture> &p_icon) {
popup->set_item_icon(p_idx, p_icon);
}
-void OptionButton::set_item_id(int p_idx, int p_ID) {
+void OptionButton::set_item_id(int p_idx, int p_id) {
- popup->set_item_id(p_idx, p_ID);
+ popup->set_item_id(p_idx, p_id);
}
void OptionButton::set_item_metadata(int p_idx, const Variant &p_metadata) {
@@ -338,8 +338,8 @@ void OptionButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
// "selected" property must come after "items", otherwise GH-10213 occurs
ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected");
- ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "ID")));
- ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "ID")));
+ ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "id")));
}
OptionButton::OptionButton() {
@@ -352,8 +352,8 @@ OptionButton::OptionButton() {
popup = memnew(PopupMenu);
popup->hide();
add_child(popup);
- popup->set_as_toplevel(true);
popup->set_pass_on_modal_close_click(false);
+ popup->set_notify_transform(true);
popup->connect("id_pressed", this, "_selected");
popup->connect("id_focused", this, "_focused");
popup->connect("popup_hide", this, "set_pressed", varray(false));
diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h
index 63b451377a..51d5fd6947 100644
--- a/scene/gui/option_button.h
+++ b/scene/gui/option_button.h
@@ -59,12 +59,12 @@ protected:
static void _bind_methods();
public:
- void add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1);
- void add_item(const String &p_label, int p_ID = -1);
+ void add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_id = -1);
+ void add_item(const String &p_label, int p_id = -1);
void set_item_text(int p_idx, const String &p_text);
void set_item_icon(int p_idx, const Ref<Texture> &p_icon);
- void set_item_id(int p_idx, int p_ID);
+ void set_item_id(int p_idx, int p_id);
void set_item_metadata(int p_idx, const Variant &p_metadata);
void set_item_disabled(int p_idx, bool p_disabled);
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index bd9584f3db..fdb1b65f77 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -65,7 +65,7 @@ void Popup::_notification(int p_what) {
void Popup::_fix_size() {
Point2 pos = get_global_position();
- Size2 size = get_size();
+ Size2 size = get_size() * get_scale();
Point2 window_size = get_viewport_rect().size;
if (pos.x + size.width > window_size.width)
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 23c61f37d6..984307530d 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -54,9 +54,11 @@ Size2 PopupMenu::get_minimum_size() const {
Ref<Font> font = get_font("font");
float max_w = 0;
+ float icon_w = 0;
int font_h = font->get_height();
- int check_w = MAX(get_icon("checked")->get_width(), get_icon("radio_checked")->get_width());
+ int check_w = MAX(get_icon("checked")->get_width(), get_icon("radio_checked")->get_width()) + hseparation;
int accel_max_w = 0;
+ bool has_check = false;
for (int i = 0; i < items.size(); i++) {
@@ -65,8 +67,7 @@ Size2 PopupMenu::get_minimum_size() const {
Size2 icon_size = items[i].icon->get_size();
size.height = MAX(icon_size.height, font_h);
- size.width += icon_size.width;
- size.width += hseparation;
+ icon_w = MAX(icon_size.width + hseparation, icon_w);
} else {
size.height = font_h;
@@ -74,10 +75,8 @@ Size2 PopupMenu::get_minimum_size() const {
size.width += items[i].h_ofs;
- if (items[i].checkable_type) {
-
- size.width += check_w + hseparation;
- }
+ if (items[i].checkable_type)
+ has_check = true;
String text = items[i].shortcut.is_valid() ? String(tr(items[i].shortcut->get_name())) : items[i].xl_text;
size.width += font->get_string_size(text).width;
@@ -91,16 +90,17 @@ Size2 PopupMenu::get_minimum_size() const {
accel_max_w = MAX(accel_w, accel_max_w);
}
- if (items[i].submenu != "") {
-
+ if (items[i].submenu != "")
size.width += get_icon("submenu")->get_width();
- }
- minsize.height += size.height;
max_w = MAX(max_w, size.width);
+
+ minsize.height += size.height;
}
- minsize.width += max_w + accel_max_w;
+ minsize.width += max_w + icon_w + accel_max_w;
+ if (has_check)
+ minsize.width += check_w;
return minsize;
}
@@ -147,10 +147,10 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const {
void PopupMenu::_activate_submenu(int over) {
Node *n = get_node(items[over].submenu);
- ERR_EXPLAIN("item subnode does not exist: " + items[over].submenu);
+ ERR_EXPLAIN("Item subnode does not exist: " + items[over].submenu);
ERR_FAIL_COND(!n);
Popup *pm = Object::cast_to<Popup>(n);
- ERR_EXPLAIN("item subnode is not a Popup: " + items[over].submenu);
+ ERR_EXPLAIN("Item subnode is not a Popup: " + items[over].submenu);
ERR_FAIL_COND(!pm);
if (pm->is_visible_in_tree())
return; //already visible!
@@ -159,13 +159,14 @@ void PopupMenu::_activate_submenu(int over) {
Rect2 pr(p, get_size());
Ref<StyleBox> style = get_stylebox("panel");
- Point2 pos = p + Point2(get_size().width, items[over]._ofs_cache - style->get_offset().y);
+ Point2 pos = p + Point2(get_size().width, items[over]._ofs_cache - style->get_offset().y) * get_global_transform().get_scale();
Size2 size = pm->get_size();
// fix pos
if (pos.x + size.width > get_viewport_rect().size.width)
pos.x = p.x - size.width;
pm->set_position(pos);
+ pm->set_scale(get_global_transform().get_scale());
pm->popup();
PopupMenu *pum = Object::cast_to<PopupMenu>(pm);
@@ -196,11 +197,11 @@ void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
- float dy = (vseparation + font->get_height()) * 3 * p_factor;
+ float dy = (vseparation + font->get_height()) * 3 * p_factor * get_global_transform().get_scale().y;
if (dy > 0 && global_y < 0)
dy = MIN(dy, -global_y - 1);
- else if (dy < 0 && global_y + get_size().y > get_viewport_rect().size.y)
- dy = -MIN(-dy, global_y + get_size().y - get_viewport_rect().size.y - 1);
+ else if (dy < 0 && global_y + get_size().y * get_global_transform().get_scale().y > get_viewport_rect().size.y)
+ dy = -MIN(-dy, global_y + get_size().y * get_global_transform().get_scale().y - get_viewport_rect().size.y - 1);
set_position(get_position() + Vector2(0, dy));
Ref<InputEventMouseMotion> ie;
@@ -289,7 +290,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
case BUTTON_WHEEL_DOWN: {
- if (get_global_position().y + get_size().y > get_viewport_rect().size.y) {
+ if (get_global_position().y + get_size().y * get_global_transform().get_scale().y > get_viewport_rect().size.y) {
_scroll(-b->get_factor(), b->get_position());
}
} break;
@@ -354,7 +355,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
}
int over = _get_mouse_over(m->get_position());
- int id = (over < 0 || items[over].separator || items[over].disabled) ? -1 : (items[over].ID >= 0 ? items[over].ID : over);
+ int id = (over < 0 || items[over].separator || items[over].disabled) ? -1 : (items[over].id >= 0 ? items[over].id : over);
if (id < 0) {
mouse_over = -1;
@@ -415,7 +416,6 @@ void PopupMenu::_notification(int p_what) {
minimum_size_changed();
update();
-
} break;
case NOTIFICATION_DRAW: {
@@ -443,15 +443,31 @@ void PopupMenu::_notification(int p_what) {
Color font_color_hover = get_color("font_color_hover");
float font_h = font->get_height();
+ // Add the check and the wider icon to the offset of all items.
+ float icon_ofs = 0.0;
+ bool has_check = false;
+ for (int i = 0; i < items.size(); i++) {
+
+ if (!items[i].icon.is_null())
+ icon_ofs = MAX(items[i].icon->get_size().width, icon_ofs);
+
+ if (items[i].checkable_type)
+ has_check = true;
+ }
+ if (icon_ofs > 0.0)
+ icon_ofs += hseparation;
+
+ float check_ofs = 0.0;
+ if (has_check)
+ check_ofs = MAX(get_icon("checked")->get_width(), get_icon("radio_checked")->get_width()) + hseparation;
+
for (int i = 0; i < items.size(); i++) {
if (i > 0)
ofs.y += vseparation;
Point2 item_ofs = ofs;
- float h;
Size2 icon_size;
-
- Color icon_color(1, 1, 1, items[i].disabled ? 0.5 : 1);
+ float h;
if (!items[i].icon.is_null()) {
@@ -489,16 +505,15 @@ void PopupMenu::_notification(int p_what) {
}
}
+ Color icon_color(1, 1, 1, items[i].disabled ? 0.5 : 1);
+
if (items[i].checkable_type) {
Texture *icon = (items[i].checked ? check[items[i].checkable_type - 1] : uncheck[items[i].checkable_type - 1]).ptr();
icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon->get_height()) / 2.0)), icon_color);
- item_ofs.x += icon->get_width() + hseparation;
}
if (!items[i].icon.is_null()) {
- items[i].icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon_size.height) / 2.0)), icon_color);
- item_ofs.x += items[i].icon->get_width();
- item_ofs.x += hseparation;
+ items[i].icon->draw(ci, item_ofs + Size2(check_ofs, 0) + Point2(0, Math::floor((h - icon_size.height) / 2.0)), icon_color);
}
if (items[i].submenu != "") {
@@ -514,6 +529,7 @@ void PopupMenu::_notification(int p_what) {
}
} else {
+ item_ofs.x += icon_ofs + check_ofs;
font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text, items[i].disabled ? font_color_disabled : (i == mouse_over ? font_color_hover : font_color));
}
@@ -528,7 +544,6 @@ void PopupMenu::_notification(int p_what) {
ofs.y += h;
}
-
} break;
case MainLoop::NOTIFICATION_WM_FOCUS_OUT: {
@@ -576,93 +591,93 @@ void PopupMenu::_notification(int p_what) {
}
}
-void PopupMenu::add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_id, uint32_t p_accel) {
Item item;
item.icon = p_icon;
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID;
+ item.id = p_id;
items.push_back(item);
update();
minimum_size_changed();
}
-void PopupMenu::add_item(const String &p_label, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_item(const String &p_label, int p_id, uint32_t p_accel) {
Item item;
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID == -1 ? items.size() : p_ID;
+ item.id = p_id == -1 ? items.size() : p_id;
items.push_back(item);
update();
minimum_size_changed();
}
-void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, int p_ID) {
+void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, int p_id) {
Item item;
item.text = p_label;
item.xl_text = tr(p_label);
- item.ID = p_ID;
+ item.id = p_id;
item.submenu = p_submenu;
items.push_back(item);
update();
minimum_size_changed();
}
-void PopupMenu::add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_id, uint32_t p_accel) {
Item item;
item.icon = p_icon;
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID;
+ item.id = p_id;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
update();
minimum_size_changed();
}
-void PopupMenu::add_check_item(const String &p_label, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_check_item(const String &p_label, int p_id, uint32_t p_accel) {
Item item;
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID == -1 ? items.size() : p_ID;
+ item.id = p_id == -1 ? items.size() : p_id;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
update();
minimum_size_changed();
}
-void PopupMenu::add_radio_check_item(const String &p_label, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_radio_check_item(const String &p_label, int p_id, uint32_t p_accel) {
- add_check_item(p_label, p_ID, p_accel);
+ add_check_item(p_label, p_id, p_accel);
items.write[items.size() - 1].checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
update();
minimum_size_changed();
}
-void PopupMenu::add_icon_radio_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_icon_radio_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_id, uint32_t p_accel) {
- add_icon_check_item(p_icon, p_label, p_ID, p_accel);
+ add_icon_check_item(p_icon, p_label, p_id, p_accel);
items.write[items.size() - 1].checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
update();
minimum_size_changed();
}
-void PopupMenu::add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
+void PopupMenu::add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
ERR_FAIL_COND(p_shortcut.is_null());
_ref_shortcut(p_shortcut);
Item item;
- item.ID = p_ID;
+ item.id = p_id;
item.icon = p_icon;
item.shortcut = p_shortcut;
item.shortcut_is_global = p_global;
@@ -671,14 +686,14 @@ void PopupMenu::add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut
minimum_size_changed();
}
-void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
+void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
ERR_FAIL_COND(p_shortcut.is_null());
_ref_shortcut(p_shortcut);
Item item;
- item.ID = p_ID;
+ item.id = p_id;
item.shortcut = p_shortcut;
item.shortcut_is_global = p_global;
items.push_back(item);
@@ -686,14 +701,14 @@ void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_g
minimum_size_changed();
}
-void PopupMenu::add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
+void PopupMenu::add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
ERR_FAIL_COND(p_shortcut.is_null());
_ref_shortcut(p_shortcut);
Item item;
- item.ID = p_ID;
+ item.id = p_id;
item.shortcut = p_shortcut;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
item.icon = p_icon;
@@ -703,14 +718,14 @@ void PopupMenu::add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<Sh
minimum_size_changed();
}
-void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
+void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
ERR_FAIL_COND(p_shortcut.is_null());
_ref_shortcut(p_shortcut);
Item item;
- item.ID = p_ID;
+ item.id = p_id;
item.shortcut = p_shortcut;
item.shortcut_is_global = p_global;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
@@ -719,21 +734,21 @@ void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bo
minimum_size_changed();
}
-void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
+void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
- add_check_shortcut(p_shortcut, p_ID, p_global);
+ add_check_shortcut(p_shortcut, p_id, p_global);
items.write[items.size() - 1].checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
update();
minimum_size_changed();
}
-void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_ID, uint32_t p_accel) {
+void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_id, uint32_t p_accel) {
Item item;
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID;
+ item.id = p_id;
item.max_states = p_max_states;
item.state = p_default_state;
items.push_back(item);
@@ -767,10 +782,10 @@ void PopupMenu::set_item_checked(int p_idx, bool p_checked) {
update();
minimum_size_changed();
}
-void PopupMenu::set_item_id(int p_idx, int p_ID) {
+void PopupMenu::set_item_id(int p_idx, int p_id) {
ERR_FAIL_INDEX(p_idx, items.size());
- items.write[p_idx].ID = p_ID;
+ items.write[p_idx].id = p_id;
update();
minimum_size_changed();
@@ -866,14 +881,14 @@ bool PopupMenu::is_item_checked(int p_idx) const {
int PopupMenu::get_item_id(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, items.size(), 0);
- return items[p_idx].ID;
+ return items[p_idx].id;
}
-int PopupMenu::get_item_index(int p_ID) const {
+int PopupMenu::get_item_index(int p_id) const {
for (int i = 0; i < items.size(); i++) {
- if (items[i].ID == p_ID)
+ if (items[i].id == p_id)
return i;
}
@@ -1062,7 +1077,7 @@ void PopupMenu::activate_item(int p_item) {
ERR_FAIL_INDEX(p_item, items.size());
ERR_FAIL_COND(items[p_item].separator);
- int id = items[p_item].ID >= 0 ? items[p_item].ID : p_item;
+ int id = items[p_item].id >= 0 ? items[p_item].id : p_item;
//hide all parent PopupMenus
Node *next = get_parent();
@@ -1124,7 +1139,7 @@ void PopupMenu::add_separator(const String &p_text) {
Item sep;
sep.separator = true;
- sep.ID = -1;
+ sep.id = -1;
if (p_text != String()) {
sep.text = p_text;
sep.xl_text = tr(p_text);
@@ -1400,8 +1415,8 @@ void PopupMenu::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hide_on_state_item_selection"), "set_hide_on_state_item_selection", "is_hide_on_state_item_selection");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "submenu_popup_delay"), "set_submenu_popup_delay", "get_submenu_popup_delay");
- ADD_SIGNAL(MethodInfo("id_pressed", PropertyInfo(Variant::INT, "ID")));
- ADD_SIGNAL(MethodInfo("id_focused", PropertyInfo(Variant::INT, "ID")));
+ ADD_SIGNAL(MethodInfo("id_pressed", PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("id_focused", PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("index_pressed", PropertyInfo(Variant::INT, "index")));
}
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 767ff568fe..687006d58d 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -55,7 +55,7 @@ class PopupMenu : public Popup {
int state;
bool separator;
bool disabled;
- int ID;
+ int id;
Variant metadata;
String submenu;
String tooltip;
@@ -120,26 +120,26 @@ protected:
static void _bind_methods();
public:
- void add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
- void add_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
- void add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
- void add_check_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
- void add_radio_check_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
- void add_icon_radio_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
- void add_submenu_item(const String &p_label, const String &p_submenu, int p_ID = -1);
-
- void add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
- void add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
- void add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
- void add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
- void add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
-
- void add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_ID = -1, uint32_t p_accel = 0);
+ void add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_id = -1, uint32_t p_accel = 0);
+ void add_item(const String &p_label, int p_id = -1, uint32_t p_accel = 0);
+ void add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_id = -1, uint32_t p_accel = 0);
+ void add_check_item(const String &p_label, int p_id = -1, uint32_t p_accel = 0);
+ void add_radio_check_item(const String &p_label, int p_id = -1, uint32_t p_accel = 0);
+ void add_icon_radio_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_id = -1, uint32_t p_accel = 0);
+ void add_submenu_item(const String &p_label, const String &p_submenu, int p_id = -1);
+
+ void add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id = -1, bool p_global = false);
+ void add_shortcut(const Ref<ShortCut> &p_shortcut, int p_id = -1, bool p_global = false);
+ void add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id = -1, bool p_global = false);
+ void add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id = -1, bool p_global = false);
+ void add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id = -1, bool p_global = false);
+
+ void add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_id = -1, uint32_t p_accel = 0);
void set_item_text(int p_idx, const String &p_text);
void set_item_icon(int p_idx, const Ref<Texture> &p_icon);
void set_item_checked(int p_idx, bool p_checked);
- void set_item_id(int p_idx, int p_ID);
+ void set_item_id(int p_idx, int p_id);
void set_item_accelerator(int p_idx, uint32_t p_accel);
void set_item_metadata(int p_idx, const Variant &p_meta);
void set_item_disabled(int p_idx, bool p_disabled);
@@ -161,7 +161,7 @@ public:
Ref<Texture> get_item_icon(int p_idx) const;
bool is_item_checked(int p_idx) const;
int get_item_id(int p_idx) const;
- int get_item_index(int p_ID) const;
+ int get_item_index(int p_id) const;
uint32_t get_item_accelerator(int p_idx) const;
Variant get_item_metadata(int p_idx) const;
bool is_item_disabled(int p_idx) const;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 101eb2ac88..da452e3f10 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2336,6 +2336,7 @@ RichTextLabel::RichTextLabel() {
tab_size = 4;
default_align = ALIGN_LEFT;
underline_meta = true;
+ meta_hovering = NULL;
override_selected_font_color = false;
scroll_visible = false;
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 2938654ed9..686d1c96cc 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -53,29 +53,19 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (b.is_valid()) {
accept_event();
- if (b->get_button_index() == 5 && b->is_pressed()) {
+ if (b->get_button_index() == BUTTON_WHEEL_DOWN && b->is_pressed()) {
- /*
- if (orientation==VERTICAL)
- set_val( get_val() + get_page() / 4.0 );
- else
- */
set_value(get_value() + get_page() / 4.0);
accept_event();
}
- if (b->get_button_index() == 4 && b->is_pressed()) {
+ if (b->get_button_index() == BUTTON_WHEEL_UP && b->is_pressed()) {
- /*
- if (orientation==HORIZONTAL)
- set_val( get_val() - get_page() / 4.0 );
- else
- */
set_value(get_value() - get_page() / 4.0);
accept_event();
}
- if (b->get_button_index() != 1)
+ if (b->get_button_index() != BUTTON_LEFT)
return;
if (b->is_pressed()) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index e50a71b0ff..a1034937b5 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -88,13 +88,16 @@ void ScrollContainer::_cancel_drag() {
void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
+ double prev_v_scroll = v_scroll->get_value();
+ double prev_h_scroll = h_scroll->get_value();
+
Ref<InputEventMouseButton> mb = p_gui_input;
if (mb.is_valid()) {
if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
// only horizontal is enabled, scroll horizontally
- if (h_scroll->is_visible() && !v_scroll->is_visible()) {
+ if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() / 8 * mb->get_factor());
} else if (v_scroll->is_visible_in_tree()) {
v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() / 8 * mb->get_factor());
@@ -103,7 +106,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
// only horizontal is enabled, scroll horizontally
- if (h_scroll->is_visible() && !v_scroll->is_visible()) {
+ if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() / 8 * mb->get_factor());
} else if (v_scroll->is_visible()) {
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() / 8 * mb->get_factor());
@@ -122,6 +125,9 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
+ if (v_scroll->get_value() != prev_v_scroll || h_scroll->get_value() != prev_h_scroll)
+ accept_event(); //accept event if scroll changed
+
if (!OS::get_singleton()->has_touchscreen_ui_hint())
return;
@@ -204,6 +210,9 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * pan_gesture->get_delta().y / 8);
}
}
+
+ if (v_scroll->get_value() != prev_v_scroll || h_scroll->get_value() != prev_h_scroll)
+ accept_event(); //accept event if scroll changed
}
void ScrollContainer::_update_scrollbar_position() {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index d21143739c..e778af3ceb 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -277,6 +277,7 @@ SpinBox::SpinBox() {
add_child(line_edit);
line_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ line_edit->set_mouse_filter(MOUSE_FILTER_PASS);
//connect("value_changed",this,"_value_changed");
line_edit->connect("text_entered", this, "_text_entered", Vector<Variant>(), CONNECT_DEFERRED);
line_edit->connect("focus_exited", this, "_line_edit_focus_exit", Vector<Variant>(), CONNECT_DEFERRED);
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index ad41cc4167..39c76e6646 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -86,8 +86,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("pre_popup_pressed");
Vector2 popup_pos = get_global_position();
- popup_pos.x += size.width - popup->get_size().width;
- popup_pos.y += menu->get_height();
+ popup_pos.x += size.width * get_global_transform().get_scale().x - popup->get_size().width * popup->get_global_transform().get_scale().x;
+ popup_pos.y += menu->get_height() * get_global_transform().get_scale().y;
popup->set_global_position(popup_pos);
popup->popup();
@@ -146,6 +146,11 @@ void TabContainer::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_TRANSLATION_CHANGED: {
+
+ minimum_size_changed();
+ update();
+ } break;
case NOTIFICATION_RESIZED: {
Vector<Control *> tabs = _get_tabs();
@@ -181,7 +186,6 @@ void TabContainer::_notification(int p_what) {
first_tab_cache--;
}
} break;
-
case NOTIFICATION_DRAW: {
RID canvas = get_canvas_item();
@@ -350,6 +354,7 @@ void TabContainer::_notification(int p_what) {
}
} break;
case NOTIFICATION_THEME_CHANGED: {
+
minimum_size_changed();
call_deferred("_on_theme_changed"); //wait until all changed theme
} break;
@@ -731,6 +736,7 @@ void TabContainer::set_tab_title(int p_tab, const String &p_title) {
Control *child = _get_tab(p_tab);
ERR_FAIL_COND(!child);
child->set_meta("_tab_name", p_title);
+ update();
}
String TabContainer::get_tab_title(int p_tab) const {
@@ -748,6 +754,7 @@ void TabContainer::set_tab_icon(int p_tab, const Ref<Texture> &p_icon) {
Control *child = _get_tab(p_tab);
ERR_FAIL_COND(!child);
child->set_meta("_tab_icon", p_icon);
+ update();
}
Ref<Texture> TabContainer::get_tab_icon(int p_tab) const {
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index ac643c1320..36571cc878 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -222,6 +222,10 @@ void Tabs::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_TRANSLATION_CHANGED: {
+ minimum_size_changed();
+ update();
+ } break;
case NOTIFICATION_MOUSE_EXIT: {
rb_hover = -1;
cb_hover = -1;
@@ -232,7 +236,6 @@ void Tabs::_notification(int p_what) {
_update_cache();
_ensure_no_over_offset();
ensure_tab_visible(current);
-
} break;
case NOTIFICATION_DRAW: {
_update_cache();
@@ -394,7 +397,6 @@ void Tabs::_notification(int p_what) {
} else {
buttons_visible = false;
}
-
} break;
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index c77705f35f..3117d8c59f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -104,6 +104,13 @@ static CharType _get_right_pair_symbol(CharType c) {
return 0;
}
+static int _find_first_non_whitespace_column_of_line(const String &line) {
+ int left = 0;
+ while (left < line.length() && _is_whitespace(line[left]))
+ left++;
+ return left;
+}
+
void TextEdit::Text::set_font(const Ref<Font> &p_font) {
font = p_font;
@@ -292,6 +299,7 @@ void TextEdit::Text::insert(int p_at, const String &p_text) {
line.marked = false;
line.safe = false;
line.breakpoint = false;
+ line.bookmark = false;
line.hidden = false;
line.width_cache = -1;
line.wrap_amount_cache = -1;
@@ -346,7 +354,7 @@ void TextEdit::_update_scrollbars() {
if (line_numbers)
total_width += cache.line_number_w;
- if (draw_breakpoint_gutter) {
+ if (draw_breakpoint_gutter || draw_bookmark_gutter) {
total_width += cache.breakpoint_gutter_width;
}
@@ -398,6 +406,7 @@ void TextEdit::_update_scrollbars() {
cursor.line_ofs = 0;
cursor.wrap_ofs = 0;
v_scroll->set_value(0);
+ v_scroll->set_max(0);
v_scroll->hide();
}
@@ -416,6 +425,7 @@ void TextEdit::_update_scrollbars() {
cursor.x_ofs = 0;
h_scroll->set_value(0);
+ h_scroll->set_max(0);
h_scroll->hide();
}
@@ -605,7 +615,7 @@ void TextEdit::_notification(int p_what) {
draw_caret = false;
}
- if (draw_breakpoint_gutter) {
+ if (draw_breakpoint_gutter || draw_bookmark_gutter) {
breakpoint_gutter_width = (get_row_height() * 55) / 100;
cache.breakpoint_gutter_width = breakpoint_gutter_width;
} else {
@@ -825,6 +835,9 @@ void TextEdit::_notification(int p_what) {
// get the highlighted words
String highlighted_text = get_selection_text();
+ // check if highlighted words contains only whitespaces (tabs or spaces)
+ bool only_whitespaces_highlighted = highlighted_text.strip_edges() == String();
+
String line_num_padding = line_numbers_zero_padded ? "0" : " ";
int cursor_wrap_index = get_cursor_wrap_index();
@@ -951,6 +964,16 @@ void TextEdit::_notification(int p_what) {
#endif
}
+ // draw bookmark marker
+ if (text.is_bookmark(line)) {
+ if (draw_bookmark_gutter) {
+ int vertical_gap = (get_row_height() * 40) / 100;
+ int horizontal_gap = (cache.breakpoint_gutter_width * 30) / 100;
+ int marker_radius = get_row_height() - (vertical_gap * 2);
+ VisualServer::get_singleton()->canvas_item_add_circle(ci, Point2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2 + marker_radius / 2, ofs_y + vertical_gap + marker_radius / 2), marker_radius, Color(cache.bookmark_color.r, cache.bookmark_color.g, cache.bookmark_color.b));
+ }
+ }
+
// draw breakpoint marker
if (text.is_breakpoint(line)) {
if (draw_breakpoint_gutter) {
@@ -1069,10 +1092,7 @@ void TextEdit::_notification(int p_what) {
}
if ((char_ofs + char_margin + char_w) >= xmargin_end) {
- if (syntax_coloring)
- continue;
- else
- break;
+ break;
}
bool in_search_result = false;
@@ -1095,7 +1115,7 @@ void TextEdit::_notification(int p_what) {
if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) {
// draw the wrap indent offset highlight
if (line_wrap_index != 0 && j == 0) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin - indent_px, ofs_y, (char_ofs + char_margin), get_row_height()), cache.current_line_color);
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin - indent_px, ofs_y, indent_px, get_row_height()), cache.current_line_color);
}
// if its the last char draw to end of the line
if (j == str.length() - 1) {
@@ -1123,7 +1143,7 @@ void TextEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color);
}
- if (highlight_all_occurrences) {
+ if (highlight_all_occurrences && !only_whitespaces_highlighted) {
if (highlighted_text_col != -1) {
// if we are at the end check for new word on same line
@@ -1252,6 +1272,11 @@ void TextEdit::_notification(int p_what) {
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);
}
+ 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);
+ }
+
char_ofs += char_w;
if (line_wrap_index == line_wrap_amount && j == str.length() - 1 && is_folded(line)) {
@@ -1557,8 +1582,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
}
if ((ch == '\'' || ch == '"') &&
- cursor_get_column() > 0 &&
- _is_text_char(text[cursor.line][cursor_get_column() - 1])) {
+ cursor_get_column() > 0 && _is_text_char(text[cursor.line][cursor_get_column() - 1]) && !_is_pair_right_symbol(text[cursor.line][cursor_get_column()])) {
insert_text_at_cursor(ch_single);
cursor_set_column(cursor_position_to_move);
return;
@@ -1630,31 +1654,25 @@ void TextEdit::backspace_at_cursor() {
_consume_backspace_for_pair_symbol(prev_line, prev_column);
} else {
// handle space indentation
- if (cursor.column - indent_size >= 0 && indent_using_spaces) {
-
- // if there is enough spaces to count as a tab
+ if (cursor.column != 0 && indent_using_spaces) {
+ // check if there are no other chars before cursor, just indentation
bool unindent = true;
- for (int i = 1; i <= indent_size; i++) {
- if (text[cursor.line][cursor.column - i] != ' ') {
- unindent = false;
- break;
- }
- }
-
- // and it is before the first character
int i = 0;
while (i < cursor.column && i < text[cursor.line].length()) {
- if (text[cursor.line][i] != ' ' && text[cursor.line][i] != '\t') {
+ if (!_is_whitespace(text[cursor.line][i])) {
unindent = false;
break;
}
i++;
}
- // then we can remove it as a single character.
+ // then we can remove all spaces as a single character.
if (unindent) {
- _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column);
- prev_column = cursor.column - indent_size;
+ // we want to remove spaces up to closest indent
+ // or whole indent if cursor is pointing at it
+ int spaces_to_delete = _calculate_spaces_till_next_left_indent(cursor.column);
+ prev_column = cursor.column - spaces_to_delete;
+ _remove_text(cursor.line, prev_column, cursor.line, cursor.column);
} else {
_remove_text(prev_line, prev_column, cursor.line, cursor.column);
}
@@ -1671,6 +1689,10 @@ void TextEdit::indent_right() {
int start_line;
int end_line;
+
+ // this value informs us by how much we changed selection position by indenting right
+ // default is 1 for tab indentation
+ int selection_offset = 1;
begin_complex_operation();
if (is_selection_active()) {
@@ -1689,18 +1711,24 @@ void TextEdit::indent_right() {
for (int i = start_line; i <= end_line; i++) {
String line_text = get_line(i);
if (indent_using_spaces) {
- line_text = space_indent + line_text;
+ // we don't really care where selection is - we just need to know indentation level at the beginning of the line
+ int left = _find_first_non_whitespace_column_of_line(line_text);
+ int spaces_to_add = _calculate_spaces_till_next_right_indent(left);
+ // since we will add this much spaces we want move whole selection and cursor by this much
+ selection_offset = spaces_to_add;
+ for (int j = 0; j < spaces_to_add; j++)
+ line_text = ' ' + line_text;
} else {
line_text = '\t' + line_text;
}
set_line(i, line_text);
}
- // fix selection and cursor being off by one on the last line
+ // fix selection and cursor being off after shifting selection right
if (is_selection_active()) {
- select(selection.from_line, selection.from_column + 1, selection.to_line, selection.to_column + 1);
+ select(selection.from_line, selection.from_column + selection_offset, selection.to_line, selection.to_column + selection_offset);
}
- cursor_set_column(cursor.column + 1, false);
+ cursor_set_column(cursor.column + selection_offset, false);
end_complex_operation();
update();
}
@@ -1709,6 +1737,15 @@ void TextEdit::indent_left() {
int start_line;
int end_line;
+
+ // moving cursor and selection after unindenting can get tricky
+ // because changing content of line can move cursor and selection on it's own (if new line ends before previous position of either)
+ // therefore we just remember initial values
+ // and at the end of the operation offset them by number of removed characters
+ int removed_characters = 0;
+ int initial_selection_end_column = selection.to_column;
+ int initial_cursor_column = cursor.column;
+
begin_complex_operation();
if (is_selection_active()) {
@@ -1731,21 +1768,43 @@ void TextEdit::indent_left() {
if (line_text.begins_with("\t")) {
line_text = line_text.substr(1, line_text.length());
set_line(i, line_text);
- } else if (line_text.begins_with(space_indent)) {
- line_text = line_text.substr(indent_size, line_text.length());
+ removed_characters = 1;
+ } else if (line_text.begins_with(" ")) {
+ // when unindenting we aim to remove spaces before line that has selection no matter what is selected
+ // so we start of by finding first non whitespace character of line
+ int left = _find_first_non_whitespace_column_of_line(line_text);
+
+ // here we remove only enough spaces to align text to nearest full multiple of indentation_size
+ // in case where selection begins at the start of indentation_size multiple we remove whole indentation level
+ int spaces_to_remove = _calculate_spaces_till_next_left_indent(left);
+
+ line_text = line_text.substr(spaces_to_remove, line_text.length());
set_line(i, line_text);
+ removed_characters = spaces_to_remove;
}
}
// fix selection and cursor being off by one on the last line
if (is_selection_active() && last_line_text != get_line(end_line)) {
- select(selection.from_line, selection.from_column - 1, selection.to_line, selection.to_column - 1);
+ select(selection.from_line, selection.from_column - removed_characters,
+ selection.to_line, initial_selection_end_column - removed_characters);
}
- cursor_set_column(cursor.column - 1, false);
+ cursor_set_column(initial_cursor_column - removed_characters, false);
end_complex_operation();
update();
}
+int TextEdit::_calculate_spaces_till_next_left_indent(int column) {
+ int spaces_till_indent = column % indent_size;
+ if (spaces_till_indent == 0)
+ spaces_till_indent = indent_size;
+ return spaces_till_indent;
+}
+
+int TextEdit::_calculate_spaces_till_next_right_indent(int column) {
+ return indent_size - column % indent_size;
+}
+
void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) const {
float rows = p_mouse.y;
@@ -1797,6 +1856,9 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co
void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
+ double prev_v_scroll = v_scroll->get_value();
+ double prev_h_scroll = h_scroll->get_value();
+
Ref<InputEventMouseButton> mb = p_gui_input;
if (mb.is_valid()) {
@@ -2027,6 +2089,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
+ menu->set_scale(get_global_transform().get_scale());
menu->popup();
grab_focus();
}
@@ -2050,6 +2113,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_scroll_down(delta);
}
h_scroll->set_value(h_scroll->get_value() + pan_gesture->get_delta().x * 100);
+ if (v_scroll->get_value() != prev_v_scroll || h_scroll->get_value() != prev_h_scroll)
+ accept_event(); //accept event if scroll changed
+
return;
}
@@ -2093,6 +2159,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
+ if (v_scroll->get_value() != prev_v_scroll || h_scroll->get_value() != prev_h_scroll)
+ accept_event(); //accept event if scroll changed
+
Ref<InputEventKey> k = p_gui_input;
if (k.is_valid()) {
@@ -2272,6 +2341,36 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
k->set_command(true);
k->set_shift(false);
}
+#ifdef APPLE_STYLE_KEYS
+ if (k->get_control() && !k->get_shift() && !k->get_alt() && !k->get_command()) {
+ uint32_t remap_key = KEY_UNKNOWN;
+ switch (k->get_scancode()) {
+ case KEY_F: {
+ remap_key = KEY_RIGHT;
+ } break;
+ case KEY_B: {
+ remap_key = KEY_LEFT;
+ } break;
+ case KEY_P: {
+ remap_key = KEY_UP;
+ } break;
+ case KEY_N: {
+ remap_key = KEY_DOWN;
+ } break;
+ case KEY_D: {
+ remap_key = KEY_DELETE;
+ } break;
+ case KEY_H: {
+ remap_key = KEY_BACKSPACE;
+ } break;
+ }
+
+ if (remap_key != KEY_UNKNOWN) {
+ k->set_scancode(remap_key);
+ k->set_control(false);
+ }
+ }
+#endif
_reset_caret_blink_timer();
@@ -2471,15 +2570,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
} else {
if (k->get_shift()) {
- //simple unindent
+ // simple unindent
int cc = cursor.column;
-
- const int len = text[cursor.line].length();
const String &line = text[cursor.line];
- int left = 0; // number of whitespace chars at beginning of line
- while (left < len && (line[left] == '\t' || line[left] == ' '))
- left++;
+ int left = _find_first_non_whitespace_column_of_line(line);
cc = MIN(cc, left);
while (cc < indent_size && cc < left && line[cc] == ' ')
@@ -2487,24 +2582,18 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (cc > 0 && cc <= text[cursor.line].length()) {
if (text[cursor.line][cc - 1] == '\t') {
+ // tabs unindentation
_remove_text(cursor.line, cc - 1, cursor.line, cc);
if (cursor.column >= left)
cursor_set_column(MAX(0, cursor.column - 1));
update();
} else {
- int n = 0;
-
- for (int i = 1; i <= MIN(cc, indent_size); i++) {
- if (line[cc - i] != ' ') {
- break;
- }
- n++;
- }
-
- if (n > 0) {
- _remove_text(cursor.line, cc - n, cursor.line, cc);
- if (cursor.column > left - n) // inside text?
- cursor_set_column(MAX(0, cursor.column - n));
+ // spaces unindentation
+ int spaces_to_remove = _calculate_spaces_till_next_left_indent(cc);
+ if (spaces_to_remove > 0) {
+ _remove_text(cursor.line, cc - spaces_to_remove, cursor.line, cc);
+ if (cursor.column > left - spaces_to_remove) // inside text?
+ cursor_set_column(MAX(0, cursor.column - spaces_to_remove));
update();
}
}
@@ -2513,9 +2602,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
update();
}
} else {
- //simple indent
+ // simple indent
if (indent_using_spaces) {
- _insert_text_at_cursor(space_indent);
+ // insert only as much spaces as needed till next indentation level
+ int spaces_to_add = _calculate_spaces_till_next_right_indent(cursor.column);
+ String indent_to_insert = String();
+ for (int i = 0; i < spaces_to_add; i++)
+ indent_to_insert = ' ' + indent_to_insert;
+ _insert_text_at_cursor(indent_to_insert);
} else {
_insert_text_at_cursor("\t");
}
@@ -2606,9 +2700,22 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
- cursor_set_column(0);
+ // Start at first column (it's slightly faster that way) and look for the first non-whitespace character.
+ int new_cursor_pos = 0;
+ for (int i = 0; i < text[cursor.line].length(); ++i) {
+ if (!_is_whitespace(text[cursor.line][i])) {
+ new_cursor_pos = i;
+ break;
+ }
+ }
+ if (new_cursor_pos == cursor.column) {
+ // We're already at the first text character, so move to the very beginning of the line.
+ cursor_set_column(0);
+ } else {
+ // We're somewhere to the right of the first text character; move to the first one.
+ cursor_set_column(new_cursor_pos);
+ }
} else if (k->get_alt()) {
-
#else
if (k->get_alt()) {
scancode_handled = false;
@@ -3555,7 +3662,7 @@ void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r
op.chain_forward = false;
op.chain_backward = false;
- //see if it shold just be set as current op
+ //see if it should just be set as current op
if (current_op.type != op.type) {
op.prev_version = get_version();
_push_current_op();
@@ -3606,7 +3713,7 @@ void TextEdit::_remove_text(int p_from_line, int p_from_column, int p_to_line, i
op.chain_forward = false;
op.chain_backward = false;
- //see if it shold just be set as current op
+ //see if it should just be set as current op
if (current_op.type != op.type) {
op.prev_version = get_version();
_push_current_op();
@@ -4062,7 +4169,7 @@ void TextEdit::_scroll_moved(double p_to_val) {
int v_scroll_i = floor(get_v_scroll());
int sc = 0;
int n_line;
- for (n_line = 0; n_line < text.size(); n_line++) {
+ for (n_line = 0; n_line < text.size() - 1; n_line++) {
if (!is_line_hidden(n_line)) {
sc++;
sc += times_line_wraps(n_line);
@@ -4255,17 +4362,22 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
void TextEdit::set_text(String p_text) {
setting_text = true;
- _clear();
- _insert_text_at_cursor(p_text);
- clear_undo_history();
- cursor.column = 0;
- cursor.line = 0;
- cursor.x_ofs = 0;
- cursor.line_ofs = 0;
- cursor.wrap_ofs = 0;
- cursor.last_fit_x = 0;
- cursor_set_line(0);
- cursor_set_column(0);
+ if (!undo_enabled) {
+ _clear();
+ _insert_text_at_cursor(p_text);
+ }
+
+ if (undo_enabled) {
+ cursor_set_line(0);
+ cursor_set_column(0);
+
+ begin_complex_operation();
+ _remove_text(0, 0, MAX(0, get_line_count() - 1), MAX(get_line(MAX(get_line_count() - 1, 0)).size() - 1, 0));
+ _insert_text_at_cursor(p_text);
+ end_complex_operation();
+ selection.active = false;
+ }
+
update();
setting_text = false;
@@ -4362,7 +4474,27 @@ void TextEdit::clear() {
void TextEdit::set_readonly(bool p_readonly) {
+ if (readonly == p_readonly)
+ return;
+
readonly = p_readonly;
+
+ // Reorganize context menu.
+ menu->clear();
+ if (!readonly)
+ menu->add_item(RTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
+ menu->add_item(RTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
+ if (!readonly)
+ menu->add_item(RTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
+ menu->add_separator();
+ menu->add_item(RTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
+ if (!readonly) {
+ menu->add_item(RTR("Clear"), MENU_CLEAR);
+ menu->add_separator();
+ menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
+ menu->add_item(RTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z);
+ }
+
update();
}
@@ -4431,6 +4563,7 @@ void TextEdit::_update_caches() {
cache.mark_color = get_color("mark_color");
cache.current_line_color = get_color("current_line_color");
cache.line_length_guideline_color = get_color("line_length_guideline_color");
+ cache.bookmark_color = get_color("bookmark_color");
cache.breakpoint_color = get_color("breakpoint_color");
cache.executing_line_color = get_color("executing_line_color");
cache.code_folding_color = get_color("code_folding_color");
@@ -4447,6 +4580,7 @@ void TextEdit::_update_caches() {
#endif
cache.row_height = cache.font->get_height() + cache.line_spacing;
cache.tab_icon = get_icon("tab");
+ cache.space_icon = get_icon("space");
cache.folded_icon = get_icon("folded");
cache.can_fold_icon = get_icon("fold");
cache.folded_eol_icon = get_icon("GuiEllipsis", "EditorIcons");
@@ -5027,6 +5161,37 @@ void TextEdit::clear_executing_line() {
update();
}
+bool TextEdit::is_line_set_as_bookmark(int p_line) const {
+
+ ERR_FAIL_INDEX_V(p_line, text.size(), false);
+ return text.is_bookmark(p_line);
+}
+
+void TextEdit::set_line_as_bookmark(int p_line, bool p_bookmark) {
+
+ ERR_FAIL_INDEX(p_line, text.size());
+ text.set_bookmark(p_line, p_bookmark);
+ update();
+}
+
+void TextEdit::get_bookmarks(List<int> *p_bookmarks) const {
+
+ for (int i = 0; i < text.size(); i++) {
+ if (text.is_bookmark(i))
+ p_bookmarks->push_back(i);
+ }
+}
+
+Array TextEdit::get_bookmarks_array() const {
+
+ Array arr;
+ for (int i = 0; i < text.size(); i++) {
+ if (text.is_bookmark(i))
+ arr.append(i);
+ }
+ return arr;
+}
+
bool TextEdit::is_line_set_as_breakpoint(int p_line) const {
ERR_FAIL_INDEX_V(p_line, text.size(), false);
@@ -5583,6 +5748,16 @@ bool TextEdit::is_drawing_tabs() const {
return draw_tabs;
}
+void TextEdit::set_draw_spaces(bool p_draw) {
+
+ draw_spaces = p_draw;
+}
+
+bool TextEdit::is_drawing_spaces() const {
+
+ return draw_spaces;
+}
+
void TextEdit::set_override_selected_font_color(bool p_override_selected_font_color) {
override_selected_font_color = p_override_selected_font_color;
}
@@ -5762,19 +5937,29 @@ void TextEdit::_confirm_completion() {
cursor_set_column(cursor.column - completion_base.length(), false);
insert_text_at_cursor(completion_current);
- // When inserted into the middle of an existing string, don't add an unnecessary quote
+ // When inserted into the middle of an existing string/method, don't add an unnecessary quote/bracket.
String line = text[cursor.line];
CharType next_char = line[cursor.column];
CharType last_completion_char = completion_current[completion_current.length() - 1];
- if ((last_completion_char == '"' || last_completion_char == '\'') &&
- last_completion_char == next_char) {
+ if ((last_completion_char == '"' || last_completion_char == '\'') && last_completion_char == next_char) {
_base_remove_text(cursor.line, cursor.column, cursor.line, cursor.column + 1);
}
- if (last_completion_char == '(' && auto_brace_completion_enabled) {
- insert_text_at_cursor(")");
- cursor.column--;
+ if (last_completion_char == '(') {
+
+ if (next_char == last_completion_char) {
+ _base_remove_text(cursor.line, cursor.column - 1, cursor.line, cursor.column);
+ } else if (auto_brace_completion_enabled) {
+ insert_text_at_cursor(")");
+ cursor.column--;
+ }
+ } else if (last_completion_char == ')' && next_char == '(') {
+
+ _base_remove_text(cursor.line, cursor.column - 2, cursor.line, cursor.column);
+ if (line[cursor.column + 1] != ')') {
+ cursor.column--;
+ }
}
end_complex_operation();
@@ -5818,6 +6003,7 @@ void TextEdit::_update_completion_candidates() {
bool inquote = false;
int first_quote = -1;
+ int restore_quotes = -1;
int c = cofs - 1;
while (c >= 0) {
@@ -5825,6 +6011,11 @@ void TextEdit::_update_completion_candidates() {
inquote = !inquote;
if (first_quote == -1)
first_quote = c;
+ restore_quotes = 0;
+ } else if (restore_quotes == 0 && l[c] == '$') {
+ restore_quotes = 1;
+ } else if (restore_quotes == 0 && !_is_whitespace(l[c])) {
+ restore_quotes = -1;
}
c--;
}
@@ -5892,6 +6083,11 @@ void TextEdit::_update_completion_candidates() {
completion_strings.write[i] = completion_strings[i].unquote().quote("'");
}
+ if (inquote && restore_quotes == 1 && !completion_strings[i].is_quoted()) {
+ String quote = single_quote ? "'" : "\"";
+ completion_strings.write[i] = completion_strings[i].quote(quote);
+ }
+
if (completion_strings[i].begins_with(s)) {
completion_options.push_back(completion_strings[i]);
} else if (completion_strings[i].to_lower().begins_with(s.to_lower())) {
@@ -5969,7 +6165,6 @@ void TextEdit::code_complete(const Vector<String> &p_strings, bool p_forced) {
completion_current = "";
completion_index = 0;
_update_completion_candidates();
- //
}
String TextEdit::get_word_at_pos(const Vector2 &p_pos) const {
@@ -6084,6 +6279,15 @@ void TextEdit::set_line_length_guideline_column(int p_column) {
update();
}
+void TextEdit::set_bookmark_gutter_enabled(bool p_draw) {
+ draw_bookmark_gutter = p_draw;
+ update();
+}
+
+bool TextEdit::is_bookmark_gutter_enabled() const {
+ return draw_bookmark_gutter;
+}
+
void TextEdit::set_breakpoint_gutter_enabled(bool p_draw) {
draw_breakpoint_gutter = p_draw;
update();
@@ -6296,6 +6500,8 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_show_line_numbers_enabled"), &TextEdit::is_show_line_numbers_enabled);
ClassDB::bind_method(D_METHOD("set_draw_tabs"), &TextEdit::set_draw_tabs);
ClassDB::bind_method(D_METHOD("is_drawing_tabs"), &TextEdit::is_drawing_tabs);
+ ClassDB::bind_method(D_METHOD("set_draw_spaces"), &TextEdit::set_draw_spaces);
+ ClassDB::bind_method(D_METHOD("is_drawing_spaces"), &TextEdit::is_drawing_spaces);
ClassDB::bind_method(D_METHOD("set_breakpoint_gutter_enabled", "enable"), &TextEdit::set_breakpoint_gutter_enabled);
ClassDB::bind_method(D_METHOD("is_breakpoint_gutter_enabled"), &TextEdit::is_breakpoint_gutter_enabled);
ClassDB::bind_method(D_METHOD("set_draw_fold_gutter"), &TextEdit::set_draw_fold_gutter);
@@ -6347,6 +6553,7 @@ void TextEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "syntax_highlighting"), "set_syntax_coloring", "is_syntax_coloring_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_tabs"), "set_draw_tabs", "is_drawing_tabs");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_spaces"), "set_draw_spaces", "is_drawing_spaces");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "breakpoint_gutter"), "set_breakpoint_gutter_enabled", "is_breakpoint_gutter_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fold_gutter"), "set_draw_fold_gutter", "is_drawing_fold_gutter");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), "set_highlight_all_occurrences", "is_highlight_all_occurrences_enabled");
@@ -6386,9 +6593,9 @@ void TextEdit::_bind_methods() {
TextEdit::TextEdit() {
- readonly = false;
setting_row = false;
draw_tabs = false;
+ draw_spaces = false;
override_selected_font_color = false;
draw_caret = true;
max_chars = 0;
@@ -6477,6 +6684,7 @@ TextEdit::TextEdit() {
line_numbers_zero_padded = false;
line_length_guideline = false;
line_length_guideline_col = 80;
+ draw_bookmark_gutter = false;
draw_breakpoint_gutter = false;
draw_fold_gutter = false;
draw_info_gutter = false;
@@ -6501,15 +6709,8 @@ TextEdit::TextEdit() {
context_menu_enabled = true;
menu = memnew(PopupMenu);
add_child(menu);
- menu->add_item(RTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
- menu->add_item(RTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
- menu->add_item(RTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
- menu->add_separator();
- menu->add_item(RTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
- menu->add_item(RTR("Clear"), MENU_CLEAR);
- menu->add_separator();
- menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
- menu->add_item(RTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z);
+ readonly = true; // initialise to opposite first, so we get past the early-out in set_readonly
+ set_readonly(false);
menu->connect("id_pressed", this, "menu_option");
first_draw = true;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 4badd85e07..68e590f1e6 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -75,6 +75,7 @@ public:
int width_cache : 24;
bool marked : 1;
bool breakpoint : 1;
+ bool bookmark : 1;
bool hidden : 1;
bool safe : 1;
int wrap_amount_cache : 24;
@@ -105,6 +106,8 @@ public:
void set(int p_line, const String &p_text);
void set_marked(int p_line, bool p_marked) { text.write[p_line].marked = p_marked; }
bool is_marked(int p_line) const { return text[p_line].marked; }
+ void set_bookmark(int p_line, bool p_bookmark) { text.write[p_line].bookmark = p_bookmark; }
+ bool is_bookmark(int p_line) const { return text[p_line].bookmark; }
void set_breakpoint(int p_line, bool p_breakpoint) { text.write[p_line].breakpoint = p_breakpoint; }
bool is_breakpoint(int p_line) const { return text[p_line].breakpoint; }
void set_hidden(int p_line, bool p_hidden) { text.write[p_line].hidden = p_hidden; }
@@ -163,6 +166,7 @@ private:
struct Cache {
Ref<Texture> tab_icon;
+ Ref<Texture> space_icon;
Ref<Texture> can_fold_icon;
Ref<Texture> folded_icon;
Ref<Texture> folded_eol_icon;
@@ -187,6 +191,7 @@ private:
Color member_variable_color;
Color selection_color;
Color mark_color;
+ Color bookmark_color;
Color breakpoint_color;
Color executing_line_color;
Color code_folding_color;
@@ -290,6 +295,7 @@ private:
bool first_draw;
bool setting_row;
bool draw_tabs;
+ bool draw_spaces;
bool override_selected_font_color;
bool cursor_changed_dirty;
bool text_changed_dirty;
@@ -298,6 +304,7 @@ private:
bool line_numbers_zero_padded;
bool line_length_guideline;
int line_length_guideline_col;
+ bool draw_bookmark_gutter;
bool draw_breakpoint_gutter;
int breakpoint_gutter_width;
bool draw_fold_gutter;
@@ -430,6 +437,9 @@ private:
void _confirm_completion();
void _update_completion_candidates();
+ int _calculate_spaces_till_next_left_indent(int column);
+ int _calculate_spaces_till_next_right_indent(int column);
+
protected:
virtual String get_tooltip(const Point2 &p_pos) const;
@@ -488,6 +498,10 @@ public:
void insert_at(const String &p_text, int at);
int get_line_count() const;
void set_line_as_marked(int p_line, bool p_marked);
+ void set_line_as_bookmark(int p_line, bool p_bookmark);
+ bool is_line_set_as_bookmark(int p_line) const;
+ void get_bookmarks(List<int> *p_bookmarks) const;
+ Array get_bookmarks_array() const;
void set_line_as_breakpoint(int p_line, bool p_breakpoint);
bool is_line_set_as_breakpoint(int p_line) const;
void set_executing_line(int p_line);
@@ -613,6 +627,8 @@ public:
int get_indent_size();
void set_draw_tabs(bool p_draw);
bool is_drawing_tabs() const;
+ void set_draw_spaces(bool p_draw);
+ bool is_drawing_spaces() const;
void set_override_selected_font_color(bool p_override_selected_font_color);
bool is_overriding_selected_font_color() const;
@@ -660,6 +676,9 @@ public:
void set_show_line_length_guideline(bool p_show);
void set_line_length_guideline_column(int p_column);
+ void set_bookmark_gutter_enabled(bool p_draw);
+ bool is_bookmark_gutter_enabled() const;
+
void set_breakpoint_gutter_enabled(bool p_draw);
bool is_breakpoint_gutter_enabled() const;
@@ -716,7 +735,7 @@ public:
virtual void _update_cache() = 0;
virtual Map<int, TextEdit::HighlighterInfo> _get_line_syntax_highlighting(int p_line) = 0;
- virtual String get_name() = 0;
+ virtual String get_name() const = 0;
virtual List<String> get_supported_languages() = 0;
void set_text_editor(TextEdit *p_text_editor);
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 795b25cce0..b5f949aeb7 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -64,7 +64,7 @@ bool TextureButton::has_point(const Point2 &p_point) const {
Rect2 rect = Rect2();
Size2 mask_size = click_mask->get_size();
- if (_position_rect.no_area()) {
+ if (_position_rect.has_no_area()) {
rect.size = mask_size;
} else if (_tile) {
// if the stretch mode is tile we offset the point to keep it inside the mask size
diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp
index 2195de9694..423794d8ba 100644
--- a/scene/gui/texture_rect.cpp
+++ b/scene/gui/texture_rect.cpp
@@ -96,7 +96,7 @@ void TextureRect::_notification(int p_what) {
size.width *= hflip ? -1.0f : 1.0f;
size.height *= vflip ? -1.0f : 1.0f;
- if (region.no_area()) {
+ if (region.has_no_area()) {
draw_texture_rect(texture, Rect2(offset, size), tile);
} else {
draw_texture_rect_region(texture, Rect2(offset, size), region);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index f22fe5b6a5..049cae9dd9 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2266,7 +2266,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
next = _n;
} else {
- return;
+ break;
}
}
if (next == selected_item)
@@ -2304,7 +2304,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
prev = _n;
} else {
- return;
+ break;
}
}
if (prev == selected_item)
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0465ffe442..368dea7649 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -39,6 +39,10 @@
#include "scene/scene_string_names.h"
#include "viewport.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_settings.h"
+#endif
+
VARIANT_ENUM_CAST(Node::PauseMode);
int Node::orphan_node_count = 0;
@@ -945,6 +949,7 @@ void Node::set_name(const String &p_name) {
if (is_inside_tree()) {
emit_signal("renamed");
+ get_tree()->node_renamed(this);
get_tree()->tree_changed();
}
}
@@ -2637,10 +2642,16 @@ NodePath Node::get_import_path() const {
static void _add_nodes_to_options(const Node *p_base, const Node *p_node, List<String> *r_options) {
+#ifdef TOOLS_ENABLED
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
+#else
+ const String quote_style = "\"";
+#endif
+
if (p_node != p_base && !p_node->get_owner())
return;
String n = p_base->get_path_to(p_node);
- r_options->push_back("\"" + n + "\"");
+ r_options->push_back(quote_style + n + quote_style);
for (int i = 0; i < p_node->get_child_count(); i++) {
_add_nodes_to_options(p_base, p_node->get_child(i), r_options);
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 125e0a2882..65cda73a23 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -105,6 +105,11 @@ void SceneTree::node_removed(Node *p_node) {
call_skip.insert(p_node);
}
+void SceneTree::node_renamed(Node *p_node) {
+
+ emit_signal(node_renamed_name, p_node);
+}
+
SceneTree::Group *SceneTree::add_to_group(const StringName &p_group, Node *p_node) {
Map<StringName, Group>::Element *E = group_map.find(p_group);
@@ -369,8 +374,7 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group
}
void SceneTree::call_group(const StringName &p_group, const StringName &p_function, VARIANT_ARG_DECLARE) {
-
- call_group_flags(0, p_group, VARIANT_ARG_PASS);
+ call_group_flags(0, p_group, p_function, VARIANT_ARG_PASS);
}
void SceneTree::notify_group(const StringName &p_group, int p_notification) {
@@ -1896,6 +1900,7 @@ void SceneTree::_bind_methods() {
ADD_SIGNAL(MethodInfo("tree_changed"));
ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("node_removed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("node_renamed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("screen_resized"));
ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
@@ -1984,6 +1989,7 @@ SceneTree::SceneTree() {
tree_changed_name = "tree_changed";
node_added_name = "node_added";
node_removed_name = "node_removed";
+ node_renamed_name = "node_renamed";
ugc_locked = false;
call_lock = 0;
root_lock = 0;
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index e098b3d53c..0bcb724929 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -126,6 +126,7 @@ private:
StringName tree_changed_name;
StringName node_added_name;
StringName node_removed_name;
+ StringName node_renamed_name;
bool use_font_oversampling;
int64_t current_frame;
@@ -201,6 +202,7 @@ private:
void tree_changed();
void node_added(Node *p_node);
void node_removed(Node *p_node);
+ void node_renamed(Node *p_node);
Group *add_to_group(const StringName &p_group, Node *p_node);
void remove_from_group(const StringName &p_group, Node *p_node);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index ae2c571201..b5e5022e63 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2765,6 +2765,19 @@ Rect2 Viewport::get_attach_to_screen_rect() const {
return to_screen_rect;
}
+void Viewport::set_use_render_direct_to_screen(bool p_render_direct_to_screen) {
+
+ if (p_render_direct_to_screen == render_direct_to_screen)
+ return;
+
+ render_direct_to_screen = p_render_direct_to_screen;
+ VS::get_singleton()->viewport_set_render_direct_to_screen(viewport, p_render_direct_to_screen);
+}
+
+bool Viewport::is_using_render_direct_to_screen() const {
+ return render_direct_to_screen;
+}
+
void Viewport::set_physics_object_picking(bool p_enable) {
physics_object_picking = p_enable;
@@ -3030,6 +3043,8 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d);
ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d);
ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect);
+ ClassDB::bind_method(D_METHOD("set_use_render_direct_to_screen", "enable"), &Viewport::set_use_render_direct_to_screen);
+ ClassDB::bind_method(D_METHOD("is_using_render_direct_to_screen"), &Viewport::is_using_render_direct_to_screen);
ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position);
ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Viewport::warp_mouse);
@@ -3084,6 +3099,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_3d_linear"), "set_keep_3d_linear", "get_keep_3d_linear");
ADD_PROPERTY(PropertyInfo(Variant::INT, "usage", PROPERTY_HINT_ENUM, "2D,2D No-Sampling,3D,3D No-Effects"), "set_usage", "get_usage");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_direct_to_screen"), "set_use_render_direct_to_screen", "is_using_render_direct_to_screen");
ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
ADD_GROUP("Render Target", "render_target_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_v_flip"), "set_vflip", "get_vflip");
@@ -3166,6 +3182,8 @@ Viewport::Viewport() {
texture_rid = VisualServer::get_singleton()->viewport_get_texture(viewport);
texture_flags = 0;
+ render_direct_to_screen = false;
+
default_texture.instance();
default_texture->vp = const_cast<Viewport *>(this);
viewport_textures.insert(default_texture.ptr());
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index d67b4ac348..b7160d5139 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -182,6 +182,7 @@ private:
Size2 size;
Rect2 to_screen_rect;
+ bool render_direct_to_screen;
RID contact_2d_debug;
RID contact_3d_debug_multimesh;
@@ -481,6 +482,9 @@ public:
void set_attach_to_screen_rect(const Rect2 &p_rect);
Rect2 get_attach_to_screen_rect() const;
+ void set_use_render_direct_to_screen(bool p_render_direct_to_screen);
+ bool is_using_render_direct_to_screen() const;
+
Vector2 get_mouse_position() const;
void warp_mouse(const Vector2 &p_pos);
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 47f5b152f0..5440c88fa8 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -476,6 +476,7 @@ void register_scene_types() {
ClassDB::register_virtual_class<VisualShaderNode>();
ClassDB::register_class<VisualShaderNodeInput>();
ClassDB::register_virtual_class<VisualShaderNodeOutput>();
+ ClassDB::register_class<VisualShaderNodeGroupBase>();
ClassDB::register_class<VisualShaderNodeScalarConstant>();
ClassDB::register_class<VisualShaderNodeBooleanConstant>();
ClassDB::register_class<VisualShaderNodeColorConstant>();
@@ -523,6 +524,8 @@ void register_scene_types() {
ClassDB::register_class<VisualShaderNodeCubeMapUniform>();
ClassDB::register_class<VisualShaderNodeIf>();
ClassDB::register_class<VisualShaderNodeSwitch>();
+ ClassDB::register_class<VisualShaderNodeFresnel>();
+ ClassDB::register_class<VisualShaderNodeExpression>();
ClassDB::register_class<ShaderMaterial>();
ClassDB::register_virtual_class<CanvasItem>();
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 9c79b2ba3b..ebfcd51247 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -2559,17 +2559,6 @@ bool Animation::has_loop() const {
return loop;
}
-void Animation::track_move_up(int p_track) {
-
- if (p_track >= 0 && p_track < (tracks.size() - 1)) {
-
- SWAP(tracks.write[p_track], tracks.write[p_track + 1]);
- }
-
- emit_changed();
- emit_signal(SceneStringNames::get_singleton()->tracks_changed);
-}
-
void Animation::track_set_imported(int p_track, bool p_imported) {
ERR_FAIL_INDEX(p_track, tracks.size());
@@ -2595,12 +2584,40 @@ bool Animation::track_is_enabled(int p_track) const {
return tracks[p_track]->enabled;
}
+void Animation::track_move_up(int p_track) {
+
+ if (p_track >= 0 && p_track < (tracks.size() - 1)) {
+
+ SWAP(tracks.write[p_track], tracks.write[p_track + 1]);
+ }
+
+ emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
+}
+
void Animation::track_move_down(int p_track) {
if (p_track > 0 && p_track < tracks.size()) {
SWAP(tracks.write[p_track], tracks.write[p_track - 1]);
}
+
+ emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
+}
+
+void Animation::track_move_to(int p_track, int p_to_index) {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ ERR_FAIL_INDEX(p_to_index, tracks.size() + 1);
+ if (p_track == p_to_index || p_track == p_to_index - 1)
+ return;
+
+ Track *track = tracks.get(p_track);
+ tracks.remove(p_track);
+ // Take into account that the position of the tracks that come after the one removed will change.
+ tracks.insert(p_to_index > p_track ? p_to_index - 1 : p_to_index, track);
+
emit_changed();
emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
@@ -2612,6 +2629,7 @@ void Animation::track_swap(int p_track, int p_with_track) {
if (p_track == p_with_track)
return;
SWAP(tracks.write[p_track], tracks.write[p_with_track]);
+
emit_changed();
emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
@@ -2656,6 +2674,7 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("track_move_up", "idx"), &Animation::track_move_up);
ClassDB::bind_method(D_METHOD("track_move_down", "idx"), &Animation::track_move_down);
+ ClassDB::bind_method(D_METHOD("track_move_to", "idx", "to_idx"), &Animation::track_move_to);
ClassDB::bind_method(D_METHOD("track_swap", "idx", "with_idx"), &Animation::track_swap);
ClassDB::bind_method(D_METHOD("track_set_imported", "idx", "imported"), &Animation::track_set_imported);
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index b66ae184e9..36ebaa25d5 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -93,7 +93,6 @@ private:
template <class T>
struct TKey : public Key {
- float time;
T value;
};
@@ -294,6 +293,7 @@ public:
void track_move_up(int p_track);
void track_move_down(int p_track);
+ void track_move_to(int p_track, int p_to_index);
void track_swap(int p_track, int p_with_track);
void track_set_imported(int p_track, bool p_imported);
diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp
index a9d85be0dc..e4a64a1de1 100644
--- a/scene/resources/bit_map.cpp
+++ b/scene/resources/bit_map.cpp
@@ -595,16 +595,16 @@ Array BitMap::_opaque_to_polygons_bind(const Rect2 &p_rect, float p_epsilon) con
return result_array;
}
-void BitMap::resize(const Size2& p_new_size) {
+void BitMap::resize(const Size2 &p_new_size) {
Ref<BitMap> new_bitmap;
new_bitmap.instance();
new_bitmap->create(p_new_size);
- int lw = MIN(width,p_new_size.width);
- int lh = MIN(height,p_new_size.height);
- for(int x=0;x<lw;x++) {
- for(int y=0;y<lh;y++) {
- new_bitmap->set_bit(Vector2(x,y),get_bit(Vector2(x,y)));
+ int lw = MIN(width, p_new_size.width);
+ int lh = MIN(height, p_new_size.height);
+ for (int x = 0; x < lw; x++) {
+ for (int y = 0; y < lh; y++) {
+ new_bitmap->set_bit(Vector2(x, y), get_bit(Vector2(x, y)));
}
}
@@ -617,11 +617,11 @@ Ref<Image> BitMap::convert_to_image() const {
Ref<Image> image;
image.instance();
- image->create(width,height,false,Image::FORMAT_L8);
+ image->create(width, height, false, Image::FORMAT_L8);
image->lock();
- for(int i=0;i<width;i++) {
- for(int j=0;j<height;j++) {
- image->set_pixel( i,j,get_bit(Point2(i,j)) ? Color(1,1,1) : Color(0,0,0));
+ for (int i = 0; i < width; i++) {
+ for (int j = 0; j < height; j++) {
+ image->set_pixel(i, j, get_bit(Point2(i, j)) ? Color(1, 1, 1) : Color(0, 0, 0));
}
}
@@ -629,30 +629,28 @@ Ref<Image> BitMap::convert_to_image() const {
return image;
}
-void BitMap::blit(const Vector2& p_pos,const Ref<BitMap>& p_bitmap) {
+void BitMap::blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap) {
int x = p_pos.x;
int y = p_pos.y;
int w = p_bitmap->get_size().width;
int h = p_bitmap->get_size().height;
- for(int i=0;i<w;i++) {
- for (int j=0;j<h;j++) {
- int px = x+i;
- int py = y+j;
- if (px<0 || px>=width)
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++) {
+ int px = x + i;
+ int py = y + j;
+ if (px < 0 || px >= width)
continue;
- if (py<0 || py>=height)
+ if (py < 0 || py >= height)
continue;
- if (p_bitmap->get_bit(Vector2(i,j))) {
- set_bit(Vector2(x,y),true);
+ if (p_bitmap->get_bit(Vector2(i, j))) {
+ set_bit(Vector2(x, y), true);
}
}
}
-
}
-
void BitMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create);
diff --git a/scene/resources/bit_map.h b/scene/resources/bit_map.h
index 6e1171b8a9..daf24affb1 100644
--- a/scene/resources/bit_map.h
+++ b/scene/resources/bit_map.h
@@ -64,11 +64,11 @@ public:
int get_true_bit_count() const;
Size2 get_size() const;
- void resize(const Size2& p_new_size);
+ void resize(const Size2 &p_new_size);
void grow_mask(int p_pixels, const Rect2 &p_rect);
- void blit(const Vector2& p_pos,const Ref<BitMap>& p_bitmap);
+ void blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap);
Ref<Image> convert_to_image() const;
Vector<Vector<Vector2> > clip_opaque_to_polygons(const Rect2 &p_rect, float p_epsilon = 2.0) const;
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index ece8ad4bb0..950518aa6e 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -782,7 +782,8 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const {
if (idx >= bpc - 1) {
return r[bpc - 1];
} else if (idx == bpc - 2) {
- frac /= Math::fmod(baked_max_ofs, bake_interval);
+ if (frac > 0)
+ frac /= Math::fmod(baked_max_ofs, bake_interval);
} else {
frac /= bake_interval;
}
@@ -1352,7 +1353,8 @@ Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const {
if (idx >= bpc - 1) {
return r[bpc - 1];
} else if (idx == bpc - 2) {
- frac /= Math::fmod(baked_max_ofs, bake_interval);
+ if (frac > 0)
+ frac /= Math::fmod(baked_max_ofs, bake_interval);
} else {
frac /= bake_interval;
}
@@ -1396,7 +1398,8 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const {
if (idx >= bpc - 1) {
return r[bpc - 1];
} else if (idx == bpc - 2) {
- frac /= Math::fmod(baked_max_ofs, bake_interval);
+ if (frac > 0)
+ frac /= Math::fmod(baked_max_ofs, bake_interval);
} else {
frac /= bake_interval;
}
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 79d93113b3..bdb6c78782 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -359,7 +359,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("focus", "CheckButton", focus);
theme->set_icon("on", "CheckButton", make_icon(toggle_on_png));
+ theme->set_icon("on_disabled", "CheckButton", make_icon(toggle_on_disabled_png));
theme->set_icon("off", "CheckButton", make_icon(toggle_off_png));
+ theme->set_icon("off_disabled", "CheckButton", make_icon(toggle_off_disabled_png));
theme->set_font("font", "CheckButton", default_font);
@@ -423,6 +425,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3, 0, 0, 0, 0));
theme->set_icon("tab", "TextEdit", make_icon(tab_png));
+ theme->set_icon("space", "TextEdit", make_icon(space_png));
theme->set_icon("folded", "TextEdit", make_icon(arrow_right_png));
theme->set_icon("fold", "TextEdit", make_icon(arrow_down_png));
@@ -438,6 +441,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_color_selected", "TextEdit", Color(0, 0, 0));
theme->set_color("selection_color", "TextEdit", font_color_selection);
theme->set_color("mark_color", "TextEdit", Color(1.0, 0.4, 0.4, 0.4));
+ theme->set_color("bookmark_color", "TextEdit", Color(0.08, 0.49, 0.98));
theme->set_color("breakpoint_color", "TextEdit", Color(0.8, 0.8, 0.4, 0.2));
theme->set_color("executing_line_color", "TextEdit", Color(0.2, 0.8, 0.2, 0.4));
theme->set_color("code_folding_color", "TextEdit", Color(0.8, 0.8, 0.8, 0.8));
@@ -833,14 +837,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("autohide", "HSplitContainer", 1 * scale);
theme->set_constant("autohide", "VSplitContainer", 1 * scale);
- // ReferenceRect
-
- Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8);
- ttnc->set_draw_center(false);
-
- theme->set_stylebox("panelnc", "Panel", ttnc);
- theme->set_stylebox("panelf", "Panel", tc_sb);
-
Ref<StyleBoxTexture> sb_pc = make_stylebox(tab_container_bg_png, 4, 4, 4, 4, 7, 7, 7, 7);
theme->set_stylebox("panel", "PanelContainer", sb_pc);
diff --git a/scene/resources/default_theme/space.png b/scene/resources/default_theme/space.png
new file mode 100644
index 0000000000..7e458a6c45
--- /dev/null
+++ b/scene/resources/default_theme/space.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index 2b251e5f81..87b8afd6a3 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -358,6 +358,10 @@ static const unsigned char selection_oof_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x4, 0x3, 0x0, 0x0, 0x0, 0xed, 0xdd, 0xe2, 0x52, 0x0, 0x0, 0x0, 0x2d, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2c, 0x2, 0xfd, 0xfb, 0xff, 0xfd, 0xfb, 0xff, 0xfd, 0xfb, 0xff, 0xfd, 0xfb, 0xff, 0xaf, 0xdf, 0x90, 0xa5, 0x0, 0x0, 0x0, 0xf, 0x74, 0x52, 0x4e, 0x53, 0xa, 0x1a, 0x26, 0x29, 0x2a, 0x48, 0x65, 0x6d, 0x6e, 0x66, 0x3, 0x20, 0x25, 0x16, 0xc, 0x1f, 0x74, 0xbf, 0x74, 0x0, 0x0, 0x0, 0x37, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x64, 0x54, 0x52, 0x64, 0x60, 0x60, 0x78, 0x77, 0x8f, 0x51, 0x34, 0x8, 0xcc, 0xb8, 0xcd, 0xa8, 0xd9, 0x4, 0x66, 0xdc, 0x60, 0x74, 0x2f, 0x33, 0x4, 0x32, 0xde, 0xce, 0x64, 0xf4, 0x68, 0x53, 0x0, 0x32, 0xfe, 0xcd, 0xa0, 0x90, 0x1, 0x37, 0x10, 0x6e, 0x5, 0xdc, 0x52, 0xb8, 0x33, 0x0, 0xcc, 0x7, 0x26, 0xff, 0x1f, 0x38, 0x23, 0x97, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
+static const unsigned char space_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x6, 0x0, 0x0, 0x0, 0xc4, 0xf, 0xbe, 0x8b, 0x0, 0x0, 0x0, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0x2f, 0x49, 0x44, 0x41, 0x54, 0x18, 0x95, 0x63, 0x60, 0xa0, 0x2a, 0xf8, 0xff, 0xff, 0xbf, 0xe0, 0xff, 0xff, 0xff, 0x5, 0x91, 0xc5, 0x58, 0x90, 0x24, 0x85, 0x18, 0x18, 0x18, 0x14, 0xa0, 0x6c, 0x6, 0x46, 0x46, 0xc6, 0xf7, 0xc, 0xc, 0xc, 0xc, 0x4c, 0x14, 0x5b, 0x41, 0x39, 0x0, 0x0, 0x71, 0x1a, 0x13, 0x5d, 0x87, 0xfe, 0x9e, 0x7d, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
static const unsigned char spinbox_updown_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0xb5, 0xfa, 0x37, 0xea, 0x0, 0x0, 0x0, 0x59, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x20, 0x11, 0xdc, 0x4f, 0x7f, 0x98, 0x86, 0x47, 0xfa, 0x81, 0xe5, 0x83, 0x1f, 0xf, 0x7e, 0x3d, 0xb2, 0xc5, 0xa5, 0x5b, 0xe2, 0xc1, 0x93, 0x7, 0xff, 0x81, 0xf0, 0xf9, 0x63, 0x69, 0x2c, 0xd2, 0x67, 0x58, 0xef, 0x1f, 0x2, 0x4a, 0x42, 0xe0, 0xf1, 0xdb, 0xec, 0x98, 0xfa, 0x67, 0x2, 0x25, 0xe0, 0xf0, 0xe1, 0x2, 0x86, 0x41, 0x7, 0x30, 0x1d, 0x39, 0x3, 0xbf, 0x37, 0x8f, 0xdd, 0x66, 0x27, 0x29, 0xa0, 0x10, 0x4a, 0x2c, 0xa0, 0x41, 0x8d, 0x1b, 0x3c, 0x4c, 0x3, 0x46, 0x16, 0x69, 0x0, 0x0, 0x87, 0x2a, 0x58, 0xb5, 0x18, 0xe9, 0x80, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
@@ -402,10 +406,18 @@ static const unsigned char toggle_off_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x8, 0x3, 0x0, 0x0, 0x0, 0x95, 0x43, 0x8e, 0xb6, 0x0, 0x0, 0x1, 0x7a, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x14, 0x17, 0x20, 0x20, 0x25, 0x24, 0x24, 0x28, 0x24, 0x24, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x13, 0x22, 0x22, 0x27, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19, 0x19, 0x1c, 0x1a, 0x1a, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11, 0x14, 0x12, 0x12, 0x14, 0x23, 0x23, 0x27, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x15, 0x15, 0x18, 0x20, 0x20, 0x25, 0x20, 0x20, 0x24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x24, 0x28, 0x0, 0x0, 0x0, 0x24, 0x24, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x24, 0x27, 0x15, 0x15, 0x18, 0x23, 0x23, 0x28, 0x12, 0x12, 0x14, 0x0, 0x0, 0x0, 0x1a, 0x1a, 0x1e, 0x0, 0x0, 0x0, 0x11, 0x11, 0x13, 0x22, 0x22, 0x26, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x24, 0x29, 0x25, 0x25, 0x2a, 0x24, 0x24, 0x28, 0x25, 0x25, 0x28, 0x25, 0x25, 0x29, 0x25, 0x25, 0x27, 0x2d, 0x26, 0x2c, 0x4d, 0x2b, 0x37, 0x63, 0x2f, 0x3f, 0x6e, 0x31, 0x43, 0x71, 0x32, 0x44, 0x6c, 0x31, 0x42, 0x51, 0x2c, 0x39, 0x47, 0x2a, 0x35, 0x66, 0x30, 0x40, 0x4d, 0x2b, 0x38, 0x32, 0x26, 0x2e, 0x26, 0x25, 0x2a, 0x2e, 0x25, 0x2c, 0x3c, 0x28, 0x31, 0x52, 0x2c, 0x39, 0x68, 0x30, 0x40, 0x27, 0x25, 0x2a, 0x50, 0x2c, 0x38, 0x5f, 0x2e, 0x3d, 0x35, 0x27, 0x2f, 0x38, 0x27, 0x30, 0x5e, 0x2e, 0x3d, 0x43, 0x2a, 0x34, 0x5f, 0x2f, 0x3e, 0x2f, 0x25, 0x2c, 0x44, 0x2a, 0x34, 0x2b, 0x26, 0x2c, 0x64, 0x2f, 0x3f, 0x36, 0x27, 0x30, 0x37, 0x27, 0x30, 0x66, 0x2f, 0x40, 0x2c, 0x26, 0x2c, 0x46, 0x2a, 0x35, 0x53, 0x2c, 0x39, 0x40, 0x40, 0x44, 0xad, 0xad, 0xaf, 0xff, 0xff, 0xff, 0xf2, 0xf2, 0xf2, 0x77, 0x77, 0x7a, 0x5b, 0x5b, 0x5f, 0x32, 0x32, 0x37, 0x5d, 0x2e, 0x3d, 0x3e, 0x29, 0x32, 0xc9, 0xc9, 0xca, 0xbb, 0xbb, 0xbd, 0x69, 0x69, 0x6c, 0x69, 0x30, 0x41, 0x2f, 0x26, 0x2d, 0x84, 0x84, 0x87, 0xd6, 0xd6, 0xd7, 0x92, 0x92, 0x94, 0xa0, 0xa0, 0xa2, 0x4e, 0x4e, 0x52, 0x48, 0x2b, 0x36, 0x2c, 0x26, 0x2b, 0x97, 0xb0, 0x86, 0xb4, 0x0, 0x0, 0x0, 0x41, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x1, 0x2, 0x3, 0x4, 0x9, 0xe, 0x13, 0x16, 0x18, 0x19, 0xa, 0x26, 0x36, 0x44, 0x4d, 0x52, 0x54, 0x55, 0x6, 0x12, 0x27, 0x43, 0x98, 0xe5, 0xfa, 0xfe, 0x8, 0x17, 0x35, 0x86, 0xf3, 0x7, 0x3a, 0xb4, 0xb9, 0xb, 0x28, 0x8a, 0x8b, 0xf6, 0x45, 0x5, 0x9b, 0xe6, 0xe6, 0x37, 0xf, 0xfb, 0x4c, 0xfe, 0x4e, 0x4f, 0x50, 0xfb, 0x9c, 0xf6, 0x8c, 0x3b, 0xbb, 0x3c, 0x87, 0xf3, 0x53, 0x14, 0xe5, 0x7c, 0xf3, 0x66, 0x0, 0x0, 0x2, 0x29, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xdd, 0x95, 0x3, 0x93, 0x24, 0x4b, 0x14, 0x85, 0x5f, 0xb9, 0xaa, 0x6d, 0x8e, 0x6d, 0xdb, 0x73, 0x2b, 0xb3, 0xe7, 0xad, 0x6d, 0xab, 0xdd, 0x63, 0xe3, 0xbf, 0x6f, 0x67, 0x65, 0xbb, 0xb4, 0xbb, 0x81, 0xc5, 0x97, 0x11, 0x27, 0x78, 0x4f, 0xea, 0xe2, 0xbf, 0x3f, 0x9, 0x86, 0xe5, 0x38, 0xde, 0x16, 0x8e, 0x63, 0x19, 0xc3, 0x70, 0x96, 0x17, 0x44, 0x49, 0x56, 0x1c, 0x36, 0x28, 0xb2, 0x24, 0xa, 0x3c, 0xab, 0xdf, 0x9d, 0x77, 0xca, 0x2e, 0xb7, 0xc7, 0xeb, 0xf3, 0x7, 0x2c, 0xf1, 0xfb, 0xbc, 0x1e, 0xb7, 0x4b, 0x76, 0xf2, 0x2d, 0xa7, 0x60, 0x83, 0xa1, 0x70, 0x24, 0x1a, 0x8b, 0x27, 0xb6, 0xc1, 0x86, 0xed, 0x44, 0x3c, 0x16, 0x8d, 0x84, 0x43, 0x41, 0xb6, 0x29, 0x3e, 0xd9, 0xd6, 0xde, 0xd1, 0xa9, 0x22, 0x84, 0x31, 0x6, 0xd, 0x4c, 0x40, 0x38, 0x85, 0xd, 0x4d, 0x3a, 0x3b, 0xda, 0xdb, 0x92, 0xd, 0xe, 0x4c, 0x97, 0xd2, 0xdd, 0xa3, 0xa2, 0x9d, 0xff, 0x6f, 0xdd, 0xbe, 0x43, 0xb9, 0x7b, 0x6f, 0x47, 0x73, 0x49, 0x21, 0x93, 0x73, 0xf4, 0x74, 0x2b, 0x5d, 0x4c, 0xfd, 0xfe, 0x92, 0xbb, 0x57, 0xc5, 0xf7, 0x1f, 0x3c, 0x7c, 0xf4, 0x18, 0x8, 0x8f, 0x9f, 0x3c, 0x7d, 0xf6, 0xfc, 0xfe, 0xb, 0xed, 0x24, 0x66, 0x37, 0xe9, 0x75, 0x4b, 0xb5, 0x77, 0x60, 0xfb, 0xfa, 0x7, 0x54, 0xfc, 0xf2, 0xd5, 0x6b, 0x68, 0xe0, 0xcd, 0xdb, 0x97, 0x2f, 0x2c, 0xdf, 0x62, 0xb0, 0xbf, 0xaf, 0x7a, 0x9, 0xbe, 0xcd, 0x33, 0x84, 0xde, 0xbd, 0x7f, 0x2, 0x4d, 0x7c, 0x78, 0xff, 0xf1, 0x31, 0x58, 0x30, 0x34, 0xdc, 0x36, 0x42, 0x8f, 0xc0, 0x8, 0xae, 0x51, 0xf4, 0xe9, 0xf3, 0x17, 0x68, 0xe1, 0xeb, 0xb7, 0x34, 0x58, 0x31, 0xea, 0x12, 0xa8, 0x1, 0x2b, 0xba, 0xc7, 0x50, 0xe6, 0x19, 0xe8, 0xc8, 0x66, 0x80, 0x92, 0xcb, 0x17, 0x8a, 0x25, 0xd8, 0x2d, 0x94, 0xd1, 0x64, 0xf, 0x8, 0xe3, 0x13, 0x93, 0xf4, 0xe, 0x9c, 0xe4, 0x89, 0xe3, 0xfd, 0x3, 0xd0, 0x71, 0xb0, 0xf, 0x94, 0xc3, 0xa3, 0xdc, 0x71, 0x21, 0xb7, 0x4b, 0x2, 0x35, 0xa1, 0x4c, 0xd, 0x4b, 0x1c, 0x35, 0x90, 0xa7, 0x67, 0xf0, 0xc9, 0x29, 0xe8, 0x38, 0x3d, 0xa9, 0x1c, 0x80, 0x4, 0x1d, 0x9d, 0xed, 0x9e, 0x13, 0x3, 0x22, 0x94, 0xed, 0x59, 0x99, 0xa7, 0x6, 0x6d, 0x73, 0x2a, 0xbe, 0x6d, 0xf0, 0x60, 0x8f, 0x6f, 0x13, 0x25, 0x41, 0x65, 0xb9, 0xc8, 0xef, 0x1e, 0x1e, 0x1e, 0xee, 0x69, 0x2, 0x94, 0xf9, 0xb6, 0x8a, 0x81, 0xec, 0x55, 0x2d, 0x4f, 0xb0, 0x47, 0x4e, 0x90, 0xbf, 0xdc, 0x25, 0x91, 0x44, 0x74, 0x27, 0x90, 0x3c, 0xb, 0xc8, 0xf2, 0xd, 0xce, 0xcf, 0x60, 0xaf, 0x58, 0xaa, 0x18, 0xe8, 0xdf, 0x80, 0x15, 0x27, 0x6c, 0x7e, 0x61, 0xb7, 0x78, 0x5e, 0xcc, 0x43, 0xab, 0x1, 0xfd, 0x5, 0x9a, 0x7, 0x8b, 0x36, 0x79, 0xb0, 0x77, 0x76, 0x5, 0x90, 0x2b, 0xed, 0x55, 0x84, 0xb2, 0x18, 0x16, 0x98, 0x5a, 0x26, 0x2e, 0xe1, 0x5f, 0xce, 0x44, 0x5a, 0xb, 0x83, 0x3f, 0x5f, 0xb, 0xcb, 0xb4, 0x16, 0xcc, 0xab, 0xf1, 0x9a, 0xc6, 0xdb, 0x57, 0x23, 0xed, 0x7, 0x2b, 0xab, 0x2a, 0xba, 0x69, 0xed, 0x7, 0xe6, 0x6c, 0xaf, 0xae, 0xd5, 0xfa, 0x1, 0xed, 0x48, 0x8a, 0x7b, 0x7d, 0x3, 0xa5, 0x10, 0x6d, 0x48, 0xb8, 0x2, 0x2a, 0x2f, 0x30, 0xa2, 0x73, 0xdd, 0xad, 0x24, 0x9b, 0x7b, 0x5a, 0x97, 0x14, 0xf6, 0x44, 0x63, 0x53, 0xdb, 0x60, 0xcb, 0xf6, 0x54, 0x2c, 0xea, 0x9, 0x4b, 0x5d, 0x6c, 0x6b, 0x57, 0xee, 0x93, 0x5d, 0x13, 0xc3, 0xb3, 0x9b, 0x1, 0x1b, 0x36, 0x67, 0x87, 0x27, 0x5c, 0x72, 0x1f, 0xcf, 0xe8, 0xa7, 0xca, 0x88, 0x30, 0xb9, 0xd5, 0x66, 0x3f, 0x17, 0xda, 0xb6, 0x26, 0x85, 0x11, 0x96, 0x31, 0x99, 0x4c, 0xfc, 0xf, 0x40, 0x27, 0xd3, 0xbf, 0xc4, 0x77, 0x82, 0xde, 0x40, 0xde, 0x4b, 0x3f, 0xe2, 0x98, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
+static const unsigned char toggle_off_disabled_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x3c, 0x0, 0x0, 0x0, 0x20, 0x8, 0x6, 0x0, 0x0, 0x0, 0x4e, 0xe8, 0x1b, 0x92, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x12, 0x0, 0x0, 0xb, 0x12, 0x1, 0xd2, 0xdd, 0x7e, 0xfc, 0x0, 0x0, 0x6, 0x3e, 0x49, 0x44, 0x41, 0x54, 0x58, 0x47, 0xed, 0x59, 0x4b, 0x6f, 0x1b, 0x55, 0x14, 0x3e, 0xb6, 0xc7, 0x8e, 0xed, 0xf1, 0x2b, 0x7e, 0x84, 0xb8, 0x49, 0x8a, 0x48, 0x36, 0x55, 0x37, 0x48, 0x5d, 0x64, 0xc1, 0x3a, 0x42, 0x82, 0x14, 0x89, 0x56, 0x14, 0x16, 0x48, 0xfc, 0x1, 0xca, 0x1f, 0x40, 0x20, 0x81, 0x90, 0xf8, 0x1, 0xd0, 0x25, 0x8b, 0x8a, 0x25, 0xa0, 0x82, 0x8a, 0x10, 0x12, 0x42, 0x8, 0x29, 0x5d, 0x15, 0xa9, 0x12, 0x8b, 0x4a, 0x20, 0x51, 0x50, 0x1b, 0xcb, 0x79, 0xf8, 0xed, 0x8c, 0xdf, 0xe3, 0x31, 0xe7, 0xbb, 0x99, 0xeb, 0x4c, 0x26, 0x33, 0xb6, 0x13, 0xbb, 0xb4, 0x42, 0xbd, 0xd2, 0xc9, 0x24, 0x77, 0xee, 0x39, 0x73, 0xbf, 0x7b, 0x1e, 0xf7, 0x9c, 0x13, 0xa2, 0x67, 0xe3, 0xd9, 0x9, 0xfc, 0xaf, 0x4e, 0xc0, 0x33, 0x21, 0x1a, 0xac, 0x93, 0x4, 0x96, 0x49, 0xf9, 0x26, 0x14, 0x7f, 0xe6, 0x65, 0x3, 0x93, 0x13, 0x4f, 0x49, 0x23, 0x85, 0x8d, 0xdb, 0xb8, 0x97, 0xb9, 0x41, 0x7e, 0xb, 0xf9, 0xcc, 0xb9, 0x71, 0xbc, 0x67, 0x46, 0x31, 0x21, 0x23, 0x0, 0x1a, 0x4c, 0x7d, 0xa6, 0x9e, 0x85, 0x30, 0x7, 0x72, 0x1c, 0x6e, 0x9b, 0xc6, 0x3c, 0x80, 0x5, 0x98, 0x22, 0x4c, 0x9, 0x93, 0x62, 0xfc, 0xc, 0x99, 0xe0, 0x71, 0x10, 0x4f, 0xa, 0xb4, 0x4, 0xb, 0xa0, 0x2d, 0xa6, 0x3a, 0x53, 0xd5, 0x24, 0x8d, 0x9f, 0x5d, 0xf3, 0x20, 0xa4, 0x5, 0xc, 0xc1, 0x3b, 0x6d, 0x18, 0x40, 0x14, 0x13, 0x68, 0x86, 0x9f, 0xcb, 0xe9, 0xf4, 0x73, 0xd7, 0x22, 0x91, 0xd8, 0x6b, 0x8a, 0xe2, 0xe3, 0xbf, 0x3d, 0x78, 0xe7, 0xe1, 0x31, 0xa1, 0x22, 0x1e, 0xcf, 0xb2, 0xc1, 0x40, 0x60, 0xe1, 0x1f, 0x3, 0x5d, 0xd7, 0xfb, 0x5, 0x4d, 0xab, 0x7f, 0x5f, 0x2c, 0xee, 0x7d, 0xcd, 0x73, 0x39, 0xa6, 0x2, 0x13, 0x80, 0xeb, 0x76, 0x6d, 0xdb, 0x77, 0xd, 0xb0, 0xd0, 0x6a, 0x9c, 0xe9, 0x7c, 0x22, 0x91, 0xba, 0x92, 0x4c, 0xa6, 0xdf, 0xf3, 0x7a, 0x3d, 0x91, 0x23, 0x7c, 0x56, 0x16, 0x37, 0xd0, 0x27, 0xe, 0xf6, 0x70, 0x6f, 0xc2, 0x20, 0x60, 0x6d, 0xb3, 0x37, 0xe, 0x1c, 0x80, 0x61, 0x18, 0x5a, 0xb9, 0x5c, 0xfc, 0xbc, 0x5a, 0x2d, 0x7d, 0xcb, 0x1f, 0x79, 0xc4, 0x54, 0x33, 0xb5, 0x3d, 0x34, 0x71, 0xfb, 0xee, 0x1, 0x76, 0x9e, 0x69, 0x35, 0x9b, 0x5d, 0x7e, 0x5f, 0x55, 0x23, 0x9b, 0x0, 0xea, 0xf7, 0x7b, 0x29, 0x99, 0x4c, 0x52, 0x34, 0x1a, 0xa5, 0xb9, 0xb9, 0x39, 0xf2, 0x7a, 0xb1, 0x61, 0xe7, 0xc1, 0xc7, 0x4d, 0xb5, 0x5a, 0x8d, 0xa, 0x85, 0x2, 0xf5, 0x60, 0x70, 0xc3, 0x21, 0xf, 0x1, 0xdf, 0xc6, 0x67, 0xdd, 0x65, 0x4c, 0x63, 0x13, 0x0, 0xde, 0x68, 0x1c, 0xfc, 0xb0, 0xb3, 0x93, 0xfb, 0x94, 0xe5, 0xfc, 0xcd, 0x54, 0x31, 0x41, 0x8b, 0xd, 0x48, 0xc0, 0xd2, 0x67, 0xa1, 0xd9, 0xb5, 0x73, 0xe7, 0x56, 0x3e, 0x9, 0x87, 0xd5, 0x97, 0x61, 0xb6, 0xe9, 0x74, 0x42, 0x80, 0x5, 0x88, 0x6a, 0xb5, 0x4a, 0xdd, 0x8e, 0x21, 0x74, 0x65, 0x1f, 0x10, 0xa0, 0x70, 0x68, 0xb, 0x6, 0x83, 0xe2, 0x60, 0x40, 0xa5, 0x52, 0x89, 0xca, 0xc5, 0x9a, 0x43, 0x4, 0x91, 0xda, 0x9e, 0x6, 0x9a, 0x3b, 0x2f, 0x40, 0x37, 0x9b, 0xda, 0x4f, 0xf9, 0xfc, 0xf6, 0x87, 0xbc, 0xea, 0x81, 0xa9, 0x69, 0x4, 0xb7, 0x1, 0x2, 0x13, 0x6, 0x8e, 0x3b, 0xc8, 0x94, 0x9d, 0x9f, 0x4f, 0xbf, 0x1d, 0x8f, 0x27, 0xde, 0x1, 0xd8, 0x6c, 0x36, 0x43, 0xaa, 0xaa, 0x52, 0x3e, 0x9f, 0x67, 0xb0, 0xd, 0xea, 0xf7, 0x9d, 0xa0, 0x1e, 0x7d, 0xd8, 0x60, 0xe5, 0x75, 0xbb, 0x3a, 0x1d, 0x1c, 0x34, 0xa9, 0xdd, 0x6e, 0x88, 0x83, 0xa, 0x86, 0x2, 0xd4, 0xd4, 0x9a, 0xb6, 0x43, 0x7a, 0xbc, 0xfe, 0x8f, 0xbd, 0xfb, 0xfd, 0x81, 0x35, 0x0, 0x6d, 0xb5, 0x9a, 0x7f, 0xf2, 0xb3, 0xc1, 0x4, 0x7f, 0x1e, 0x48, 0xbb, 0xc2, 0x13, 0xd1, 0x78, 0x39, 0x99, 0x4c, 0x5d, 0x87, 0x19, 0x27, 0x93, 0x31, 0xa, 0x85, 0x42, 0x94, 0xcb, 0xe5, 0xa8, 0xd5, 0xc2, 0xda, 0xd3, 0x8d, 0x46, 0xa3, 0x2b, 0x78, 0x21, 0x23, 0x91, 0x8c, 0xfe, 0xe7, 0xe1, 0x1c, 0xa0, 0xe7, 0xe7, 0x53, 0xef, 0xf2, 0xae, 0x57, 0x4c, 0x6c, 0x50, 0xae, 0x47, 0x46, 0xf, 0xdc, 0xb3, 0xf1, 0x4c, 0x66, 0xf1, 0x2d, 0xe, 0x50, 0xa1, 0x0, 0x7, 0xe2, 0x54, 0x2a, 0x45, 0x3b, 0x3b, 0x3b, 0x36, 0x3f, 0x3c, 0x1d, 0x68, 0xf8, 0xf0, 0xee, 0xee, 0xae, 0x90, 0xe5, 0x53, 0x46, 0x5b, 0xc7, 0xe9, 0x24, 0x4f, 0xb6, 0xda, 0xeb, 0xf5, 0x85, 0x18, 0xd3, 0x9b, 0xc0, 0x6, 0x8f, 0x3, 0x97, 0xb8, 0x62, 0x98, 0x0, 0x38, 0xa1, 0xaa, 0xd1, 0x4d, 0x4c, 0x46, 0x93, 0x11, 0x76, 0xfc, 0xc6, 0x99, 0x34, 0x6b, 0xdf, 0x4a, 0xb3, 0xd9, 0x63, 0x7f, 0x6a, 0x52, 0x3c, 0x1e, 0x67, 0x9f, 0xc6, 0x75, 0xe9, 0x3c, 0x7a, 0xbd, 0x36, 0xad, 0xaf, 0xaf, 0xd3, 0xc5, 0x8b, 0x17, 0xa8, 0xd3, 0xe9, 0xd0, 0xd6, 0xd6, 0x1d, 0xda, 0xdb, 0x2b, 0xb1, 0x85, 0x4, 0xe8, 0xea, 0xd5, 0xd7, 0x8f, 0x31, 0xdd, 0xba, 0xf5, 0xdd, 0x89, 0xb9, 0xdb, 0xb7, 0x7f, 0x64, 0x57, 0x3a, 0x38, 0x21, 0x1c, 0x81, 0x97, 0xe3, 0xe7, 0x17, 0xfc, 0x62, 0x8f, 0xa9, 0x63, 0x5, 0x1c, 0xe3, 0x7b, 0x36, 0xd, 0xfc, 0xb1, 0x58, 0x8c, 0xca, 0xe5, 0xf2, 0x64, 0xc7, 0x38, 0xc1, 0x2a, 0x4d, 0xd3, 0x84, 0x3f, 0x8f, 0x2, 0xbc, 0xb1, 0xb1, 0x21, 0x80, 0xde, 0xbc, 0xf9, 0x25, 0x7, 0xca, 0x34, 0x5d, 0xbe, 0xfc, 0xaa, 0xf8, 0x1d, 0x80, 0x31, 0xac, 0x80, 0x9c, 0xe6, 0xdc, 0xb6, 0xa1, 0x28, 0xa, 0x72, 0x9, 0x24, 0x4c, 0x2, 0xab, 0xf4, 0x61, 0xd8, 0x37, 0x82, 0x96, 0x50, 0x7b, 0x20, 0xc0, 0x81, 0x86, 0xb5, 0x32, 0xab, 0x1, 0x59, 0x90, 0x39, 0x4a, 0xbb, 0xcb, 0xcb, 0xe7, 0xe8, 0xfe, 0xfd, 0x3f, 0x38, 0xd8, 0x4, 0xf9, 0x46, 0xd0, 0xe8, 0xc1, 0x83, 0x7f, 0x68, 0x75, 0x75, 0x55, 0xb0, 0xec, 0xef, 0x97, 0x4e, 0xb0, 0x3a, 0xcd, 0x39, 0xcb, 0x17, 0x89, 0x12, 0xb2, 0x43, 0xe1, 0xc3, 0x2, 0x20, 0x7e, 0x91, 0x13, 0xf8, 0x83, 0x4f, 0x85, 0xf4, 0x63, 0x77, 0xe8, 0x74, 0xd0, 0x21, 0xb, 0x32, 0xdd, 0x6, 0x2c, 0xa, 0x0, 0xac, 0x26, 0x59, 0x2c, 0x16, 0x84, 0xa6, 0x8b, 0xc5, 0x22, 0x47, 0xfe, 0xe, 0x5d, 0xba, 0xf4, 0xa2, 0x60, 0xbf, 0x77, 0xef, 0x77, 0xd2, 0xf5, 0xce, 0x89, 0x39, 0x27, 0x73, 0x16, 0xc0, 0xe, 0x33, 0xa6, 0x61, 0xa6, 0x23, 0x77, 0x21, 0x73, 0x53, 0x21, 0x14, 0xc9, 0x3, 0xee, 0xd4, 0xe3, 0x89, 0xc3, 0xd9, 0x41, 0x43, 0x16, 0x64, 0xba, 0xd, 0x45, 0x99, 0xa3, 0x85, 0x85, 0x94, 0xb8, 0xbb, 0xe5, 0xc6, 0xa3, 0xd1, 0x98, 0x0, 0x25, 0x7, 0x80, 0xca, 0x77, 0xd2, 0xa4, 0xad, 0x73, 0x6e, 0xb2, 0xcd, 0x14, 0x14, 0xd9, 0x8e, 0x88, 0x9a, 0xd2, 0xa4, 0x71, 0x29, 0x73, 0x12, 0x3e, 0xe0, 0x5d, 0xd, 0xf8, 0x43, 0x5d, 0xa, 0x87, 0xc3, 0x67, 0x47, 0x68, 0xe3, 0x84, 0x2c, 0xc8, 0x74, 0x1b, 0x0, 0x2, 0xd, 0x27, 0x12, 0x51, 0xb1, 0x4, 0xc0, 0xd7, 0xd6, 0x5e, 0x10, 0xda, 0x9d, 0x7e, 0x0, 0x93, 0x28, 0x30, 0x44, 0xe2, 0x1, 0xd, 0x3, 0x39, 0xc, 0xf8, 0x40, 0xd7, 0x8d, 0x82, 0xdf, 0xef, 0xcb, 0xd6, 0xeb, 0x75, 0x91, 0x70, 0xd4, 0x6a, 0xb3, 0xf1, 0xe3, 0x48, 0x24, 0x42, 0x90, 0x39, 0x6a, 0xdc, 0xb9, 0xb3, 0x45, 0x9b, 0x9b, 0xaf, 0xd0, 0x85, 0xb, 0x1a, 0x47, 0xf4, 0x88, 0xf0, 0x61, 0x19, 0xa5, 0xa7, 0x1, 0xcd, 0x96, 0x85, 0x42, 0x2, 0x1f, 0x17, 0x89, 0x87, 0x35, 0xd3, 0xa, 0x70, 0x76, 0xb2, 0xc0, 0xa9, 0xe1, 0xa5, 0x7e, 0x5b, 0xa7, 0xcc, 0x62, 0x86, 0xaf, 0x25, 0x8d, 0x4d, 0xd1, 0xb5, 0xb4, 0x9c, 0x68, 0x1f, 0xe1, 0xb0, 0x5f, 0xdc, 0xc3, 0xb8, 0x8f, 0xd, 0xc3, 0x3d, 0xc3, 0xe2, 0x8a, 0x87, 0xb6, 0xb7, 0xf3, 0xc4, 0x55, 0xf, 0xdd, 0xbd, 0xfb, 0x1b, 0xe7, 0x0, 0xfb, 0x42, 0x7e, 0xab, 0xd5, 0x10, 0xa6, 0xdd, 0xeb, 0xf5, 0x87, 0x56, 0xe2, 0x34, 0xe7, 0x6e, 0x3d, 0xb5, 0xaf, 0x38, 0xcd, 0xfc, 0x85, 0xdf, 0xe3, 0xda, 0xd1, 0x25, 0x60, 0x61, 0xde, 0xfc, 0xa2, 0xc0, 0xa9, 0xe5, 0x35, 0xc3, 0x33, 0x60, 0xaf, 0x33, 0x28, 0x93, 0xc9, 0x88, 0xd, 0x20, 0x65, 0x3c, 0xcb, 0xf0, 0xb3, 0x94, 0xa5, 0xa5, 0x25, 0xaa, 0x54, 0x2a, 0xd4, 0xe4, 0xcc, 0x6b, 0xdc, 0x80, 0xd9, 0xd7, 0xeb, 0x7, 0x34, 0x18, 0x1c, 0x1d, 0x8c, 0xcf, 0xa7, 0x70, 0x4e, 0xd0, 0x3a, 0xe6, 0x12, 0x4e, 0x73, 0x4e, 0xb2, 0xd, 0xa3, 0xdf, 0xca, 0xe5, 0x1e, 0x7e, 0xc0, 0xef, 0x1e, 0x32, 0x21, 0xbd, 0x34, 0xac, 0x80, 0x45, 0x46, 0xcf, 0x41, 0x4d, 0xf, 0x85, 0xc2, 0x2f, 0xb5, 0xdb, 0x5d, 0x2e, 0x4, 0x2, 0xe2, 0xfe, 0xec, 0x74, 0x9a, 0xa7, 0xd6, 0xb4, 0xaa, 0x6, 0x38, 0x17, 0xcf, 0x72, 0x4e, 0xdd, 0xa6, 0x52, 0xa1, 0xea, 0x58, 0x70, 0x8c, 0x3b, 0x80, 0x69, 0xde, 0x23, 0x58, 0x55, 0x2a, 0xc5, 0xcf, 0x38, 0x97, 0xfe, 0x95, 0xe5, 0x20, 0x18, 0xe0, 0xc4, 0x87, 0x26, 0xd, 0xd9, 0xa2, 0x5d, 0xc2, 0xb, 0x76, 0x82, 0xc1, 0xd0, 0xf3, 0x7e, 0xbf, 0x7f, 0x4d, 0xe3, 0xa4, 0x5f, 0x51, 0xbc, 0xb4, 0xb8, 0xb8, 0x28, 0x9e, 0xb8, 0xe, 0xc, 0x97, 0x2, 0x42, 0xa4, 0x6b, 0xac, 0x51, 0x55, 0xd, 0xf2, 0x75, 0x32, 0x2f, 0xac, 0x43, 0x94, 0x89, 0x7b, 0x65, 0xf7, 0x7e, 0xcb, 0x34, 0x88, 0x46, 0xf0, 0xca, 0x6a, 0x69, 0x7f, 0x7f, 0xf7, 0x6, 0x2f, 0x43, 0x43, 0x40, 0x68, 0x17, 0x2c, 0x6e, 0xf5, 0x30, 0x97, 0x88, 0xe7, 0x3f, 0xe2, 0xe8, 0xba, 0x81, 0x6b, 0x4c, 0x51, 0x3c, 0xc2, 0xf, 0xa7, 0xab, 0x87, 0x1f, 0x13, 0x3a, 0x9b, 0xd8, 0x43, 0xb0, 0x8d, 0x9f, 0xf3, 0xf9, 0x47, 0x1f, 0xf3, 0xab, 0xbf, 0x98, 0x1c, 0xeb, 0x61, 0xc9, 0x26, 0x3b, 0x1e, 0xe8, 0x61, 0x9d, 0xe7, 0x6a, 0xe3, 0xa, 0xd3, 0x75, 0x9f, 0xcf, 0xcb, 0x95, 0x94, 0xac, 0x61, 0xad, 0x25, 0xb4, 0xf5, 0x6b, 0xe3, 0x8a, 0x3, 0xc9, 0x6f, 0x97, 0x33, 0xbb, 0x83, 0xe8, 0xf7, 0xfb, 0x1a, 0x9b, 0xf1, 0x8d, 0x4a, 0x65, 0xd8, 0xf1, 0x40, 0x9f, 0xb, 0xa6, 0xec, 0xd8, 0xf1, 0xb0, 0x82, 0x46, 0x31, 0x81, 0x72, 0x91, 0x73, 0x6b, 0x5a, 0xe1, 0x9e, 0xd6, 0x1b, 0x66, 0x4f, 0x6b, 0x1, 0xd9, 0xd9, 0x93, 0xee, 0x67, 0xc9, 0x8d, 0x1e, 0x26, 0x15, 0xa2, 0xa7, 0xb5, 0x6f, 0xf6, 0xb4, 0xbe, 0xe1, 0x89, 0x6d, 0xd3, 0x67, 0xd1, 0xd3, 0xc2, 0x75, 0x7b, 0x2c, 0xe4, 0x8e, 0xeb, 0x5a, 0xce, 0x31, 0x83, 0xca, 0x4, 0x8d, 0xa3, 0xf5, 0x63, 0xef, 0x5a, 0xce, 0x4e, 0x3d, 0xa7, 0x97, 0x4, 0x20, 0xd6, 0xae, 0x25, 0x4c, 0x17, 0x1a, 0x85, 0xbf, 0x22, 0x45, 0x13, 0x89, 0x86, 0x5d, 0xec, 0xa8, 0xd6, 0x3, 0xde, 0xc9, 0x1c, 0x1b, 0x9, 0xa, 0xb2, 0x7f, 0x68, 0x5e, 0x24, 0xe1, 0x26, 0x9d, 0x7e, 0x9b, 0xb3, 0xe3, 0x90, 0x8d, 0x77, 0xd9, 0x97, 0x86, 0xe9, 0x22, 0xb9, 0x90, 0x40, 0x1d, 0x7d, 0x6c, 0xd2, 0x5e, 0x8b, 0x4, 0xf8, 0x34, 0x0, 0xb5, 0x1f, 0x99, 0xf5, 0xbf, 0xe, 0xe3, 0x2, 0xc9, 0xec, 0x8e, 0xfb, 0x99, 0xa4, 0xa7, 0xf4, 0x4, 0xfe, 0x5, 0x72, 0xf1, 0x9c, 0xca, 0xa6, 0xf4, 0x2a, 0x9a, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
static const unsigned char toggle_on_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x8, 0x3, 0x0, 0x0, 0x0, 0x95, 0x43, 0x8e, 0xb6, 0x0, 0x0, 0x1, 0x74, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0xd, 0xf, 0x1a, 0x1a, 0x1e, 0x20, 0x20, 0x24, 0x22, 0x22, 0x27, 0x24, 0x24, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, 0xa, 0xc, 0x1d, 0x1d, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11, 0x14, 0x23, 0x23, 0x28, 0x12, 0x12, 0x15, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb, 0xb, 0xd, 0x23, 0x23, 0x28, 0xb, 0xb, 0xd, 0x1e, 0x1e, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0xe, 0x10, 0x1a, 0x1a, 0x1e, 0x1a, 0x1a, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x20, 0x24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0xe, 0x10, 0xb, 0xb, 0xd, 0x0, 0x0, 0x0, 0x13, 0x13, 0x15, 0x0, 0x0, 0x0, 0xb, 0xb, 0xc, 0x1d, 0x1d, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x25, 0x25, 0x2a, 0x24, 0x24, 0x29, 0x25, 0x2c, 0x36, 0x27, 0x49, 0x65, 0x29, 0x5d, 0x85, 0x2a, 0x66, 0x95, 0x2a, 0x68, 0x99, 0x29, 0x64, 0x92, 0x28, 0x4c, 0x6b, 0x25, 0x27, 0x2d, 0x27, 0x43, 0x5c, 0x29, 0x5f, 0x89, 0x27, 0x49, 0x66, 0x25, 0x30, 0x3e, 0x25, 0x26, 0x2d, 0x25, 0x25, 0x2b, 0x25, 0x26, 0x2c, 0x25, 0x2d, 0x38, 0x25, 0x3a, 0x4c, 0x27, 0x4d, 0x6b, 0x29, 0x60, 0x8c, 0x27, 0x44, 0x5c, 0x27, 0x4b, 0x69, 0x28, 0x59, 0x7f, 0x25, 0x34, 0x43, 0x25, 0x35, 0x45, 0x28, 0x58, 0x7f, 0x25, 0x26, 0x2b, 0x27, 0x40, 0x57, 0x27, 0x41, 0x57, 0x25, 0x2a, 0x33, 0x29, 0x5d, 0x87, 0x25, 0x34, 0x44, 0x25, 0x2b, 0x34, 0x40, 0x40, 0x44, 0xad, 0xad, 0xaf, 0xff, 0xff, 0xff, 0xf2, 0xf2, 0xf2, 0x77, 0x77, 0x7a, 0x5b, 0x5b, 0x5f, 0x4e, 0x4e, 0x52, 0xc9, 0xc9, 0xca, 0x27, 0x43, 0x5b, 0x27, 0x4d, 0x6c, 0x27, 0x4e, 0x6d, 0xbb, 0xbb, 0xbd, 0x69, 0x69, 0x6c, 0x28, 0x56, 0x7b, 0x26, 0x3b, 0x4e, 0x26, 0x3a, 0x4e, 0x32, 0x32, 0x37, 0x84, 0x84, 0x87, 0xd6, 0xd6, 0xd7, 0x29, 0x61, 0x8d, 0x25, 0x2e, 0x39, 0x92, 0x92, 0x94, 0xa0, 0xa0, 0xa2, 0xe4, 0xe4, 0xe5, 0x27, 0x44, 0x5d, 0xdd, 0xc9, 0xf2, 0x7e, 0x0, 0x0, 0x0, 0x41, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x1, 0x2, 0x3, 0x4, 0x9, 0xe, 0x13, 0x16, 0x18, 0x19, 0xa, 0x26, 0x36, 0x44, 0x4d, 0x52, 0x54, 0x55, 0x6, 0x12, 0x27, 0x43, 0x80, 0xc5, 0xe7, 0xf5, 0xfe, 0x8, 0x17, 0x35, 0x73, 0xd9, 0x7, 0x3a, 0x96, 0xf9, 0x9a, 0xb, 0x28, 0x76, 0xfb, 0x77, 0xde, 0x45, 0x5, 0x82, 0xc6, 0xc6, 0x37, 0xf, 0xe9, 0x4c, 0x4e, 0x4f, 0x50, 0x83, 0x78, 0x3b, 0x9c, 0x3c, 0x74, 0xda, 0x53, 0x14, 0x37, 0x21, 0x5a, 0x6c, 0x0, 0x0, 0x2, 0x4, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xdd, 0x95, 0x63, 0x83, 0xdc, 0x60, 0x10, 0xc7, 0x1b, 0x3c, 0xc1, 0xda, 0x3e, 0xdb, 0x36, 0xe7, 0x6c, 0xdb, 0xa, 0xcf, 0xc6, 0x7e, 0xf8, 0x2a, 0x6d, 0xb8, 0xac, 0x7b, 0xbf, 0xf7, 0xf3, 0x1f, 0xcf, 0x7c, 0xf8, 0x97, 0xc0, 0x70, 0x82, 0x20, 0xb3, 0x42, 0x10, 0x38, 0x96, 0xd2, 0x1c, 0x27, 0x11, 0x45, 0x33, 0xac, 0x2d, 0xb, 0x2c, 0x43, 0x53, 0x88, 0xc4, 0xad, 0xde, 0x49, 0x3b, 0xe3, 0x70, 0xba, 0xdc, 0x1e, 0xaf, 0x2f, 0x23, 0x5e, 0x8f, 0xdb, 0xe5, 0x74, 0x30, 0x76, 0xd2, 0x14, 0x5, 0xee, 0xf, 0x4, 0x43, 0xe1, 0x48, 0x34, 0x16, 0x87, 0x2c, 0xc4, 0x63, 0xd1, 0x48, 0x38, 0x14, 0xc, 0xf8, 0x71, 0x83, 0x7d, 0xa2, 0xa0, 0xb0, 0xa8, 0x78, 0x4, 0x72, 0x64, 0xa4, 0xb8, 0xa8, 0xb0, 0x20, 0xa1, 0x53, 0xc0, 0x4a, 0xd8, 0xd2, 0xb2, 0x72, 0xc8, 0xc4, 0xe8, 0xd8, 0xf8, 0xc4, 0xa4, 0xc2, 0xd4, 0xf4, 0x28, 0x94, 0x97, 0x95, 0xb2, 0x25, 0x98, 0x96, 0x3f, 0xed, 0xac, 0xc8, 0x18, 0xfb, 0xcc, 0xec, 0xdc, 0xfc, 0xc2, 0xe2, 0xd2, 0x17, 0x96, 0x57, 0x56, 0xd7, 0xd6, 0x37, 0x66, 0xe2, 0x15, 0x4e, 0x5a, 0xad, 0x3, 0x5e, 0x59, 0x55, 0x5d, 0x93, 0xd1, 0x7e, 0x73, 0x6b, 0x1b, 0x74, 0xec, 0xec, 0x6e, 0xce, 0xd4, 0xd4, 0x56, 0x55, 0x7e, 0x4f, 0x82, 0x2c, 0x70, 0xd5, 0x41, 0x6, 0xf6, 0xf6, 0xb7, 0x56, 0xc0, 0xc0, 0xca, 0xd6, 0xc1, 0x5e, 0x5d, 0x7d, 0x41, 0x83, 0x12, 0x2, 0x86, 0x1c, 0x8d, 0x90, 0x89, 0xc3, 0xa3, 0x63, 0x30, 0xb1, 0x33, 0x77, 0x2, 0x8d, 0xe, 0xa4, 0x8, 0xe0, 0x94, 0xb3, 0x9, 0x54, 0x4e, 0xcf, 0x38, 0x5e, 0x0, 0x91, 0x93, 0x40, 0x94, 0x41, 0xe1, 0xfc, 0x2, 0x2c, 0x5c, 0x9e, 0x43, 0x73, 0x4b, 0xab, 0x92, 0x3, 0x41, 0xbb, 0xa2, 0xa0, 0x22, 0x5f, 0x9d, 0x5e, 0x73, 0xa7, 0x22, 0x27, 0x6b, 0x2, 0x37, 0xb7, 0x60, 0xe1, 0xee, 0x6, 0xda, 0xea, 0x69, 0x42, 0x11, 0x60, 0xda, 0x63, 0x5a, 0x0, 0xdc, 0x3d, 0xc0, 0xd5, 0x83, 0xf8, 0xc8, 0x8b, 0xaa, 0xc0, 0xd3, 0x33, 0x58, 0x78, 0x7e, 0x82, 0xf2, 0xe, 0x86, 0x54, 0x4, 0xa, 0x3a, 0xb5, 0x1e, 0x8a, 0x8f, 0x0, 0xf0, 0x72, 0x26, 0xca, 0x2f, 0x8f, 0xaa, 0xc0, 0xc4, 0x22, 0x58, 0x58, 0x9c, 0x0, 0xe8, 0x2a, 0xf8, 0x26, 0xc0, 0xb8, 0xb5, 0x21, 0xba, 0xff, 0x12, 0xc1, 0xd9, 0xeb, 0x67, 0xe3, 0xb7, 0xb3, 0x9c, 0x23, 0xa0, 0x5d, 0x6d, 0xa0, 0xf2, 0xf8, 0x0, 0xf7, 0xbc, 0xf0, 0x59, 0x40, 0xe0, 0x72, 0xad, 0x1, 0x4e, 0xb5, 0xe8, 0xba, 0x20, 0xf2, 0x8f, 0xfc, 0xd9, 0xd7, 0x2, 0x3e, 0xe6, 0xda, 0x5, 0xc, 0x39, 0xba, 0x41, 0xe3, 0xfe, 0x41, 0x2, 0x38, 0x15, 0x0, 0x24, 0x21, 0xf3, 0x1c, 0x74, 0x7, 0x11, 0xf6, 0xd3, 0x93, 0xa8, 0xee, 0x42, 0x6d, 0xfe, 0xbb, 0xd0, 0xa3, 0xed, 0x42, 0xe, 0xdb, 0xb8, 0x61, 0xdc, 0xc6, 0xa4, 0xba, 0x8d, 0xea, 0x3d, 0xe8, 0xed, 0xab, 0xc9, 0xe7, 0x1e, 0xd4, 0xf4, 0xf5, 0xab, 0xf7, 0x40, 0xb9, 0x48, 0xac, 0x73, 0x60, 0x10, 0x72, 0x66, 0x70, 0xc0, 0xc9, 0x26, 0x8c, 0x37, 0xad, 0x84, 0xe, 0xba, 0xc2, 0x91, 0xb6, 0x72, 0xc8, 0x4a, 0x79, 0x5b, 0x24, 0xec, 0xa, 0xd2, 0x25, 0xb8, 0xf9, 0x2a, 0x57, 0x32, 0x8e, 0x96, 0xfa, 0x8e, 0x21, 0x5f, 0x16, 0x86, 0x3a, 0xea, 0x5b, 0x1c, 0x4c, 0x25, 0x89, 0x59, 0xbf, 0x4a, 0x3, 0x6a, 0x1d, 0x2e, 0xc8, 0xfe, 0x17, 0xa, 0x86, 0x5b, 0x51, 0x3, 0x8e, 0xa5, 0xf9, 0x4c, 0x64, 0xe, 0x68, 0x9f, 0xe9, 0xbd, 0xf0, 0x9, 0xb7, 0x71, 0x36, 0xc6, 0x9b, 0x3d, 0x7f, 0x21, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
+static const unsigned char toggle_on_disabled_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x8, 0x6, 0x0, 0x0, 0x0, 0xa2, 0x9d, 0x7e, 0x84, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x12, 0x0, 0x0, 0xb, 0x12, 0x1, 0xd2, 0xdd, 0x7e, 0xfc, 0x0, 0x0, 0x6, 0x54, 0x49, 0x44, 0x41, 0x54, 0x68, 0x43, 0xed, 0x59, 0x4b, 0x6f, 0x1b, 0x55, 0x14, 0x3e, 0x71, 0xfc, 0x9a, 0xd8, 0x4e, 0x9c, 0x38, 0x6e, 0x62, 0xe7, 0x21, 0xb5, 0x6e, 0x51, 0xd5, 0x5, 0xa8, 0xac, 0x93, 0x14, 0x89, 0x22, 0x84, 0xba, 0x60, 0x53, 0xb1, 0x29, 0x12, 0x42, 0xa0, 0xfe, 0x1, 0x7e, 0x1, 0x7b, 0xb6, 0x6c, 0xaa, 0x82, 0xa8, 0xc4, 0x96, 0x5f, 0x50, 0x21, 0x55, 0x34, 0x1b, 0x4a, 0x17, 0x65, 0x51, 0x9, 0x85, 0x3c, 0x9b, 0xb4, 0x4d, 0xfd, 0x76, 0xfc, 0x7e, 0xf3, 0x7d, 0x37, 0x33, 0xc6, 0x76, 0xed, 0xcc, 0x38, 0x4e, 0x52, 0x21, 0x7a, 0xa4, 0xa3, 0xc9, 0x4c, 0xee, 0x3d, 0xf7, 0xbc, 0xee, 0xb9, 0xdf, 0x3d, 0x16, 0x79, 0x4b, 0x6f, 0x3d, 0xf0, 0xbf, 0xf6, 0xc0, 0xc8, 0x80, 0xd6, 0x73, 0xbc, 0xc1, 0x9c, 0x3a, 0xe8, 0xfc, 0x1, 0x97, 0xb3, 0x3c, 0xbc, 0xa9, 0x8f, 0xe4, 0xd3, 0x60, 0x4b, 0x93, 0xad, 0x1a, 0x60, 0x83, 0x34, 0xb2, 0xa3, 0x8d, 0x47, 0xf5, 0x6f, 0x56, 0x65, 0x58, 0x52, 0xe8, 0x18, 0x83, 0x68, 0x70, 0x3, 0x5c, 0x7, 0x57, 0xdb, 0x98, 0xdf, 0xc8, 0x47, 0x92, 0x99, 0xf2, 0xfc, 0x3f, 0xd, 0x75, 0x82, 0xbd, 0x60, 0xbf, 0xce, 0xe3, 0x78, 0x6a, 0xba, 0x33, 0xe8, 0x18, 0x33, 0x39, 0x66, 0x7a, 0x1c, 0xf7, 0xff, 0x86, 0xf1, 0x34, 0xbc, 0x8, 0x3e, 0x0, 0xa7, 0x75, 0xce, 0xe1, 0x59, 0xd1, 0x1d, 0x63, 0x64, 0xc8, 0x6b, 0xeb, 0x1c, 0xa5, 0x38, 0xd, 0xb3, 0xeb, 0x86, 0x7, 0xf1, 0x9c, 0xf7, 0xf9, 0x26, 0x96, 0xc1, 0x1f, 0x39, 0x9d, 0xce, 0xb, 0x36, 0xdb, 0xe8, 0xb8, 0xcd, 0x66, 0xd3, 0x46, 0x40, 0xc7, 0xd5, 0xfe, 0x24, 0xe6, 0x35, 0x41, 0x8d, 0x46, 0xa3, 0xd8, 0x68, 0xd4, 0xf, 0x2a, 0x95, 0xca, 0x66, 0x36, 0x9b, 0xb9, 0xf, 0x7e, 0x8, 0xd9, 0x7b, 0xe0, 0x18, 0x98, 0x8e, 0xa8, 0xf5, 0xcb, 0x86, 0x7e, 0xca, 0xd3, 0x78, 0x46, 0x7d, 0x2, 0xbc, 0x38, 0x36, 0xe6, 0x5d, 0x9, 0x4, 0x82, 0xb7, 0x5d, 0x2e, 0xf7, 0x3b, 0x6f, 0xd8, 0x5e, 0x53, 0x9f, 0xc1, 0x1f, 0x52, 0x2e, 0x97, 0xd6, 0x12, 0x89, 0xd8, 0x9d, 0x42, 0x21, 0xf7, 0x1b, 0x26, 0x3c, 0x3, 0x67, 0xf4, 0x6c, 0x78, 0x6d, 0x4b, 0xf4, 0x72, 0x0, 0xbf, 0xd1, 0xf8, 0x49, 0xf0, 0x85, 0xc9, 0xc9, 0xe9, 0xcf, 0xa7, 0xa6, 0xa6, 0xbf, 0x42, 0xb4, 0xf9, 0xed, 0x4c, 0x49, 0xd3, 0xec, 0x32, 0x3b, 0x3b, 0x2b, 0x93, 0x93, 0x93, 0xa2, 0x69, 0x9a, 0x40, 0x87, 0xbe, 0xeb, 0xd7, 0x6a, 0x35, 0x89, 0xc7, 0xe3, 0xb2, 0xb7, 0xb7, 0x27, 0xc5, 0x62, 0x4d, 0x90, 0x15, 0x95, 0x64, 0x32, 0xfe, 0x43, 0x2a, 0x15, 0xff, 0x19, 0x93, 0x36, 0xc1, 0x29, 0xdd, 0x9, 0x1d, 0xdb, 0xa1, 0xdb, 0x1, 0xc6, 0x9e, 0x67, 0xe4, 0x23, 0x53, 0x53, 0xc1, 0xaf, 0x61, 0xfc, 0xd7, 0x67, 0x9e, 0xe6, 0xb6, 0x51, 0x59, 0x98, 0xb, 0xca, 0xcc, 0xcc, 0x8c, 0x24, 0x12, 0x9, 0x65, 0x58, 0x36, 0x87, 0x6d, 0xde, 0xec, 0x51, 0xd3, 0xb0, 0x3, 0x35, 0xb7, 0x4d, 0x3c, 0x1e, 0x8f, 0xf8, 0xfd, 0x7e, 0xe5, 0xac, 0xfd, 0xfd, 0x7d, 0xd9, 0x7d, 0x1e, 0x93, 0x66, 0xbd, 0xd6, 0x84, 0x13, 0xee, 0x26, 0x93, 0xb1, 0xbb, 0xb0, 0x67, 0x43, 0xcf, 0x4, 0x16, 0xcb, 0x96, 0x13, 0x58, 0xe0, 0xda, 0x89, 0x2e, 0x76, 0x83, 0x43, 0x1e, 0x8f, 0xef, 0xe3, 0x60, 0x70, 0xe6, 0x1b, 0x78, 0xbd, 0x7b, 0xcc, 0xe9, 0x66, 0x1, 0x96, 0x8b, 0x9c, 0x9f, 0x93, 0x89, 0x89, 0x9, 0xd9, 0xdc, 0xdc, 0x84, 0x31, 0x9, 0xa9, 0x54, 0xb8, 0x85, 0xfb, 0xd5, 0xb1, 0xa6, 0xd4, 0x6a, 0xd, 0x29, 0x14, 0xca, 0x92, 0x4c, 0x66, 0xf0, 0xcc, 0x4a, 0x28, 0x14, 0x12, 0xaf, 0xc7, 0x2d, 0xa9, 0x4c, 0x7e, 0xc4, 0xed, 0x72, 0xbd, 0x57, 0xa9, 0x94, 0xb7, 0xaa, 0xd5, 0xca, 0x2e, 0x84, 0xe4, 0xc1, 0x1d, 0xc2, 0xba, 0x8d, 0xe3, 0x3b, 0x2b, 0xfd, 0xa5, 0x50, 0x68, 0xfe, 0x5b, 0x87, 0xc3, 0x11, 0x38, 0x5d, 0x6b, 0xbb, 0xa4, 0x23, 0x9a, 0xe1, 0x50, 0x40, 0x45, 0x71, 0x6d, 0x6d, 0x4d, 0x72, 0xb9, 0xf2, 0xc0, 0xcb, 0x97, 0x4a, 0x55, 0x39, 0x38, 0x48, 0x29, 0x27, 0x8c, 0xda, 0x9a, 0x92, 0xcb, 0x97, 0x6c, 0x28, 0xda, 0x91, 0x4c, 0x26, 0xc5, 0x7a, 0xc0, 0x6d, 0x40, 0xa1, 0x2d, 0x6f, 0xb6, 0x6f, 0x2a, 0xa6, 0x3f, 0xcf, 0xf9, 0x89, 0xf1, 0x71, 0xff, 0xa, 0xa, 0xde, 0xf9, 0x81, 0x57, 0x1f, 0x72, 0x82, 0xcb, 0x39, 0xa2, 0x14, 0xdf, 0xd9, 0xd9, 0x51, 0xfb, 0xf8, 0xb8, 0xc4, 0xb9, 0x94, 0x11, 0xe, 0x87, 0x85, 0x32, 0x69, 0xb, 0x6c, 0x5a, 0xa6, 0x6d, 0x60, 0x9e, 0x6c, 0x2d, 0xea, 0xe5, 0x0, 0xbf, 0xd7, 0x3b, 0x7e, 0xdd, 0xea, 0xe2, 0x73, 0x73, 0x61, 0xb9, 0x7a, 0xf5, 0x5d, 0xb9, 0x75, 0xeb, 0x33, 0xb9, 0x79, 0xf3, 0x53, 0xec, 0xdb, 0xc3, 0xa4, 0xd1, 0x34, 0xa7, 0xfa, 0x66, 0x43, 0x14, 0x8c, 0xf7, 0x6b, 0xd7, 0x96, 0x8e, 0x14, 0x1b, 0xc, 0x6, 0x11, 0xbd, 0x3, 0x49, 0xa7, 0x99, 0xa9, 0xc3, 0x11, 0x65, 0x64, 0x32, 0x19, 0xa1, 0x4c, 0x92, 0xd7, 0xeb, 0xa3, 0x4d, 0x2c, 0xec, 0x2c, 0xe6, 0xad, 0xda, 0xd7, 0xcb, 0x1, 0xe3, 0x48, 0x19, 0xcb, 0xd1, 0xbf, 0x78, 0xf1, 0x2, 0x3c, 0xec, 0x92, 0x7, 0xf, 0x56, 0xe5, 0xfe, 0xfd, 0x5f, 0xe5, 0xfa, 0xf5, 0xf, 0x85, 0x4e, 0x31, 0x68, 0x79, 0x99, 0x8e, 0xb7, 0x46, 0x4c, 0xfd, 0x74, 0x9a, 0x38, 0xe6, 0x64, 0x88, 0xb2, 0x28, 0x93, 0xe4, 0x74, 0xba, 0x22, 0x78, 0x10, 0xc0, 0x31, 0x3, 0x7a, 0x3a, 0x80, 0xe3, 0x58, 0x3, 0xdc, 0x4, 0x39, 0x56, 0x54, 0xa0, 0xa1, 0xf3, 0xf3, 0x61, 0x79, 0xfa, 0xf4, 0x2f, 0x79, 0xfe, 0xfc, 0x5, 0x3c, 0x9e, 0x93, 0x8d, 0x8d, 0x2d, 0x44, 0xfd, 0x70, 0x76, 0x34, 0x9a, 0x40, 0x4, 0x2, 0x2a, 0x1b, 0xac, 0x10, 0x8f, 0xba, 0x7c, 0x7e, 0xf8, 0xe8, 0x1b, 0x6b, 0x51, 0x16, 0x65, 0x2a, 0xc3, 0x46, 0xed, 0xac, 0x6d, 0x7c, 0xa1, 0x8d, 0x7d, 0x1d, 0xa0, 0x8e, 0x41, 0x22, 0x3c, 0x2b, 0xa, 0xe3, 0x88, 0x51, 0x46, 0x66, 0xb3, 0xd9, 0xd6, 0xf0, 0x78, 0x3c, 0x26, 0xd3, 0xd3, 0xd3, 0xea, 0x1d, 0xd5, 0x57, 0x9e, 0x3c, 0xf9, 0x53, 0x96, 0x96, 0xac, 0x65, 0x1, 0x8a, 0xae, 0x14, 0x8a, 0xa6, 0xf0, 0xdd, 0x8a, 0x6a, 0x6a, 0xc, 0x65, 0x51, 0x26, 0x49, 0xc7, 0x31, 0xaf, 0xc1, 0xf6, 0x6e, 0x64, 0xa1, 0xb0, 0x35, 0xd0, 0x14, 0xb1, 0xb5, 0x29, 0xd9, 0xed, 0x2e, 0x39, 0x77, 0x2e, 0x20, 0x3e, 0x9f, 0xaf, 0x35, 0xd6, 0xe7, 0x1b, 0x57, 0x86, 0x1b, 0xb4, 0xbe, 0xbe, 0xcd, 0xf4, 0x93, 0xcb, 0x97, 0x2f, 0x9b, 0xca, 0xab, 0x56, 0xab, 0x32, 0xa6, 0xf5, 0x7, 0x3b, 0xa6, 0x2, 0xba, 0x6, 0x50, 0x16, 0x65, 0x92, 0x8, 0x8c, 0xf8, 0x0, 0x77, 0x9c, 0xa7, 0xdd, 0xab, 0x11, 0x24, 0x14, 0xeb, 0xf5, 0x9a, 0xa5, 0x8d, 0xc8, 0xc8, 0x33, 0x3, 0xfc, 0xfe, 0x43, 0x7, 0xd0, 0x11, 0x91, 0xc8, 0x79, 0x5, 0x5c, 0xda, 0xe9, 0xf1, 0xe3, 0xdf, 0xe5, 0xca, 0x15, 0x73, 0x7, 0x14, 0x8b, 0x45, 0x5, 0x68, 0x4e, 0x8a, 0x28, 0x8b, 0x32, 0x49, 0xba, 0x4d, 0x7c, 0xe9, 0x0, 0x42, 0xed, 0x47, 0x2, 0x3d, 0x43, 0x77, 0x65, 0x71, 0xa9, 0xd8, 0x70, 0x38, 0x9c, 0xe7, 0xac, 0x28, 0xb2, 0xba, 0xfa, 0x50, 0x6e, 0xdc, 0xf8, 0x4, 0x11, 0xce, 0x1, 0xbc, 0x78, 0x55, 0xd, 0x78, 0xf5, 0x2a, 0xd1, 0xb1, 0xef, 0xf9, 0x4e, 0x47, 0x99, 0x51, 0x2a, 0x95, 0x52, 0x68, 0x2e, 0x16, 0xb3, 0xe4, 0x7f, 0x33, 0x71, 0x4a, 0x16, 0x65, 0x92, 0x90, 0x95, 0x44, 0x82, 0xbc, 0x2d, 0x1e, 0x9, 0x84, 0xd4, 0x25, 0x8, 0xd0, 0xd7, 0x87, 0x63, 0x63, 0xc5, 0x74, 0x5, 0x4a, 0xab, 0xd5, 0x65, 0x77, 0xf7, 0x5, 0x40, 0xcb, 0x81, 0x3c, 0x7a, 0xf4, 0x87, 0xbc, 0x7c, 0x19, 0x55, 0xd3, 0x8, 0x63, 0xa3, 0xd1, 0x7d, 0x14, 0xb5, 0xc3, 0x8, 0x6c, 0x6f, 0x6f, 0x22, 0x1a, 0x85, 0xd6, 0x7b, 0x2f, 0xd9, 0xe5, 0x72, 0x51, 0x16, 0x16, 0x16, 0x30, 0x2e, 0x27, 0x4, 0x34, 0xc3, 0x90, 0xdf, 0xef, 0x51, 0x38, 0x60, 0x6b, 0x6b, 0xb, 0xd1, 0x6f, 0xc2, 0x11, 0x89, 0x7b, 0xb8, 0x24, 0x3d, 0x82, 0xcc, 0xa4, 0xee, 0x4, 0x25, 0xbe, 0x17, 0xcc, 0xb5, 0x61, 0x60, 0x11, 0xe, 0x58, 0xb6, 0xdb, 0xed, 0x87, 0x67, 0x88, 0x9, 0x21, 0x63, 0x70, 0x7e, 0x67, 0xa5, 0xd9, 0xfc, 0xf7, 0x6a, 0xc1, 0xed, 0x61, 0x18, 0xcf, 0xe9, 0xfc, 0x5f, 0xfb, 0x7b, 0x2f, 0x91, 0x75, 0xec, 0xd0, 0x11, 0x6c, 0x53, 0x2a, 0x4e, 0x34, 0x47, 0x88, 0x7b, 0x1c, 0xe2, 0x25, 0x2a, 0x12, 0x89, 0x20, 0x13, 0x5f, 0x49, 0x3a, 0x53, 0xe0, 0xed, 0x70, 0x2b, 0x1a, 0x7d, 0xf9, 0x3d, 0x64, 0xed, 0x80, 0x79, 0xcc, 0xb4, 0x4, 0xf7, 0x72, 0x0, 0xb7, 0xc2, 0x8, 0x6e, 0x57, 0x39, 0xdc, 0x7, 0x3e, 0x40, 0x36, 0x9c, 0x5c, 0x55, 0xb2, 0x60, 0x4d, 0x36, 0x5f, 0x56, 0x38, 0x9e, 0x88, 0xb0, 0x54, 0xca, 0x43, 0xf9, 0xc1, 0x32, 0x81, 0x91, 0xa7, 0xf1, 0xb9, 0x5c, 0x4e, 0x9e, 0xed, 0x45, 0xa5, 0x51, 0xaf, 0xd5, 0x62, 0xb1, 0xfd, 0xef, 0x70, 0x17, 0x60, 0xf4, 0x59, 0x9c, 0x58, 0xc, 0xfb, 0x5e, 0x86, 0xa8, 0xa2, 0x6a, 0x2f, 0x61, 0x42, 0x86, 0xc6, 0x6b, 0xda, 0xd8, 0xfb, 0x67, 0x7a, 0x1b, 0xc4, 0x7d, 0x3e, 0x5, 0x3c, 0xe1, 0x74, 0xd8, 0x64, 0x71, 0x71, 0x11, 0x20, 0xcb, 0x81, 0x14, 0xae, 0x48, 0xa5, 0x6a, 0xe8, 0xdc, 0xde, 0x96, 0xc4, 0xdf, 0x88, 0x8f, 0xa6, 0x8d, 0xaa, 0x42, 0x1c, 0xe, 0xcf, 0x2, 0x84, 0xcd, 0xa1, 0x86, 0xc4, 0x64, 0xfb, 0xd9, 0xbe, 0xba, 0xd, 0x22, 0xf5, 0x7f, 0x44, 0x36, 0xfd, 0x2, 0x9b, 0xd8, 0x20, 0xe9, 0x88, 0x3e, 0x8d, 0x35, 0xeb, 0x7, 0x44, 0xd0, 0x8, 0xf9, 0xd2, 0xef, 0xf, 0x7c, 0x81, 0x73, 0xb4, 0x3, 0x43, 0x5b, 0x8, 0xe6, 0xd0, 0x43, 0x86, 0xec, 0x7, 0xd4, 0xd2, 0xe9, 0xc4, 0x3d, 0x34, 0x46, 0x7e, 0x82, 0x22, 0xeb, 0x60, 0x4b, 0xfd, 0x0, 0x43, 0x69, 0xa3, 0x23, 0x44, 0xf4, 0xb4, 0xe8, 0xf1, 0x78, 0x57, 0xd0, 0x1b, 0xb8, 0xed, 0x76, 0x6b, 0x97, 0x86, 0xb6, 0xea, 0xc, 0x4, 0x94, 0x4a, 0xc5, 0xbf, 0xd1, 0x3, 0xb8, 0x93, 0xcf, 0xb7, 0x3a, 0x42, 0x3c, 0x56, 0xc, 0x1c, 0xd0, 0xa1, 0x81, 0x59, 0x4f, 0x90, 0x30, 0x8a, 0xcd, 0x50, 0x42, 0xbb, 0x5, 0xf4, 0x3, 0x97, 0xf4, 0x9e, 0xe0, 0x45, 0x42, 0xcb, 0x37, 0xd1, 0x25, 0xea, 0xe5, 0x3f, 0x82, 0x1c, 0x9e, 0xf3, 0x28, 0xc6, 0xeb, 0x7a, 0x4f, 0x70, 0x15, 0xe3, 0x78, 0xff, 0xe7, 0x9e, 0x67, 0x4f, 0x90, 0x85, 0xa4, 0x67, 0x45, 0x35, 0x6b, 0x68, 0x1a, 0x1d, 0x22, 0x17, 0x4, 0x10, 0xa1, 0x30, 0x23, 0x78, 0x32, 0x74, 0x77, 0x85, 0xcf, 0x20, 0xae, 0x7d, 0x97, 0xa0, 0x61, 0xed, 0x5d, 0x61, 0xa6, 0x3a, 0x23, 0xce, 0xfd, 0x4e, 0x48, 0xda, 0x1, 0x7c, 0xba, 0xa5, 0x98, 0x39, 0x80, 0xe3, 0x8d, 0xaa, 0xc3, 0x13, 0x83, 0x75, 0x80, 0x37, 0x1b, 0x66, 0x86, 0x71, 0xa9, 0xb0, 0x22, 0xe3, 0x34, 0x1d, 0x64, 0xfc, 0x10, 0x62, 0xfc, 0x2e, 0xc0, 0x54, 0x27, 0xd8, 0x31, 0xc, 0xef, 0xdb, 0x12, 0x37, 0x8c, 0x1b, 0x44, 0xb9, 0xae, 0x12, 0x3c, 0xc8, 0xd4, 0x53, 0x1f, 0xdb, 0xfe, 0xab, 0xd0, 0x91, 0x46, 0x9f, 0xba, 0x26, 0x6f, 0x17, 0xf8, 0xf, 0x79, 0xe0, 0x1f, 0xd, 0x80, 0x80, 0xb4, 0xad, 0xe9, 0x2a, 0x4d, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
static const unsigned char tool_button_pressed_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x3, 0x0, 0x0, 0x0, 0x28, 0x2d, 0xf, 0x53, 0x0, 0x0, 0x1, 0xfe, 0x50, 0x4c, 0x54, 0x45, 0x29, 0x3a, 0x40, 0x2d, 0x3e, 0x44, 0x26, 0x34, 0x3b, 0x24, 0x34, 0x39, 0x23, 0x31, 0x38, 0x22, 0x31, 0x37, 0x22, 0x31, 0x37, 0x22, 0x30, 0x36, 0x22, 0x31, 0x36, 0x26, 0x34, 0x3c, 0x32, 0x44, 0x4c, 0x26, 0x34, 0x39, 0x23, 0x31, 0x36, 0x21, 0x2e, 0x34, 0x1f, 0x2c, 0x30, 0x1f, 0x2b, 0x2f, 0x1f, 0x2a, 0x2e, 0x1e, 0x2b, 0x2f, 0x1f, 0x2b, 0x2e, 0x36, 0x4b, 0x52, 0x25, 0x33, 0x38, 0x20, 0x2f, 0x32, 0x1c, 0x29, 0x2e, 0x1b, 0x26, 0x2a, 0x1a, 0x23, 0x26, 0x18, 0x22, 0x26, 0x19, 0x22, 0x26, 0x19, 0x23, 0x26, 0x19, 0x26, 0x29, 0x20, 0x2d, 0x32, 0x25, 0x31, 0x38, 0x3c, 0x51, 0x59, 0x23, 0x31, 0x37, 0x1f, 0x2b, 0x31, 0x1a, 0x25, 0x2b, 0x17, 0x20, 0x24, 0x15, 0x1c, 0x21, 0x14, 0x1b, 0x21, 0x14, 0x1c, 0x21, 0x13, 0x1b, 0x21, 0x15, 0x1d, 0x21, 0x1a, 0x25, 0x2a, 0x40, 0x57, 0x60, 0x23, 0x31, 0x36, 0x1f, 0x2b, 0x31, 0x1b, 0x25, 0x29, 0x16, 0x1e, 0x23, 0x14, 0x1b, 0x1d, 0x12, 0x19, 0x1d, 0x12, 0x1b, 0x1d, 0x14, 0x1a, 0x1d, 0x45, 0x5e, 0x67, 0x22, 0x32, 0x37, 0x20, 0x2d, 0x31, 0x1a, 0x26, 0x2a, 0x15, 0x1f, 0x25, 0x14, 0x1c, 0x1f, 0x12, 0x1b, 0x1f, 0x12, 0x1b, 0x20, 0x14, 0x1b, 0x1f, 0x15, 0x1e, 0x24, 0x1a, 0x25, 0x29, 0x4b, 0x64, 0x6d, 0x23, 0x32, 0x38, 0x20, 0x2e, 0x32, 0x1b, 0x27, 0x2b, 0x17, 0x22, 0x27, 0x16, 0x1e, 0x23, 0x14, 0x1e, 0x23, 0x16, 0x20, 0x24, 0x14, 0x1e, 0x22, 0x15, 0x1e, 0x22, 0x17, 0x21, 0x27, 0x1c, 0x27, 0x2c, 0x4f, 0x6a, 0x75, 0x21, 0x2f, 0x33, 0x1d, 0x29, 0x2d, 0x19, 0x23, 0x2a, 0x18, 0x22, 0x27, 0x16, 0x21, 0x27, 0x18, 0x23, 0x29, 0x17, 0x21, 0x26, 0x19, 0x23, 0x29, 0x1c, 0x28, 0x2d, 0x21, 0x2e, 0x33, 0x54, 0x70, 0x7c, 0x23, 0x33, 0x38, 0x22, 0x30, 0x34, 0x1e, 0x2a, 0x2f, 0x1a, 0x26, 0x2d, 0x1a, 0x25, 0x2b, 0x19, 0x25, 0x2b, 0x1a, 0x26, 0x2d, 0x1a, 0x26, 0x2c, 0x18, 0x25, 0x2a, 0x1a, 0x24, 0x2a, 0x1a, 0x25, 0x2c, 0x1d, 0x2a, 0x2f, 0x22, 0x2f, 0x34, 0x59, 0x77, 0x82, 0x23, 0x33, 0x39, 0x22, 0x30, 0x35, 0x1f, 0x2c, 0x31, 0x1c, 0x28, 0x30, 0x1c, 0x28, 0x2e, 0x1b, 0x29, 0x2f, 0x1c, 0x2a, 0x31, 0x1b, 0x28, 0x2f, 0x1c, 0x28, 0x2d, 0x1b, 0x27, 0x2f, 0x1f, 0x2b, 0x31, 0x5e, 0x7d, 0x8a, 0x24, 0x34, 0x39, 0x21, 0x2f, 0x37, 0x20, 0x2d, 0x34, 0x1d, 0x2b, 0x33, 0x1d, 0x2b, 0x32, 0x1d, 0x2d, 0x35, 0x1e, 0x2e, 0x36, 0x1f, 0x2e, 0x36, 0x1d, 0x2b, 0x34, 0x1d, 0x2b, 0x31, 0x1d, 0x2b, 0x32, 0x20, 0x2d, 0x32, 0x21, 0x2f, 0x36, 0x63, 0x83, 0x90, 0x25, 0x34, 0x39, 0x21, 0x31, 0x36, 0x1f, 0x2e, 0x34, 0x1f, 0x2e, 0x34, 0x1f, 0x2e, 0x36, 0x20, 0x31, 0x39, 0x21, 0x33, 0x3b, 0x21, 0x32, 0x3b, 0x1f, 0x30, 0x37, 0x1f, 0x2e, 0x35, 0x1e, 0x2d, 0x33, 0x1f, 0x2d, 0x33, 0x21, 0x30, 0x36, 0x67, 0x8a, 0x97, 0x24, 0x33, 0x39, 0x20, 0x30, 0x36, 0x1f, 0x2f, 0x35, 0x21, 0x30, 0x37, 0x22, 0x32, 0x39, 0x21, 0x35, 0x3e, 0x24, 0x37, 0x41, 0x24, 0x36, 0x41, 0x21, 0x33, 0x3c, 0x21, 0x31, 0x38, 0x1e, 0x2f, 0x35, 0x1e, 0x2e, 0x35, 0x20, 0x2e, 0x35, 0x24, 0x31, 0x39, 0x6c, 0x90, 0x9e, 0x22, 0x30, 0x36, 0x1f, 0x2e, 0x36, 0x20, 0x30, 0x36, 0x20, 0x31, 0x39, 0x23, 0x34, 0x3d, 0x23, 0x37, 0x41, 0x26, 0x3c, 0x47, 0x26, 0x3b, 0x46, 0x22, 0x35, 0x3f, 0x22, 0x32, 0x3b, 0x1f, 0x30, 0x37, 0x1f, 0x2e, 0x35, 0x1f, 0x2d, 0x35, 0x21, 0x30, 0x36, 0x72, 0x96, 0xa5, 0x7e, 0x8c, 0xc3, 0xb0, 0x0, 0x0, 0x0, 0xaa, 0x74, 0x52, 0x4e, 0x53, 0xc3, 0xc3, 0xe6, 0xd7, 0xcb, 0xc3, 0xbf, 0xbe, 0xbd, 0xe5, 0xc3, 0xd7, 0xc0, 0xac, 0xa0, 0x9a, 0x98, 0x98, 0x98, 0xc3, 0xcb, 0xac, 0x92, 0x82, 0x7b, 0x78, 0x78, 0x7b, 0x82, 0xac, 0xcb, 0xc3, 0xc3, 0xa0, 0x82, 0x6f, 0x67, 0x64, 0x63, 0x64, 0x67, 0x82, 0xc3, 0xbf, 0x9a, 0x7a, 0x67, 0x5e, 0x5b, 0x5a, 0x5e, 0xc3, 0xbd, 0x98, 0x78, 0x64, 0x5b, 0x57, 0x57, 0x5b, 0x64, 0x78, 0xc3, 0xbd, 0x98, 0x78, 0x63, 0x5a, 0x57, 0x56, 0x57, 0x5a, 0x63, 0x77, 0xc3, 0x98, 0x78, 0x63, 0x5a, 0x57, 0x56, 0x5a, 0x63, 0x77, 0x98, 0xc3, 0xbd, 0x98, 0x78, 0x63, 0x5a, 0x57, 0x56, 0x56, 0x57, 0x5a, 0x63, 0x77, 0x98, 0xc3, 0xbd, 0x98, 0x77, 0x63, 0x5a, 0x57, 0x56, 0x57, 0x5a, 0x63, 0x77, 0xc3, 0xbb, 0x96, 0x76, 0x63, 0x5a, 0x57, 0x56, 0x56, 0x57, 0x5a, 0x63, 0x76, 0x96, 0xc3, 0xb5, 0x92, 0x75, 0x62, 0x5a, 0x57, 0x56, 0x56, 0x57, 0x59, 0x62, 0x74, 0x92, 0xc3, 0xa9, 0x8b, 0x71, 0x61, 0x59, 0x57, 0x56, 0x56, 0x57, 0x59, 0x61, 0x71, 0x8b, 0xa9, 0xc3, 0x95, 0x7e, 0x6b, 0x5e, 0x59, 0x57, 0x56, 0x56, 0x57, 0x59, 0x5e, 0x6b, 0x7e, 0x95, 0xc3, 0x4f, 0x78, 0x99, 0x30, 0x0, 0x0, 0x0, 0x67, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x5c, 0x8b, 0x5, 0x2, 0xc3, 0x30, 0xc, 0xc4, 0x72, 0x5d, 0x39, 0xf4, 0xff, 0x67, 0x8e, 0x79, 0x1a, 0x37, 0xa0, 0xa0, 0x6d, 0x5d, 0x6b, 0x2a, 0x5a, 0xfd, 0x30, 0xe6, 0x1, 0xf4, 0xa7, 0x76, 0xfa, 0x37, 0x74, 0x7, 0x98, 0x52, 0x83, 0x46, 0x97, 0x41, 0xfb, 0xd6, 0x2d, 0x86, 0xae, 0xfe, 0x84, 0x6b, 0x6d, 0x32, 0x6e, 0x58, 0x28, 0x22, 0x3a, 0x41, 0x32, 0xde, 0xd7, 0x6a, 0x67, 0x5b, 0xb7, 0xb7, 0xc9, 0xb0, 0xd8, 0xd6, 0x3a, 0x65, 0x34, 0xb4, 0x21, 0x8f, 0x1c, 0x3, 0x6d, 0x21, 0x84, 0x5d, 0x32, 0x8a, 0x48, 0x22, 0x6e, 0xda, 0xa8, 0x92, 0x36, 0x3e, 0x87, 0xea, 0x7b, 0x7e, 0x0, 0x62, 0xa8, 0x25, 0xad, 0x68, 0x1d, 0x7d, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
diff --git a/scene/resources/default_theme/toggle_off_disabled.png b/scene/resources/default_theme/toggle_off_disabled.png
new file mode 100644
index 0000000000..d65a9d8e64
--- /dev/null
+++ b/scene/resources/default_theme/toggle_off_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/toggle_on_disabled.png b/scene/resources/default_theme/toggle_on_disabled.png
new file mode 100644
index 0000000000..ca4dbe211f
--- /dev/null
+++ b/scene/resources/default_theme/toggle_on_disabled.png
Binary files differ
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index fd7b67a218..8ee9879055 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -1008,7 +1008,7 @@ void DynamicFont::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_fallback_count"), &DynamicFont::get_fallback_count);
ADD_GROUP("Settings", "");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "size", PROPERTY_HINT_RANGE, "1,255,1"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_size", PROPERTY_HINT_RANGE, "0,255,1"), "set_outline_size", "get_outline_size");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "outline_color"), "set_outline_color", "get_outline_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_mipmaps"), "set_use_mipmaps", "get_use_mipmaps");
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index c72ccc97db..128db3f109 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -96,6 +96,7 @@ void Font::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height);
ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint);
ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size);
+ ClassDB::bind_method(D_METHOD("get_wordwrap_string_size", "string", "p_width"), &Font::get_wordwrap_string_size);
ClassDB::bind_method(D_METHOD("has_outline"), &Font::has_outline);
ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate", "outline"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(false));
ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes);
@@ -495,6 +496,38 @@ Size2 Font::get_string_size(const String &p_string) const {
return Size2(w, get_height());
}
+
+Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) const {
+
+ ERR_FAIL_COND_V(p_width <= 0, Vector2(0, get_height()));
+
+ int l = p_string.length();
+ if (l == 0)
+ return Size2(p_width, get_height());
+
+ float line_w = 0;
+ float h = 0;
+ float space_w = get_char_size(' ').width;
+ Vector<String> lines = p_string.split("\n");
+ for (int i = 0; i < lines.size(); i++) {
+ h += get_height();
+ String t = lines[i];
+ line_w = 0;
+ Vector<String> words = t.split(" ");
+ for (int j = 0; j < words.size(); j++) {
+ line_w += get_string_size(words[j]).x;
+ if (line_w > p_width) {
+ h += get_height();
+ line_w = get_string_size(words[j]).x;
+ } else {
+ line_w += space_w;
+ }
+ }
+ }
+
+ return Size2(p_width, h);
+}
+
void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) {
ERR_FAIL_COND(p_fallback == this);
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 6bc8d9b792..def2c2285a 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -53,6 +53,7 @@ public:
virtual Size2 get_char_size(CharType p_char, CharType p_next = 0) const = 0;
Size2 get_string_size(const String &p_string) const;
+ Size2 get_wordwrap_string_size(const String &p_string, float p_width) const;
virtual bool is_distance_field_hint() const = 0;
diff --git a/scene/resources/height_map_shape.cpp b/scene/resources/height_map_shape.cpp
index 32e9c527ef..8cd271dab0 100644
--- a/scene/resources/height_map_shape.cpp
+++ b/scene/resources/height_map_shape.cpp
@@ -34,35 +34,43 @@
Vector<Vector3> HeightMapShape::_gen_debug_mesh_lines() {
Vector<Vector3> points;
- // This will be slow for large maps...
- // also we'll have to figure out how well bullet centers this shape...
+ if ((map_width != 0) && (map_depth != 0)) {
- Vector2 size(map_width - 1, map_depth - 1);
- Vector2 start = size * -0.5;
- int offset = 0;
+ // This will be slow for large maps...
+ // also we'll have to figure out how well bullet centers this shape...
- PoolRealArray::Read r = map_data.read();
+ Vector2 size(map_width - 1, map_depth - 1);
+ Vector2 start = size * -0.5;
- for (int d = 0; d < map_depth; d++) {
- Vector3 height(start.x, 0.0, start.y);
+ PoolRealArray::Read r = map_data.read();
- for (int w = 0; w < map_width; w++) {
- height.y = r[offset++];
+ // reserve some memory for our points..
+ points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2));
- if (w != map_width - 1) {
- points.push_back(height);
- points.push_back(Vector3(height.x + 1.0, r[offset], height.z));
- }
+ // now set our points
+ int r_offset = 0;
+ int w_offset = 0;
+ for (int d = 0; d < map_depth; d++) {
+ Vector3 height(start.x, 0.0, start.y);
+
+ for (int w = 0; w < map_width; w++) {
+ height.y = r[r_offset++];
+
+ if (w != map_width - 1) {
+ points.write[w_offset++] = height;
+ points.write[w_offset++] = Vector3(height.x + 1.0, r[r_offset], height.z);
+ }
- if (d != map_depth - 1) {
- points.push_back(height);
- points.push_back(Vector3(height.x, r[offset + map_width - 1], height.z + 1.0));
+ if (d != map_depth - 1) {
+ points.write[w_offset++] = height;
+ points.write[w_offset++] = Vector3(height.x, r[r_offset + map_width - 1], height.z + 1.0);
+ }
+
+ height.x += 1.0;
}
- height.x += 1.0;
+ start.y += 1.0;
}
-
- start.y += 1.0;
}
return points;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 536eb11a27..2e035bbd1f 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -30,6 +30,10 @@
#include "material.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_settings.h"
+#endif
+
#include "scene/scene_string_names.h"
void Material::set_next_pass(const Ref<Material> &p_pass) {
@@ -236,6 +240,12 @@ void ShaderMaterial::_bind_methods() {
void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
+#ifdef TOOLS_ENABLED
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
+#else
+ const String quote_style = "\"";
+#endif
+
String f = p_function.operator String();
if ((f == "get_shader_param" || f == "set_shader_param") && p_idx == 0) {
@@ -243,7 +253,7 @@ void ShaderMaterial::get_argument_options(const StringName &p_function, int p_id
List<PropertyInfo> pl;
shader->get_param_list(&pl);
for (List<PropertyInfo>::Element *E = pl.front(); E; E = E->next()) {
- r_options->push_back("\"" + E->get().name.replace_first("shader_param/", "") + "\"");
+ r_options->push_back(quote_style + E->get().name.replace_first("shader_param/", "") + quote_style);
}
}
}
@@ -458,6 +468,9 @@ void SpatialMaterial::_update_shader() {
if (flags[FLAG_ENSURE_CORRECT_NORMALS]) {
code += ",ensure_correct_normals";
}
+ if (flags[FLAG_USE_SHADOW_TO_OPACITY]) {
+ code += ",shadow_to_opacity";
+ }
code += ";\n";
code += "uniform vec4 albedo : hint_color;\n";
@@ -839,7 +852,7 @@ void SpatialMaterial::_update_shader() {
code += "\tALBEDO *= 1.0 - ref_amount;\n";
code += "\tALPHA = 1.0;\n";
- } else if (features[FEATURE_TRANSPARENT] || flags[FLAG_USE_ALPHA_SCISSOR] || (distance_fade == DISTANCE_FADE_PIXEL_ALPHA) || proximity_fade_enabled) {
+ } else if (features[FEATURE_TRANSPARENT] || flags[FLAG_USE_ALPHA_SCISSOR] || flags[FLAG_USE_SHADOW_TO_OPACITY] || (distance_fade == DISTANCE_FADE_PIXEL_ALPHA) || proximity_fade_enabled) {
code += "\tALPHA = albedo.a * albedo_tex.a;\n";
}
@@ -1339,7 +1352,7 @@ void SpatialMaterial::set_flag(Flags p_flag, bool p_enabled) {
return;
flags[p_flag] = p_enabled;
- if (p_flag == FLAG_USE_ALPHA_SCISSOR || p_flag == FLAG_UNSHADED) {
+ if ((p_flag == FLAG_USE_ALPHA_SCISSOR) || (p_flag == FLAG_UNSHADED) || (p_flag == FLAG_USE_SHADOW_TO_OPACITY)) {
_change_notify();
}
_queue_shader_change();
@@ -2050,6 +2063,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Flags", "flags_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_transparent"), "set_feature", "get_feature", FEATURE_TRANSPARENT);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_use_shadow_to_opacity"), "set_flag", "get_flag", FLAG_USE_SHADOW_TO_OPACITY);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_unshaded"), "set_flag", "get_flag", FLAG_UNSHADED);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_vertex_lighting"), "set_flag", "get_flag", FLAG_USE_VERTEX_LIGHTING);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_no_depth_test"), "set_flag", "get_flag", FLAG_DISABLE_DEPTH_TEST);
@@ -2256,6 +2270,7 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(FLAG_DONT_RECEIVE_SHADOWS);
BIND_ENUM_CONSTANT(FLAG_DISABLE_AMBIENT_LIGHT);
BIND_ENUM_CONSTANT(FLAG_ENSURE_CORRECT_NORMALS);
+ BIND_ENUM_CONSTANT(FLAG_USE_SHADOW_TO_OPACITY);
BIND_ENUM_CONSTANT(FLAG_MAX);
BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 1f7fc267af..29b45f769b 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -196,6 +196,7 @@ public:
FLAG_DONT_RECEIVE_SHADOWS,
FLAG_ENSURE_CORRECT_NORMALS,
FLAG_DISABLE_AMBIENT_LIGHT,
+ FLAG_USE_SHADOW_TO_OPACITY,
FLAG_MAX
};
diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp
index be0b9f9ac3..5d8adc0c8d 100644
--- a/scene/resources/multimesh.cpp
+++ b/scene/resources/multimesh.cpp
@@ -32,6 +32,8 @@
#include "servers/visual_server.h"
void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) {
+ if (transform_format != TRANSFORM_3D)
+ return;
PoolVector<Vector3> xforms = p_array;
int len = xforms.size();
@@ -55,6 +57,9 @@ void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) {
PoolVector<Vector3> MultiMesh::_get_transform_array() const {
+ if (transform_format != TRANSFORM_3D)
+ return PoolVector<Vector3>();
+
if (instance_count == 0)
return PoolVector<Vector3>();
@@ -75,6 +80,54 @@ PoolVector<Vector3> MultiMesh::_get_transform_array() const {
return xforms;
}
+void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) {
+
+ if (transform_format != TRANSFORM_2D)
+ return;
+
+ PoolVector<Vector2> xforms = p_array;
+ int len = xforms.size();
+ ERR_FAIL_COND((len / 3) != instance_count);
+ if (len == 0)
+ return;
+
+ PoolVector<Vector2>::Read r = xforms.read();
+
+ for (int i = 0; i < len / 3; i++) {
+
+ Transform2D t;
+ t.elements[0] = r[i * 3 + 0];
+ t.elements[1] = r[i * 3 + 1];
+ t.elements[2] = r[i * 3 + 2];
+
+ set_instance_transform_2d(i, t);
+ }
+}
+
+PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const {
+
+ if (transform_format != TRANSFORM_2D)
+ return PoolVector<Vector2>();
+
+ if (instance_count == 0)
+ return PoolVector<Vector2>();
+
+ PoolVector<Vector2> xforms;
+ xforms.resize(instance_count * 3);
+
+ PoolVector<Vector2>::Write w = xforms.write();
+
+ for (int i = 0; i < instance_count; i++) {
+
+ Transform2D t = get_instance_transform_2d(i);
+ w[i * 3 + 0] = t.elements[0];
+ w[i * 3 + 1] = t.elements[1];
+ w[i * 3 + 2] = t.elements[2];
+ }
+
+ return xforms;
+}
+
void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) {
PoolVector<Color> colors = p_array;
@@ -210,6 +263,11 @@ Color MultiMesh::get_instance_custom_data(int p_instance) const {
return VisualServer::get_singleton()->multimesh_instance_get_custom_data(multimesh, p_instance);
}
+void MultiMesh::set_as_bulk_array(const PoolVector<float> &p_array) {
+
+ VisualServer::get_singleton()->multimesh_set_as_bulk_array(multimesh, p_array);
+}
+
AABB MultiMesh::get_aabb() const {
return VisualServer::get_singleton()->multimesh_get_aabb(multimesh);
@@ -275,10 +333,13 @@ void MultiMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_instance_color", "instance"), &MultiMesh::get_instance_color);
ClassDB::bind_method(D_METHOD("set_instance_custom_data", "instance", "custom_data"), &MultiMesh::set_instance_custom_data);
ClassDB::bind_method(D_METHOD("get_instance_custom_data", "instance"), &MultiMesh::get_instance_custom_data);
+ ClassDB::bind_method(D_METHOD("set_as_bulk_array", "array"), &MultiMesh::set_as_bulk_array);
ClassDB::bind_method(D_METHOD("get_aabb"), &MultiMesh::get_aabb);
ClassDB::bind_method(D_METHOD("_set_transform_array"), &MultiMesh::_set_transform_array);
ClassDB::bind_method(D_METHOD("_get_transform_array"), &MultiMesh::_get_transform_array);
+ ClassDB::bind_method(D_METHOD("_set_transform_2d_array"), &MultiMesh::_set_transform_2d_array);
+ ClassDB::bind_method(D_METHOD("_get_transform_2d_array"), &MultiMesh::_get_transform_2d_array);
ClassDB::bind_method(D_METHOD("_set_color_array"), &MultiMesh::_set_color_array);
ClassDB::bind_method(D_METHOD("_get_color_array"), &MultiMesh::_get_color_array);
ClassDB::bind_method(D_METHOD("_set_custom_data_array"), &MultiMesh::_set_custom_data_array);
@@ -291,6 +352,7 @@ void MultiMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_instance_count", PROPERTY_HINT_RANGE, "-1,16384,1,or_greater"), "set_visible_instance_count", "get_visible_instance_count");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_transform_array", "_get_transform_array");
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "transform_2d_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_transform_2d_array", "_get_transform_2d_array");
ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_color_array", "_get_color_array");
ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_custom_data_array", "_get_custom_data_array");
diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h
index 24b4beaa89..6b17e9278d 100644
--- a/scene/resources/multimesh.h
+++ b/scene/resources/multimesh.h
@@ -72,6 +72,9 @@ protected:
void _set_transform_array(const PoolVector<Vector3> &p_array);
PoolVector<Vector3> _get_transform_array() const;
+ void _set_transform_2d_array(const PoolVector<Vector2> &p_array);
+ PoolVector<Vector2> _get_transform_2d_array() const;
+
void _set_color_array(const PoolVector<Color> &p_array);
PoolVector<Color> _get_color_array() const;
@@ -108,6 +111,8 @@ public:
void set_instance_custom_data(int p_instance, const Color &p_custom_data);
Color get_instance_custom_data(int p_instance) const;
+ void set_as_bulk_array(const PoolVector<float> &p_array);
+
virtual AABB get_aabb() const;
virtual RID get_rid() const;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index e9f90fc85f..6e7bb27e74 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -447,9 +447,8 @@ Error ResourceInteractiveLoaderText::poll() {
resource_cache.push_back(res);
#ifdef TOOLS_ENABLED
//remember ID for saving
- res->set_id_for_path(local_path,index);
+ res->set_id_for_path(local_path, index);
#endif
-
}
ExtResource er;
@@ -1545,9 +1544,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
}
{
-
-
-
}
#ifdef TOOLS_ENABLED
@@ -1569,7 +1565,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
}
int attempt = 1; //start from one, more readable format
- while(cached_ids_found.has(attempt)) {
+ while (cached_ids_found.has(attempt)) {
attempt++;
}
@@ -1577,7 +1573,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
E->get() = attempt;
//update also in resource
Ref<Resource> res = E->key();
- res->set_id_for_path(local_path,attempt);
+ res->set_id_for_path(local_path, attempt);
}
#else
//make sure to start from one, as it makes format more readable
@@ -1598,7 +1594,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
sorted_er.sort();
-
for (int i = 0; i < sorted_er.size(); i++) {
String p = sorted_er[i].resource->get_path();
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index ab6f94986c..06c841229b 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -172,10 +172,9 @@ class ResourceFormatSaverTextInstance {
struct ResourceSort {
RES resource;
int index;
- bool operator<(const ResourceSort& p_right) const {
+ bool operator<(const ResourceSort &p_right) const {
return index < p_right.index;
}
-
};
void _find_resources(const Variant &p_variant, bool p_main = false);
diff --git a/scene/resources/sky.cpp b/scene/resources/sky.cpp
index 48945d4e63..292fdcdbd2 100644
--- a/scene/resources/sky.cpp
+++ b/scene/resources/sky.cpp
@@ -62,7 +62,7 @@ void Sky::_bind_methods() {
}
Sky::Sky() {
- radiance_size = RADIANCE_SIZE_512;
+ radiance_size = RADIANCE_SIZE_128;
}
/////////////////////////////////////////
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 3ba43006a3..8c0497e91a 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -115,7 +115,7 @@ void SurfaceTool::add_vertex(const Vector3 &p_vertex) {
//ensure vertices are the expected amount
ERR_FAIL_COND(vtx.weights.size() != vtx.bones.size());
if (vtx.weights.size() < expected_vertices) {
- //less than requred, fill
+ //less than required, fill
for (int i = vtx.weights.size(); i < expected_vertices; i++) {
vtx.weights.push_back(0);
vtx.bones.push_back(0);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index a5eb950c36..92172912c2 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -111,10 +111,12 @@ void ImageTexture::reload_from_file() {
Ref<Image> img;
img.instance();
- Error err = ImageLoader::load_image(path, img);
- ERR_FAIL_COND(err != OK);
-
- create_from_image(img, flags);
+ if (ImageLoader::load_image(path, img) == OK) {
+ create_from_image(img, flags);
+ } else {
+ Resource::reload_from_file();
+ _change_notify();
+ }
}
bool ImageTexture::_set(const StringName &p_name, const Variant &p_value) {
@@ -638,7 +640,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
bool mipmaps = df & FORMAT_BIT_HAS_MIPMAPS;
if (!mipmaps) {
- int size = Image::get_image_data_size(tw, th, format, 0);
+ int size = Image::get_image_data_size(tw, th, format, false);
PoolVector<uint8_t> img_data;
img_data.resize(size);
@@ -660,7 +662,6 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
int mipmaps2 = Image::get_image_required_mipmaps(tw, th, format);
int total_size = Image::get_image_data_size(tw, th, format, true);
int idx = 0;
- int ofs = 0;
while (mipmaps2 > 1 && p_size_limit > 0 && (sw > p_size_limit || sh > p_size_limit)) {
@@ -670,9 +671,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
idx++;
}
- if (idx > 0) {
- ofs = Image::get_image_data_size(tw, th, format, idx - 1);
- }
+ int ofs = Image::get_image_mipmap_offset(tw, th, format, idx);
if (total_size - ofs <= 0) {
memdelete(f);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 21b2893502..5b5968c10f 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -600,6 +600,8 @@ Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask,
}
List<Vector2> coords;
+ List<uint32_t> priorities;
+ uint32_t priority_sum = 0;
uint32_t mask;
uint16_t mask_;
uint16_t mask_ignore;
@@ -613,16 +615,34 @@ Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask,
mask_ignore = mask >> 16;
if (((mask_ & (~mask_ignore)) == (p_bitmask & (~mask_ignore))) && (((~mask_) | mask_ignore) == ((~p_bitmask) | mask_ignore))) {
- for (int i = 0; i < autotile_get_subtile_priority(p_id, E->key()); i++) {
- coords.push_back(E->key());
- }
+ uint32_t priority = autotile_get_subtile_priority(p_id, E->key());
+ priority_sum += priority;
+ priorities.push_back(priority);
+ coords.push_back(E->key());
}
}
if (coords.size() == 0) {
return autotile_get_icon_coordinate(p_id);
} else {
- return coords[Math::rand() % coords.size()];
+ uint32_t picked_value = Math::rand() % priority_sum;
+ uint32_t upper_bound;
+ uint32_t lower_bound = 0;
+ Vector2 result = coords.front()->get();
+ List<Vector2>::Element *coords_E = coords.front();
+ List<uint32_t>::Element *priorities_E = priorities.front();
+ while (priorities_E) {
+ upper_bound = lower_bound + priorities_E->get();
+ if (lower_bound <= picked_value && picked_value < upper_bound) {
+ result = coords_E->get();
+ break;
+ }
+ lower_bound = upper_bound;
+ priorities_E = priorities_E->next();
+ coords_E = coords_E->next();
+ }
+
+ return result;
}
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index b8f21948c3..9b2e410985 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "visual_shader.h"
+
#include "core/vmap.h"
#include "servers/visual/shader_types.h"
@@ -159,6 +160,7 @@ Vector2 VisualShader::get_node_position(Type p_type, int p_id) const {
ERR_FAIL_COND_V(!g->nodes.has(p_id), Vector2());
return g->nodes[p_id].position;
}
+
Ref<VisualShaderNode> VisualShader::get_node(Type p_type, int p_id) const {
ERR_FAIL_INDEX_V(p_type, TYPE_MAX, Ref<VisualShaderNode>());
const Graph *g = &graph[p_type];
@@ -269,6 +271,18 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po
return true;
}
+void VisualShader::connect_nodes_forced(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
+ ERR_FAIL_INDEX(p_type, TYPE_MAX);
+ Graph *g = &graph[p_type];
+ Connection c;
+ c.from_node = p_from_node;
+ c.from_port = p_from_port;
+ c.to_node = p_to_node;
+ c.to_port = p_to_port;
+ g->connections.push_back(c);
+ _queue_update();
+}
+
Error VisualShader::connect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
ERR_FAIL_INDEX_V(p_type, TYPE_MAX, ERR_CANT_CONNECT);
Graph *g = &graph[p_type];
@@ -304,6 +318,7 @@ Error VisualShader::connect_nodes(Type p_type, int p_from_node, int p_from_port,
_queue_update();
return OK;
}
+
void VisualShader::disconnect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
ERR_FAIL_INDEX(p_type, TYPE_MAX);
Graph *g = &graph[p_type];
@@ -334,6 +349,7 @@ Array VisualShader::_get_node_connections(Type p_type) const {
return ret;
}
+
void VisualShader::get_node_connections(Type p_type, List<Connection> *r_connections) const {
ERR_FAIL_INDEX(p_type, TYPE_MAX);
const Graph *g = &graph[p_type];
@@ -477,6 +493,54 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
#define IS_SYMBOL_CHAR(m_d) (((m_d) >= 'a' && (m_d) <= 'z') || ((m_d) >= 'A' && (m_d) <= 'Z') || ((m_d) >= '0' && (m_d) <= '9') || (m_d) == '_')
+String VisualShader::validate_port_name(const String &p_name, const List<String> &p_input_ports, const List<String> &p_output_ports) const {
+ String name = p_name;
+
+ while (name.length() && !IS_INITIAL_CHAR(name[0])) {
+ name = name.substr(1, name.length() - 1);
+ }
+
+ if (name != String()) {
+
+ String valid_name;
+
+ for (int i = 0; i < name.length(); i++) {
+ if (IS_SYMBOL_CHAR(name[i])) {
+ valid_name += String::chr(name[i]);
+ } else if (name[i] == ' ') {
+ valid_name += "_";
+ }
+ }
+
+ name = valid_name;
+ }
+
+ String valid_name = name;
+ bool is_equal = false;
+
+ for (int i = 0; i < p_input_ports.size(); i++) {
+ if (name == p_input_ports[i]) {
+ is_equal = true;
+ break;
+ }
+ }
+
+ if (!is_equal) {
+ for (int i = 0; i < p_output_ports.size(); i++) {
+ if (name == p_output_ports[i]) {
+ is_equal = true;
+ break;
+ }
+ }
+ }
+
+ if (is_equal) {
+ name = "";
+ }
+
+ return name;
+}
+
String VisualShader::validate_uniform_name(const String &p_name, const Ref<VisualShaderNodeUniform> &p_uniform) const {
String name = p_name; //validate name first
@@ -596,7 +660,7 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
Vector<int> conns = p_value;
if (conns.size() % 4 == 0) {
for (int i = 0; i < conns.size(); i += 4) {
- connect_nodes(type, conns[i + 0], conns[i + 1], conns[i + 2], conns[i + 3]);
+ connect_nodes_forced(type, conns[i + 0], conns[i + 1], conns[i + 2], conns[i + 3]);
}
}
return true;
@@ -611,6 +675,18 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
} else if (what == "position") {
set_node_position(type, id, p_value);
return true;
+ } else if (what == "size") {
+ ((VisualShaderNodeGroupBase *)get_node(type, id).ptr())->set_size(p_value);
+ return true;
+ } else if (what == "input_ports") {
+ ((VisualShaderNodeGroupBase *)get_node(type, id).ptr())->set_inputs(p_value);
+ return true;
+ } else if (what == "output_ports") {
+ ((VisualShaderNodeGroupBase *)get_node(type, id).ptr())->set_outputs(p_value);
+ return true;
+ } else if (what == "expression") {
+ ((VisualShaderNodeExpression *)get_node(type, id).ptr())->set_expression(p_value);
+ return true;
}
}
return false;
@@ -668,6 +744,18 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
} else if (what == "position") {
r_ret = get_node_position(type, id);
return true;
+ } else if (what == "size") {
+ r_ret = ((VisualShaderNodeGroupBase *)get_node(type, id).ptr())->get_size();
+ return true;
+ } else if (what == "input_ports") {
+ r_ret = ((VisualShaderNodeGroupBase *)get_node(type, id).ptr())->get_inputs();
+ return true;
+ } else if (what == "output_ports") {
+ r_ret = ((VisualShaderNodeGroupBase *)get_node(type, id).ptr())->get_outputs();
+ return true;
+ } else if (what == "expression") {
+ r_ret = ((VisualShaderNodeExpression *)get_node(type, id).ptr())->get_expression();
+ return true;
}
}
return false;
@@ -727,6 +815,15 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
}
p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+
+ if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != NULL) {
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/input_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/output_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ }
+ if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != NULL) {
+ p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ }
}
p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "nodes/" + String(type_string[i]) + "/connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
@@ -993,26 +1090,33 @@ void VisualShader::_input_type_changed(Type p_type, int p_id) {
}
}
+void VisualShader::rebuild() {
+ dirty = true;
+ _update_shader();
+}
+
void VisualShader::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &VisualShader::set_mode);
ClassDB::bind_method(D_METHOD("add_node", "type", "node", "position", "id"), &VisualShader::add_node);
- ClassDB::bind_method(D_METHOD("set_node_position", "type", "id", "position"), &VisualShader::set_node_position);
-
ClassDB::bind_method(D_METHOD("get_node", "type", "id"), &VisualShader::get_node);
+
+ ClassDB::bind_method(D_METHOD("set_node_position", "type", "id", "position"), &VisualShader::set_node_position);
ClassDB::bind_method(D_METHOD("get_node_position", "type", "id"), &VisualShader::get_node_position);
ClassDB::bind_method(D_METHOD("get_node_list", "type"), &VisualShader::get_node_list);
ClassDB::bind_method(D_METHOD("get_valid_node_id", "type"), &VisualShader::get_valid_node_id);
ClassDB::bind_method(D_METHOD("remove_node", "type", "id"), &VisualShader::remove_node);
+ ClassDB::bind_method(D_METHOD("rebuild"), &VisualShader::rebuild);
ClassDB::bind_method(D_METHOD("is_node_connection", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection);
ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection);
ClassDB::bind_method(D_METHOD("connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::connect_nodes);
ClassDB::bind_method(D_METHOD("disconnect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::disconnect_nodes);
+ ClassDB::bind_method(D_METHOD("connect_nodes_forced", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::connect_nodes_forced);
ClassDB::bind_method(D_METHOD("get_node_connections", "type"), &VisualShader::_get_node_connections);
@@ -1627,3 +1731,555 @@ void VisualShaderNodeUniform::_bind_methods() {
VisualShaderNodeUniform::VisualShaderNodeUniform() {
}
+
+////////////// GroupBase
+
+String VisualShaderNodeGroupBase::get_caption() const {
+ return "Group";
+}
+
+void VisualShaderNodeGroupBase::set_size(const Vector2 &p_size) {
+ size = p_size;
+}
+
+Vector2 VisualShaderNodeGroupBase::get_size() const {
+ return size;
+}
+
+void VisualShaderNodeGroupBase::set_inputs(const String &p_inputs) {
+
+ if (inputs == p_inputs)
+ return;
+
+ clear_input_ports();
+
+ inputs = p_inputs;
+
+ Vector<String> input_strings = inputs.split(";", false);
+
+ int input_port_count = input_strings.size();
+
+ for (int i = 0; i < input_port_count; i++) {
+
+ Vector<String> arr = input_strings[i].split(",");
+
+ int port_idx = arr[0].to_int();
+ int port_type = arr[1].to_int();
+ String port_name = arr[2];
+
+ Port port;
+ port.type = (PortType)port_type;
+ port.name = port_name;
+ input_ports[port_idx] = port;
+ }
+}
+
+String VisualShaderNodeGroupBase::get_inputs() const {
+ return inputs;
+}
+
+void VisualShaderNodeGroupBase::set_outputs(const String &p_outputs) {
+
+ if (outputs == p_outputs)
+ return;
+
+ clear_output_ports();
+
+ outputs = p_outputs;
+
+ Vector<String> output_strings = outputs.split(";", false);
+
+ int output_port_count = output_strings.size();
+
+ for (int i = 0; i < output_port_count; i++) {
+
+ Vector<String> arr = output_strings[i].split(",");
+
+ int port_idx = arr[0].to_int();
+ int port_type = arr[1].to_int();
+ String port_name = arr[2];
+
+ Port port;
+ port.type = (PortType)port_type;
+ port.name = port_name;
+ output_ports[port_idx] = port;
+ }
+}
+
+String VisualShaderNodeGroupBase::get_outputs() const {
+ return outputs;
+}
+
+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 + ";";
+ Vector<String> inputs_strings = inputs.split(";", false);
+ int index = 0;
+ if (p_id < inputs_strings.size()) {
+ for (int i = 0; i < inputs_strings.size(); i++) {
+ if (i == p_id) {
+ inputs = inputs.insert(index, str);
+ break;
+ }
+ index += inputs_strings[i].size();
+ }
+ } else {
+ inputs += str;
+ }
+
+ inputs_strings = inputs.split(";", false);
+ index = 0;
+
+ for (int i = 0; i < inputs_strings.size(); i++) {
+ int count = 0;
+ for (int j = 0; j < inputs_strings[i].size(); j++) {
+ if (inputs_strings[i][j] == ',') {
+ break;
+ }
+ count++;
+ }
+
+ inputs.erase(index, count);
+ inputs = inputs.insert(index, itos(i));
+ index += inputs_strings[i].size();
+ }
+
+ _apply_port_changes();
+}
+
+void VisualShaderNodeGroupBase::remove_input_port(int p_id) {
+
+ Vector<String> inputs_strings = inputs.split(";", false);
+ int count = 0;
+ int index = 0;
+ for (int i = 0; i < inputs_strings.size(); i++) {
+ Vector<String> arr = inputs_strings[i].split(",");
+ if (arr[0].to_int() == p_id) {
+ count = inputs_strings[i].size();
+ break;
+ }
+ index += inputs_strings[i].size();
+ }
+ inputs.erase(index, count);
+
+ inputs_strings = inputs.split(";", false);
+ for (int i = p_id; i < inputs_strings.size(); i++) {
+ inputs = inputs.replace_first(inputs_strings[i].split(",")[0], itos(i));
+ }
+
+ _apply_port_changes();
+}
+
+int VisualShaderNodeGroupBase::get_input_port_count() const {
+ return input_ports.size();
+}
+
+bool VisualShaderNodeGroupBase::has_input_port(int p_id) const {
+ return input_ports.has(p_id);
+}
+
+void VisualShaderNodeGroupBase::add_output_port(int p_id, int p_type, const String &p_name) {
+
+ String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
+ Vector<String> outputs_strings = outputs.split(";", false);
+ int index = 0;
+ if (p_id < outputs_strings.size()) {
+ for (int i = 0; i < outputs_strings.size(); i++) {
+ if (i == p_id) {
+ outputs = outputs.insert(index, str);
+ break;
+ }
+ index += outputs_strings[i].size();
+ }
+ } else {
+ outputs += str;
+ }
+
+ outputs_strings = outputs.split(";", false);
+ index = 0;
+
+ for (int i = 0; i < outputs_strings.size(); i++) {
+ int count = 0;
+ for (int j = 0; j < outputs_strings[i].size(); j++) {
+ if (outputs_strings[i][j] == ',') {
+ break;
+ }
+ count++;
+ }
+
+ outputs.erase(index, count);
+ outputs = outputs.insert(index, itos(i));
+ index += outputs_strings[i].size();
+ }
+
+ _apply_port_changes();
+}
+
+void VisualShaderNodeGroupBase::remove_output_port(int p_id) {
+
+ Vector<String> outputs_strings = outputs.split(";", false);
+ int count = 0;
+ int index = 0;
+ for (int i = 0; i < outputs_strings.size(); i++) {
+ Vector<String> arr = outputs_strings[i].split(",");
+ if (arr[0].to_int() == p_id) {
+ count = outputs_strings[i].size();
+ break;
+ }
+ index += outputs_strings[i].size();
+ }
+ outputs.erase(index, count);
+
+ outputs_strings = outputs.split(";", false);
+ for (int i = p_id; i < outputs_strings.size(); i++) {
+ outputs = outputs.replace_first(outputs_strings[i].split(",")[0], itos(i));
+ }
+
+ _apply_port_changes();
+}
+
+int VisualShaderNodeGroupBase::get_output_port_count() const {
+ return output_ports.size();
+}
+
+bool VisualShaderNodeGroupBase::has_output_port(int p_id) const {
+ return output_ports.has(p_id);
+}
+
+void VisualShaderNodeGroupBase::clear_input_ports() {
+ input_ports.clear();
+}
+
+void VisualShaderNodeGroupBase::clear_output_ports() {
+ output_ports.clear();
+}
+
+void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
+
+ if (input_ports[p_id].type == p_type)
+ return;
+
+ Vector<String> inputs_strings = inputs.split(";", false);
+ int count = 0;
+ int index = 0;
+ for (int i = 0; i < inputs_strings.size(); i++) {
+ Vector<String> arr = inputs_strings[i].split(",");
+ if (arr[0].to_int() == p_id) {
+ index += arr[0].size();
+ count = arr[1].size() - 1;
+ break;
+ }
+ index += inputs_strings[i].size();
+ }
+
+ inputs.erase(index, count);
+
+ inputs = inputs.insert(index, itos(p_type));
+
+ _apply_port_changes();
+}
+
+VisualShaderNodeGroupBase::PortType VisualShaderNodeGroupBase::get_input_port_type(int p_id) const {
+ ERR_FAIL_COND_V(!input_ports.has(p_id), (PortType)0);
+ return input_ports[p_id].type;
+}
+
+void VisualShaderNodeGroupBase::set_input_port_name(int p_id, const String &p_name) {
+
+ if (input_ports[p_id].name == p_name)
+ return;
+
+ Vector<String> inputs_strings = inputs.split(";", false);
+ int count = 0;
+ int index = 0;
+ for (int i = 0; i < inputs_strings.size(); i++) {
+ Vector<String> arr = inputs_strings[i].split(",");
+ if (arr[0].to_int() == p_id) {
+ index += arr[0].size() + arr[1].size();
+ count = arr[2].size() - 1;
+ break;
+ }
+ index += inputs_strings[i].size();
+ }
+
+ inputs.erase(index, count);
+
+ inputs = inputs.insert(index, p_name);
+
+ _apply_port_changes();
+}
+
+String VisualShaderNodeGroupBase::get_input_port_name(int p_id) const {
+ ERR_FAIL_COND_V(!input_ports.has(p_id), "");
+ return input_ports[p_id].name;
+}
+
+void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
+
+ if (output_ports[p_id].type == p_type)
+ return;
+
+ Vector<String> output_strings = outputs.split(";", false);
+ int count = 0;
+ int index = 0;
+ for (int i = 0; i < output_strings.size(); i++) {
+ Vector<String> arr = output_strings[i].split(",");
+ if (arr[0].to_int() == p_id) {
+ index += arr[0].size();
+ count = arr[1].size() - 1;
+ break;
+ }
+ index += output_strings[i].size();
+ }
+
+ outputs.erase(index, count);
+
+ outputs = outputs.insert(index, itos(p_type));
+
+ _apply_port_changes();
+}
+
+VisualShaderNodeGroupBase::PortType VisualShaderNodeGroupBase::get_output_port_type(int p_id) const {
+ ERR_FAIL_COND_V(!output_ports.has(p_id), (PortType)0);
+ return output_ports[p_id].type;
+}
+
+void VisualShaderNodeGroupBase::set_output_port_name(int p_id, const String &p_name) {
+ if (output_ports[p_id].name == p_name)
+ return;
+
+ Vector<String> output_strings = outputs.split(";", false);
+ int count = 0;
+ int index = 0;
+ for (int i = 0; i < output_strings.size(); i++) {
+ Vector<String> arr = output_strings[i].split(",");
+ if (arr[0].to_int() == p_id) {
+ index += arr[0].size() + arr[1].size();
+ count = arr[2].size() - 1;
+ break;
+ }
+ index += output_strings[i].size();
+ }
+
+ outputs.erase(index, count);
+
+ outputs = outputs.insert(index, p_name);
+
+ _apply_port_changes();
+}
+
+String VisualShaderNodeGroupBase::get_output_port_name(int p_id) const {
+ ERR_FAIL_COND_V(!output_ports.has(p_id), "");
+ return output_ports[p_id].name;
+}
+
+int VisualShaderNodeGroupBase::get_free_input_port_id() const {
+ return input_ports.size();
+}
+
+int VisualShaderNodeGroupBase::get_free_output_port_id() const {
+ return output_ports.size();
+}
+
+void VisualShaderNodeGroupBase::set_control(Control *p_control, int p_index) {
+ controls[p_index] = p_control;
+}
+
+Control *VisualShaderNodeGroupBase::get_control(int p_index) {
+ ERR_FAIL_COND_V(!controls.has(p_index), NULL);
+ return controls[p_index];
+}
+
+void VisualShaderNodeGroupBase::_apply_port_changes() {
+
+ Vector<String> inputs_strings = inputs.split(";", false);
+ Vector<String> outputs_strings = outputs.split(";", false);
+
+ clear_input_ports();
+ clear_output_ports();
+
+ for (int i = 0; i < inputs_strings.size(); i++) {
+ Vector<String> arr = inputs_strings[i].split(",");
+ Port port;
+ port.type = (PortType)arr[1].to_int();
+ port.name = arr[2];
+ input_ports[i] = port;
+ }
+ for (int i = 0; i < outputs_strings.size(); i++) {
+ Vector<String> arr = outputs_strings[i].split(",");
+ Port port;
+ port.type = (PortType)arr[1].to_int();
+ port.name = arr[2];
+ output_ports[i] = port;
+ }
+}
+
+void VisualShaderNodeGroupBase::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &VisualShaderNodeGroupBase::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &VisualShaderNodeGroupBase::get_size);
+
+ ClassDB::bind_method(D_METHOD("set_inputs", "inputs"), &VisualShaderNodeGroupBase::set_inputs);
+ ClassDB::bind_method(D_METHOD("get_inputs"), &VisualShaderNodeGroupBase::get_inputs);
+
+ 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("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);
+ ClassDB::bind_method(D_METHOD("has_input_port", "id"), &VisualShaderNodeGroupBase::has_input_port);
+ ClassDB::bind_method(D_METHOD("clear_input_ports"), &VisualShaderNodeGroupBase::clear_input_ports);
+
+ ClassDB::bind_method(D_METHOD("add_output_port", "id", "type", "name"), &VisualShaderNodeGroupBase::add_output_port);
+ ClassDB::bind_method(D_METHOD("remove_output_port", "id"), &VisualShaderNodeGroupBase::remove_output_port);
+ ClassDB::bind_method(D_METHOD("get_output_port_count"), &VisualShaderNodeGroupBase::get_output_port_count);
+ ClassDB::bind_method(D_METHOD("has_output_port", "id"), &VisualShaderNodeGroupBase::has_output_port);
+ ClassDB::bind_method(D_METHOD("clear_output_ports"), &VisualShaderNodeGroupBase::clear_output_ports);
+
+ ClassDB::bind_method(D_METHOD("set_input_port_name"), &VisualShaderNodeGroupBase::set_input_port_name);
+ ClassDB::bind_method(D_METHOD("set_input_port_type"), &VisualShaderNodeGroupBase::set_input_port_type);
+ ClassDB::bind_method(D_METHOD("set_output_port_name"), &VisualShaderNodeGroupBase::set_output_port_name);
+ ClassDB::bind_method(D_METHOD("set_output_port_type"), &VisualShaderNodeGroupBase::set_output_port_type);
+
+ ClassDB::bind_method(D_METHOD("get_free_input_port_id"), &VisualShaderNodeGroupBase::get_free_input_port_id);
+ ClassDB::bind_method(D_METHOD("get_free_output_port_id"), &VisualShaderNodeGroupBase::get_free_output_port_id);
+
+ ClassDB::bind_method(D_METHOD("set_control", "control", "index"), &VisualShaderNodeGroupBase::set_control);
+ ClassDB::bind_method(D_METHOD("get_control", "index"), &VisualShaderNodeGroupBase::get_control);
+}
+
+String VisualShaderNodeGroupBase::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+ return "";
+}
+
+VisualShaderNodeGroupBase::VisualShaderNodeGroupBase() {
+ size = Size2(0, 0);
+ inputs = "";
+ outputs = "";
+}
+
+////////////// Expression
+
+String VisualShaderNodeExpression::get_caption() const {
+ return "Expression";
+}
+
+void VisualShaderNodeExpression::set_expression(const String &p_expression) {
+ expression = p_expression;
+}
+
+void VisualShaderNodeExpression::build() {
+ emit_changed();
+}
+
+String VisualShaderNodeExpression::get_expression() const {
+ return expression;
+}
+
+String VisualShaderNodeExpression::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+
+ String _expression = expression;
+
+ _expression = _expression.insert(0, "\n");
+ _expression = _expression.replace("\n", "\n\t\t");
+
+ static Vector<String> pre_symbols;
+ if (pre_symbols.empty()) {
+ pre_symbols.push_back("\t");
+ pre_symbols.push_back("{");
+ pre_symbols.push_back("[");
+ pre_symbols.push_back("(");
+ pre_symbols.push_back(" ");
+ pre_symbols.push_back("-");
+ pre_symbols.push_back("*");
+ pre_symbols.push_back("/");
+ pre_symbols.push_back("+");
+ pre_symbols.push_back("=");
+ pre_symbols.push_back("&");
+ pre_symbols.push_back("|");
+ pre_symbols.push_back("!");
+ }
+
+ static Vector<String> post_symbols;
+ if (post_symbols.empty()) {
+ post_symbols.push_back("\0");
+ post_symbols.push_back("\t");
+ post_symbols.push_back("\n");
+ post_symbols.push_back(";");
+ post_symbols.push_back("}");
+ post_symbols.push_back("]");
+ post_symbols.push_back(")");
+ post_symbols.push_back(" ");
+ post_symbols.push_back(".");
+ post_symbols.push_back("-");
+ post_symbols.push_back("*");
+ post_symbols.push_back("/");
+ post_symbols.push_back("+");
+ post_symbols.push_back("=");
+ post_symbols.push_back("&");
+ post_symbols.push_back("|");
+ post_symbols.push_back("!");
+ }
+
+ for (int i = 0; i < get_input_port_count(); i++) {
+ for (int j = 0; j < pre_symbols.size(); j++) {
+ for (int k = 0; k < post_symbols.size(); k++) {
+ _expression = _expression.replace(pre_symbols[j] + get_input_port_name(i) + post_symbols[k], pre_symbols[j] + p_input_vars[i] + post_symbols[k]);
+ }
+ }
+ }
+ for (int i = 0; i < get_output_port_count(); i++) {
+ for (int j = 0; j < pre_symbols.size(); j++) {
+ for (int k = 0; k < post_symbols.size(); k++) {
+ _expression = _expression.replace(pre_symbols[j] + get_output_port_name(i) + post_symbols[k], pre_symbols[j] + p_output_vars[i] + post_symbols[k]);
+ }
+ }
+ }
+
+ String output_initializer;
+
+ for (int i = 0; i < get_output_port_count(); i++) {
+ int port_type = get_output_port_type(i);
+ String tk = "";
+ switch (port_type) {
+ case PORT_TYPE_SCALAR:
+ tk = "0.0";
+ break;
+ case PORT_TYPE_VECTOR:
+ tk = "vec3(0.0, 0.0, 0.0)";
+ break;
+ case PORT_TYPE_BOOLEAN:
+ tk = "false";
+ break;
+ case PORT_TYPE_TRANSFORM:
+ tk = "mat4(1.0)";
+ break;
+ default:
+ continue;
+ }
+ output_initializer += "\t" + p_output_vars[i] + "=" + tk + ";\n";
+ }
+
+ String code;
+ code += output_initializer;
+ code += "\t{";
+ code += _expression;
+ code += "\n\t}";
+
+ return code;
+}
+
+void VisualShaderNodeExpression::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_expression", "expression"), &VisualShaderNodeExpression::set_expression);
+ ClassDB::bind_method(D_METHOD("get_expression"), &VisualShaderNodeExpression::get_expression);
+
+ ClassDB::bind_method(D_METHOD("build"), &VisualShaderNodeExpression::build);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "expression"), "set_expression", "get_expression");
+}
+
+VisualShaderNodeExpression::VisualShaderNodeExpression() {
+ expression = "";
+}
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index cf10de9bf5..838c2c618d 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -32,6 +32,7 @@
#define VISUAL_SHADER_H
#include "core/string_builder.h"
+#include "scene/gui/control.h"
#include "scene/resources/shader.h"
class VisualShaderNodeUniform;
@@ -135,7 +136,9 @@ public:
bool can_connect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) const;
Error connect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port);
void disconnect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port);
+ void connect_nodes_forced(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port);
+ void rebuild();
void get_node_connections(Type p_type, List<Connection> *r_connections) const;
void set_mode(Mode p_mode);
@@ -148,6 +151,7 @@ public:
String generate_preview_shader(Type p_type, int p_node, int p_port, Vector<DefaultTextureParam> &r_default_tex_params) const;
+ String validate_port_name(const String &p_name, const List<String> &p_input_ports, const List<String> &p_output_ports) const;
String validate_uniform_name(const String &p_name, const Ref<VisualShaderNodeUniform> &p_uniform) const;
VisualShader();
@@ -314,4 +318,93 @@ public:
VisualShaderNodeUniform();
};
+class VisualShaderNodeGroupBase : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeGroupBase, VisualShaderNode)
+private:
+ void _apply_port_changes();
+
+protected:
+ Vector2 size;
+ String inputs;
+ String outputs;
+
+ struct Port {
+ PortType type;
+ String name;
+ };
+
+ Map<int, Port> input_ports;
+ Map<int, Port> output_ports;
+ Map<int, Control *> controls;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_size(const Vector2 &p_size);
+ Vector2 get_size() const;
+
+ void set_inputs(const String &p_inputs);
+ String get_inputs() const;
+
+ void set_outputs(const String &p_outputs);
+ String get_outputs() 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;
+ bool has_input_port(int p_id) const;
+ void clear_input_ports();
+
+ void add_output_port(int p_id, int p_type, const String &p_name);
+ void remove_output_port(int p_id);
+ virtual int get_output_port_count() const;
+ bool has_output_port(int p_id) const;
+ void clear_output_ports();
+
+ void set_input_port_type(int p_id, int p_type);
+ virtual PortType get_input_port_type(int p_id) const;
+ void set_input_port_name(int p_id, const String &p_name);
+ virtual String get_input_port_name(int p_id) const;
+
+ void set_output_port_type(int p_id, int p_type);
+ virtual PortType get_output_port_type(int p_id) const;
+ void set_output_port_name(int p_id, const String &p_name);
+ virtual String get_output_port_name(int p_id) const;
+
+ int get_free_input_port_id() const;
+ int get_free_output_port_id() const;
+
+ void set_control(Control *p_control, int p_index);
+ Control *get_control(int p_index);
+
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const;
+
+ VisualShaderNodeGroupBase();
+};
+
+class VisualShaderNodeExpression : public VisualShaderNodeGroupBase {
+ GDCLASS(VisualShaderNodeExpression, VisualShaderNodeGroupBase)
+
+private:
+ String expression;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_expression(const String &p_expression);
+ String get_expression() const;
+
+ void build();
+
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const;
+
+ VisualShaderNodeExpression();
+};
+
#endif // VISUAL_SHADER_H
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index d02902572c..a44471a365 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -1192,7 +1192,7 @@ String VisualShaderNodeScalarFunc::get_output_port_name(int p_port) const {
String VisualShaderNodeScalarFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *scalar_func_id[FUNC_TRUNC + 1] = {
+ static const char *scalar_func_id[FUNC_ONEMINUS + 1] = {
"sin($)",
"cos($)",
"tan($)",
@@ -1223,7 +1223,8 @@ String VisualShaderNodeScalarFunc::generate_code(Shader::Mode p_mode, VisualShad
"radians($)",
"1.0/($)",
"roundEven($)",
- "trunc($)"
+ "trunc($)",
+ "1.0-$"
};
return "\t" + p_output_vars[0] + " = " + String(scalar_func_id[func]).replace("$", p_input_vars[0]) + ";\n";
@@ -1251,7 +1252,7 @@ void VisualShaderNodeScalarFunc::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_function", "func"), &VisualShaderNodeScalarFunc::set_function);
ClassDB::bind_method(D_METHOD("get_function"), &VisualShaderNodeScalarFunc::get_function);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Sin,Cos,Tan,ASin,ACos,ATan,SinH,CosH,TanH,Log,Exp,Sqrt,Abs,Sign,Floor,Round,Ceil,Frac,Saturate,Negate,ACosH,ASinH,ATanH,Degrees,Exp2,InverseSqrt,Log2,Radians,Reciprocal,RoundEven,Trunc"), "set_function", "get_function");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Sin,Cos,Tan,ASin,ACos,ATan,SinH,CosH,TanH,Log,Exp,Sqrt,Abs,Sign,Floor,Round,Ceil,Frac,Saturate,Negate,ACosH,ASinH,ATanH,Degrees,Exp2,InverseSqrt,Log2,Radians,Reciprocal,RoundEven,Trunc,OneMinus"), "set_function", "get_function");
BIND_ENUM_CONSTANT(FUNC_SIN);
BIND_ENUM_CONSTANT(FUNC_COS);
@@ -1284,6 +1285,7 @@ void VisualShaderNodeScalarFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_RECIPROCAL);
BIND_ENUM_CONSTANT(FUNC_ROUNDEVEN);
BIND_ENUM_CONSTANT(FUNC_TRUNC);
+ BIND_ENUM_CONSTANT(FUNC_ONEMINUS);
}
VisualShaderNodeScalarFunc::VisualShaderNodeScalarFunc() {
@@ -1319,7 +1321,7 @@ String VisualShaderNodeVectorFunc::get_output_port_name(int p_port) const {
String VisualShaderNodeVectorFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *vec_func_id[FUNC_TRUNC + 1] = {
+ static const char *vec_func_id[FUNC_ONEMINUS + 1] = {
"normalize($)",
"max(min($,vec3(1.0)),vec3(0.0))",
"-($)",
@@ -1353,7 +1355,8 @@ String VisualShaderNodeVectorFunc::generate_code(Shader::Mode p_mode, VisualShad
"sqrt($)",
"tan($)",
"tanh($)",
- "trunc($)"
+ "trunc($)",
+ "vec3(1.0, 1.0, 1.0)-$"
};
String code;
@@ -1405,7 +1408,7 @@ void VisualShaderNodeVectorFunc::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_function", "func"), &VisualShaderNodeVectorFunc::set_function);
ClassDB::bind_method(D_METHOD("get_function"), &VisualShaderNodeVectorFunc::get_function);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Normalize,Saturate,Negate,Reciprocal,RGB2HSV,HSV2RGB,Abs,ACos,ACosH,ASin,ASinH,ATan,ATanH,Ceil,Cos,CosH,Degrees,Exp,Exp2,Floor,Frac,InverseSqrt,Log,Log2,Radians,Round,RoundEven,Sign,Sin,SinH,Sqrt,Tan,TanH,Trunc"), "set_function", "get_function");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Normalize,Saturate,Negate,Reciprocal,RGB2HSV,HSV2RGB,Abs,ACos,ACosH,ASin,ASinH,ATan,ATanH,Ceil,Cos,CosH,Degrees,Exp,Exp2,Floor,Frac,InverseSqrt,Log,Log2,Radians,Round,RoundEven,Sign,Sin,SinH,Sqrt,Tan,TanH,Trunc,OneMinus"), "set_function", "get_function");
BIND_ENUM_CONSTANT(FUNC_NORMALIZE);
BIND_ENUM_CONSTANT(FUNC_SATURATE);
@@ -1441,6 +1444,7 @@ void VisualShaderNodeVectorFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_TAN);
BIND_ENUM_CONSTANT(FUNC_TANH);
BIND_ENUM_CONSTANT(FUNC_TRUNC);
+ BIND_ENUM_CONSTANT(FUNC_ONEMINUS);
}
VisualShaderNodeVectorFunc::VisualShaderNodeVectorFunc() {
@@ -2350,7 +2354,7 @@ VisualShaderNodeVectorRefract::VisualShaderNodeVectorRefract() {
////////////// Scalar Interp
String VisualShaderNodeScalarInterp::get_caption() const {
- return "ScalarInterp";
+ return "Mix";
}
int VisualShaderNodeScalarInterp::get_input_port_count() const {
@@ -2392,7 +2396,7 @@ VisualShaderNodeScalarInterp::VisualShaderNodeScalarInterp() {
////////////// Vector Interp
String VisualShaderNodeVectorInterp::get_caption() const {
- return "VectorInterp";
+ return "Mix";
}
int VisualShaderNodeVectorInterp::get_input_port_count() const {
@@ -3085,3 +3089,66 @@ VisualShaderNodeSwitch::VisualShaderNodeSwitch() {
set_input_port_default_value(1, Vector3(0.0, 0.0, 0.0));
set_input_port_default_value(2, Vector3(0.0, 0.0, 0.0));
}
+
+////////////// Fresnel
+
+String VisualShaderNodeFresnel::get_caption() const {
+ return "Fresnel";
+}
+
+int VisualShaderNodeFresnel::get_input_port_count() const {
+ return 4;
+}
+
+VisualShaderNodeFresnel::PortType VisualShaderNodeFresnel::get_input_port_type(int p_port) const {
+ switch (p_port) {
+ case 0:
+ return PORT_TYPE_VECTOR;
+ case 1:
+ return PORT_TYPE_VECTOR;
+ case 2:
+ return PORT_TYPE_BOOLEAN;
+ case 3:
+ return PORT_TYPE_SCALAR;
+ default:
+ return PORT_TYPE_VECTOR;
+ }
+}
+
+String VisualShaderNodeFresnel::get_input_port_name(int p_port) const {
+ switch (p_port) {
+ case 0:
+ return "normal";
+ case 1:
+ return "view";
+ case 2:
+ return "invert";
+ case 3:
+ return "power";
+ default:
+ return "";
+ }
+}
+
+int VisualShaderNodeFresnel::get_output_port_count() const {
+ return 1;
+}
+
+VisualShaderNodeFresnel::PortType VisualShaderNodeFresnel::get_output_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR;
+}
+
+String VisualShaderNodeFresnel::get_output_port_name(int p_port) const {
+ return "result";
+}
+
+String VisualShaderNodeFresnel::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+ return "\t" + p_output_vars[0] + " = " + p_input_vars[2] + " ? (pow(clamp(dot(" + p_input_vars[0] + ", " + p_input_vars[1] + "), 0.0, 1.0), " + p_input_vars[3] + ")) : (pow(1.0 - clamp(dot(" + p_input_vars[0] + ", " + p_input_vars[1] + "), 0.0, 1.0), " + p_input_vars[3] + "));";
+}
+
+VisualShaderNodeFresnel::VisualShaderNodeFresnel() {
+ set_input_port_default_value(0, Vector3(0.0, 0.0, 0.0));
+ set_input_port_default_value(1, Vector3(0.0, 0.0, 0.0));
+ set_input_port_default_value(2, false);
+ set_input_port_default_value(3, 1.0);
+}
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 90c479bd48..852248b9b4 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -562,7 +562,8 @@ public:
FUNC_RADIANS,
FUNC_RECIPROCAL,
FUNC_ROUNDEVEN,
- FUNC_TRUNC
+ FUNC_TRUNC,
+ FUNC_ONEMINUS
};
protected:
@@ -635,7 +636,8 @@ public:
FUNC_SQRT,
FUNC_TAN,
FUNC_TANH,
- FUNC_TRUNC
+ FUNC_TRUNC,
+ FUNC_ONEMINUS
};
protected:
@@ -1484,4 +1486,26 @@ public:
VisualShaderNodeSwitch();
};
+///////////////////////////////////////
+/// FRESNEL
+///////////////////////////////////////
+
+class VisualShaderNodeFresnel : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeFresnel, VisualShaderNode)
+public:
+ virtual String get_caption() const;
+
+ virtual int get_input_port_count() const;
+ virtual PortType get_input_port_type(int p_port) const;
+ virtual String get_input_port_name(int p_port) const;
+
+ virtual int get_output_port_count() const;
+ virtual PortType get_output_port_type(int p_port) const;
+ virtual String get_output_port_name(int p_port) const;
+
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const;
+
+ VisualShaderNodeFresnel();
+};
+
#endif // VISUAL_SHADER_NODES_H
diff --git a/servers/arvr/arvr_interface.h b/servers/arvr/arvr_interface.h
index 8459a82388..9ea59a3961 100644
--- a/servers/arvr/arvr_interface.h
+++ b/servers/arvr/arvr_interface.h
@@ -112,6 +112,7 @@ public:
virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) = 0; /* output the left or right eye */
virtual void process() = 0;
+ virtual void notification(int p_what) = 0;
ARVRInterface();
~ARVRInterface();
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index 96d5c9df89..abf9d5593c 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -32,6 +32,9 @@
void AudioEffectRecordInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
if (!is_recording) {
+ for (int i = 0; i < p_frame_count; i++) {
+ p_dst_frames[i] = p_src_frames[i];
+ }
return;
}
@@ -39,6 +42,7 @@ void AudioEffectRecordInstance::process(const AudioFrame *p_src_frames, AudioFra
const AudioFrame *src = p_src_frames;
AudioFrame *rb_buf = ring_buffer.ptrw();
for (int i = 0; i < p_frame_count; i++) {
+ p_dst_frames[i] = p_src_frames[i];
rb_buf[ring_buffer_pos & ring_buffer_mask] = src[i];
ring_buffer_pos++;
}
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
index 46d92336f3..8e15e9288f 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -112,7 +112,7 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames
}
//determine time of capture
- double remainer_sec = (temporal_fft_pos / mix_rate); //substract remainder from mix time
+ double remainer_sec = (temporal_fft_pos / mix_rate); //subtract remainder from mix time
last_fft_time = time - uint64_t(remainer_sec * 1000000.0);
}
@@ -170,7 +170,7 @@ Vector2 AudioEffectSpectrumAnalyzerInstance::get_magnitude_for_frequency_range(f
for (int i = begin_pos; i <= end_pos; i++) {
max.x = MAX(max.x, r[i].l);
- max.y = MAX(max.x, r[i].r);
+ max.y = MAX(max.y, r[i].r);
}
return max;
diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics/collision_object_sw.cpp
index 085ad4f9ea..b1c21290ab 100644
--- a/servers/physics/collision_object_sw.cpp
+++ b/servers/physics/collision_object_sw.cpp
@@ -32,13 +32,14 @@
#include "servers/physics/physics_server_sw.h"
#include "space_sw.h"
-void CollisionObjectSW::add_shape(ShapeSW *p_shape, const Transform &p_transform) {
+void CollisionObjectSW::add_shape(ShapeSW *p_shape, const Transform &p_transform, bool p_disabled) {
Shape s;
s.shape = p_shape;
s.xform = p_transform;
s.xform_inv = s.xform.affine_inverse();
s.bpid = 0; //needs update
+ s.disabled = p_disabled;
shapes.push_back(s);
p_shape->add_owner(this);
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index 5c14d5aaf9..c2c3fe0e5a 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -118,7 +118,7 @@ public:
void _shape_changed();
_FORCE_INLINE_ Type get_type() const { return type; }
- void add_shape(ShapeSW *p_shape, const Transform &p_transform = Transform());
+ void add_shape(ShapeSW *p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
void set_shape(int p_index, ShapeSW *p_shape);
void set_shape_transform(int p_index, const Transform &p_transform);
_FORCE_INLINE_ int get_shape_count() const { return shapes.size(); }
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 36d18e8901..7b982e7015 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -283,7 +283,7 @@ PhysicsServer::AreaSpaceOverrideMode PhysicsServerSW::area_get_space_override_mo
return area->get_space_override_mode();
}
-void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform) {
+void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) {
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
@@ -291,7 +291,7 @@ void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p
ShapeSW *shape = shape_owner.get(p_shape);
ERR_FAIL_COND(!shape);
- area->add_shape(shape, p_transform);
+ area->add_shape(shape, p_transform, p_disabled);
}
void PhysicsServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
@@ -365,7 +365,7 @@ void PhysicsServerSW::area_set_shape_disabled(RID p_area, int p_shape_idx, bool
area->set_shape_as_disabled(p_shape_idx, p_disabled);
}
-void PhysicsServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID) {
+void PhysicsServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
if (space_owner.owns(p_area)) {
SpaceSW *space = space_owner.get(p_area);
@@ -373,7 +373,7 @@ void PhysicsServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID)
}
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- area->set_instance_id(p_ID);
+ area->set_instance_id(p_id);
}
ObjectID PhysicsServerSW::area_get_object_instance_id(RID p_area) const {
@@ -540,7 +540,7 @@ PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body) const {
return body->get_mode();
};
-void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform) {
+void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
@@ -548,7 +548,7 @@ void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p
ShapeSW *shape = shape_owner.get(p_shape);
ERR_FAIL_COND(!shape);
- body->add_shape(shape, p_transform);
+ body->add_shape(shape, p_transform, p_disabled);
}
void PhysicsServerSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
@@ -673,12 +673,12 @@ uint32_t PhysicsServerSW::body_get_collision_mask(RID p_body) const {
return body->get_collision_mask();
}
-void PhysicsServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_ID) {
+void PhysicsServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_id) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_instance_id(p_ID);
+ body->set_instance_id(p_id);
};
uint32_t PhysicsServerSW::body_get_object_instance_id(RID p_body) const {
diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h
index 5d0ba3628e..b593e9b5f1 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics/physics_server_sw.h
@@ -119,7 +119,7 @@ public:
virtual void area_set_space(RID p_area, RID p_space);
virtual RID area_get_space(RID p_area) const;
- virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform());
+ virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape);
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform);
@@ -132,7 +132,7 @@ public:
virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled);
- virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID);
+ virtual void area_attach_object_instance_id(RID p_area, ObjectID p_id);
virtual ObjectID area_get_object_instance_id(RID p_area) const;
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value);
@@ -163,7 +163,7 @@ public:
virtual void body_set_mode(RID p_body, BodyMode p_mode);
virtual BodyMode body_get_mode(RID p_body) const;
- virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform());
+ virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape);
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform);
@@ -176,7 +176,7 @@ public:
virtual void body_remove_shape(RID p_body, int p_shape_idx);
virtual void body_clear_shapes(RID p_body);
- virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID);
+ virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id);
virtual uint32_t body_get_object_instance_id(RID p_body) const;
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable);
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index e52cc376c0..8b9f210850 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -630,7 +630,7 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
int ray_index = -1; //reuse shape
for (int k = 0; k < rays_found; k++) {
- if (r_results[ray_index].collision_local_shape == j) {
+ if (r_results[k].collision_local_shape == j) {
ray_index = k;
}
}
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index 4ec92497e7..445a2e0613 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -31,14 +31,14 @@
#include "collision_object_2d_sw.h"
#include "space_2d_sw.h"
-void CollisionObject2DSW::add_shape(Shape2DSW *p_shape, const Transform2D &p_transform) {
+void CollisionObject2DSW::add_shape(Shape2DSW *p_shape, const Transform2D &p_transform, bool p_disabled) {
Shape s;
s.shape = p_shape;
s.xform = p_transform;
s.xform_inv = s.xform.affine_inverse();
s.bpid = 0; //needs update
- s.disabled = false;
+ s.disabled = p_disabled;
s.one_way_collision = false;
s.one_way_collision_margin = 0;
shapes.push_back(s);
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index d5e815ff45..fa18e61262 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -111,7 +111,7 @@ public:
void _shape_changed();
_FORCE_INLINE_ Type get_type() const { return type; }
- void add_shape(Shape2DSW *p_shape, const Transform2D &p_transform = Transform2D());
+ void add_shape(Shape2DSW *p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false);
void set_shape(int p_index, Shape2DSW *p_shape);
void set_shape_transform(int p_index, const Transform2D &p_transform);
void set_shape_metadata(int p_index, const Variant &p_metadata);
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 283d20876d..0efa15d43e 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -378,7 +378,7 @@ Physics2DServer::AreaSpaceOverrideMode Physics2DServerSW::area_get_space_overrid
return area->get_space_override_mode();
}
-void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform) {
+void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform, bool p_disabled) {
Area2DSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
@@ -386,7 +386,7 @@ void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Transform2
Shape2DSW *shape = shape_owner.get(p_shape);
ERR_FAIL_COND(!shape);
- area->add_shape(shape, p_transform);
+ area->add_shape(shape, p_transform, p_disabled);
}
void Physics2DServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
@@ -460,7 +460,7 @@ void Physics2DServerSW::area_clear_shapes(RID p_area) {
area->remove_shape(0);
}
-void Physics2DServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID) {
+void Physics2DServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.get(p_area);
@@ -468,7 +468,7 @@ void Physics2DServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID
}
Area2DSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- area->set_instance_id(p_ID);
+ area->set_instance_id(p_id);
}
ObjectID Physics2DServerSW::area_get_object_instance_id(RID p_area) const {
@@ -481,7 +481,7 @@ ObjectID Physics2DServerSW::area_get_object_instance_id(RID p_area) const {
return area->get_instance_id();
}
-void Physics2DServerSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_ID) {
+void Physics2DServerSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_id) {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.get(p_area);
@@ -489,7 +489,7 @@ void Physics2DServerSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_ID
}
Area2DSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- area->set_canvas_instance_id(p_ID);
+ area->set_canvas_instance_id(p_id);
}
ObjectID Physics2DServerSW::area_get_canvas_instance_id(RID p_area) const {
@@ -643,7 +643,7 @@ Physics2DServer::BodyMode Physics2DServerSW::body_get_mode(RID p_body) const {
return body->get_mode();
};
-void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform) {
+void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform, bool p_disabled) {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
@@ -651,7 +651,7 @@ void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Transform2
Shape2DSW *shape = shape_owner.get(p_shape);
ERR_FAIL_COND(!shape);
- body->add_shape(shape, p_transform);
+ body->add_shape(shape, p_transform, p_disabled);
}
void Physics2DServerSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
@@ -763,12 +763,12 @@ Physics2DServerSW::CCDMode Physics2DServerSW::body_get_continuous_collision_dete
return body->get_continuous_collision_detection_mode();
}
-void Physics2DServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_ID) {
+void Physics2DServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_id) {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_instance_id(p_ID);
+ body->set_instance_id(p_id);
};
uint32_t Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
@@ -779,12 +779,12 @@ uint32_t Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
return body->get_instance_id();
};
-void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, uint32_t p_ID) {
+void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, uint32_t p_id) {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_canvas_instance_id(p_ID);
+ body->set_canvas_instance_id(p_id);
};
uint32_t Physics2DServerSW::body_get_canvas_instance_id(RID p_body) const {
diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h
index 4beec41442..adc011af40 100644
--- a/servers/physics_2d/physics_2d_server_sw.h
+++ b/servers/physics_2d/physics_2d_server_sw.h
@@ -131,7 +131,7 @@ public:
virtual void area_set_space(RID p_area, RID p_space);
virtual RID area_get_space(RID p_area) const;
- virtual void area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform = Transform2D());
+ virtual void area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false);
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape);
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D &p_transform);
@@ -144,10 +144,10 @@ public:
virtual void area_remove_shape(RID p_area, int p_shape_idx);
virtual void area_clear_shapes(RID p_area);
- virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID);
+ virtual void area_attach_object_instance_id(RID p_area, ObjectID p_id);
virtual ObjectID area_get_object_instance_id(RID p_area) const;
- virtual void area_attach_canvas_instance_id(RID p_area, ObjectID p_ID);
+ virtual void area_attach_canvas_instance_id(RID p_area, ObjectID p_id);
virtual ObjectID area_get_canvas_instance_id(RID p_area) const;
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value);
@@ -175,7 +175,7 @@ public:
virtual void body_set_mode(RID p_body, BodyMode p_mode);
virtual BodyMode body_get_mode(RID p_body) const;
- virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform = Transform2D());
+ virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false);
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape);
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D &p_transform);
virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata);
@@ -191,10 +191,10 @@ public:
virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled);
virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable, float p_margin);
- virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID);
+ virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id);
virtual uint32_t body_get_object_instance_id(RID p_body) const;
- virtual void body_attach_canvas_instance_id(RID p_body, uint32_t p_ID);
+ virtual void body_attach_canvas_instance_id(RID p_body, uint32_t p_id);
virtual uint32_t body_get_canvas_instance_id(RID p_body) const;
virtual void body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode);
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h
index 5b9a102a1b..b61e1faad2 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.h
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.h
@@ -140,7 +140,7 @@ public:
FUNC2(area_set_space_override_mode, RID, AreaSpaceOverrideMode);
FUNC1RC(AreaSpaceOverrideMode, area_get_space_override_mode, RID);
- FUNC3(area_add_shape, RID, RID, const Transform2D &);
+ FUNC4(area_add_shape, RID, RID, const Transform2D &, bool);
FUNC3(area_set_shape, RID, int, RID);
FUNC3(area_set_shape_transform, RID, int, const Transform2D &);
FUNC3(area_set_shape_disabled, RID, int, bool);
@@ -183,7 +183,7 @@ public:
FUNC2(body_set_mode, RID, BodyMode);
FUNC1RC(BodyMode, body_get_mode, RID);
- FUNC3(body_add_shape, RID, RID, const Transform2D &);
+ FUNC4(body_add_shape, RID, RID, const Transform2D &, bool);
FUNC3(body_set_shape, RID, int, RID);
FUNC3(body_set_shape_transform, RID, int, const Transform2D &);
FUNC3(body_set_shape_metadata, RID, int, const Variant &);
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 66d2dcd417..0043b948b0 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -240,12 +240,7 @@ bool SegmentShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &
real_t SegmentShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const {
- Vector2 s[2] = { a * p_scale, b * p_scale };
-
- real_t l = s[1].distance_to(s[0]);
- Vector2 ofs = (s[0] + s[1]) * 0.5;
-
- return p_mass * (l * l / 12.0 + ofs.length_squared());
+ return p_mass * ((a * p_scale).distance_squared_to(b * p_scale)) / 12;
}
void SegmentShape2DSW::set_data(const Variant &p_data) {
@@ -318,7 +313,9 @@ bool CircleShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p
real_t CircleShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const {
- return (radius * radius) * (p_scale.x * 0.5 + p_scale.y * 0.5);
+ real_t a = radius * p_scale.x;
+ real_t b = radius * p_scale.y;
+ return p_mass * (a * a + b * b) / 4;
}
void CircleShape2DSW::set_data(const Variant &p_data) {
@@ -637,7 +634,7 @@ real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2
aabb.expand_to(points[i].pos * p_scale);
}
- return p_mass * aabb.size.dot(aabb.size) / 12.0 + p_mass * (aabb.position + aabb.size * 0.5).length_squared();
+ return p_mass * aabb.size.dot(aabb.size) / 12.0;
}
void ConvexPolygonShape2DSW::set_data(const Variant &p_data) {
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index f5acadd71c..e2b1bb9da4 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -795,7 +795,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
cbk.valid_dir = col_obj_shape_xform.get_axis(1).normalized();
float owc_margin = col_obj->get_shape_one_way_collision_margin(shape_idx);
- cbk.valid_depth = MAX(owc_margin, p_margin); //user specified, but never less than actual margin or it wont work
+ cbk.valid_depth = MAX(owc_margin, p_margin); //user specified, but never less than actual margin or it won't work
cbk.invalid_by_dir = 0;
if (col_obj->get_type() == CollisionObject2DSW::TYPE_BODY) {
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index 3a05791f17..dadadf68fd 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -567,10 +567,10 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_set_space_override_mode", "area", "mode"), &Physics2DServer::area_set_space_override_mode);
ClassDB::bind_method(D_METHOD("area_get_space_override_mode", "area"), &Physics2DServer::area_get_space_override_mode);
- ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform"), &Physics2DServer::area_add_shape, DEFVAL(Transform2D()));
+ ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform", "disabled"), &Physics2DServer::area_add_shape, DEFVAL(Transform2D()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("area_set_shape", "area", "shape_idx", "shape"), &Physics2DServer::area_set_shape);
ClassDB::bind_method(D_METHOD("area_set_shape_transform", "area", "shape_idx", "transform"), &Physics2DServer::area_set_shape_transform);
- ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disable"), &Physics2DServer::area_set_shape_disabled);
+ ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disabled"), &Physics2DServer::area_set_shape_disabled);
ClassDB::bind_method(D_METHOD("area_get_shape_count", "area"), &Physics2DServer::area_get_shape_count);
ClassDB::bind_method(D_METHOD("area_get_shape", "area", "shape_idx"), &Physics2DServer::area_get_shape);
@@ -606,7 +606,7 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_mode", "body", "mode"), &Physics2DServer::body_set_mode);
ClassDB::bind_method(D_METHOD("body_get_mode", "body"), &Physics2DServer::body_get_mode);
- ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform"), &Physics2DServer::body_add_shape, DEFVAL(Transform2D()));
+ ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform", "disabled"), &Physics2DServer::body_add_shape, DEFVAL(Transform2D()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("body_set_shape", "body", "shape_idx", "shape"), &Physics2DServer::body_set_shape);
ClassDB::bind_method(D_METHOD("body_set_shape_transform", "body", "shape_idx", "transform"), &Physics2DServer::body_set_shape_transform);
ClassDB::bind_method(D_METHOD("body_set_shape_metadata", "body", "shape_idx", "metadata"), &Physics2DServer::body_set_shape_metadata);
@@ -619,7 +619,7 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_remove_shape", "body", "shape_idx"), &Physics2DServer::body_remove_shape);
ClassDB::bind_method(D_METHOD("body_clear_shapes", "body"), &Physics2DServer::body_clear_shapes);
- ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disable"), &Physics2DServer::body_set_shape_disabled);
+ ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disabled"), &Physics2DServer::body_set_shape_disabled);
ClassDB::bind_method(D_METHOD("body_set_shape_as_one_way_collision", "body", "shape_idx", "enable", "margin"), &Physics2DServer::body_set_shape_as_one_way_collision);
ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &Physics2DServer::body_attach_object_instance_id);
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index 0ba8a6605d..46b22d6777 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -335,7 +335,7 @@ public:
virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) = 0;
virtual AreaSpaceOverrideMode area_get_space_override_mode(RID p_area) const = 0;
- virtual void area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform = Transform2D()) = 0;
+ virtual void area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false) = 0;
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape) = 0;
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D &p_transform) = 0;
@@ -348,10 +348,10 @@ public:
virtual void area_set_shape_disabled(RID p_area, int p_shape, bool p_disabled) = 0;
- virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID) = 0;
+ virtual void area_attach_object_instance_id(RID p_area, ObjectID p_id) = 0;
virtual ObjectID area_get_object_instance_id(RID p_area) const = 0;
- virtual void area_attach_canvas_instance_id(RID p_area, ObjectID p_ID) = 0;
+ virtual void area_attach_canvas_instance_id(RID p_area, ObjectID p_id) = 0;
virtual ObjectID area_get_canvas_instance_id(RID p_area) const = 0;
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) = 0;
@@ -388,7 +388,7 @@ public:
virtual void body_set_mode(RID p_body, BodyMode p_mode) = 0;
virtual BodyMode body_get_mode(RID p_body) const = 0;
- virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform = Transform2D()) = 0;
+ virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false) = 0;
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape) = 0;
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D &p_transform) = 0;
virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata) = 0;
@@ -404,10 +404,10 @@ public:
virtual void body_remove_shape(RID p_body, int p_shape_idx) = 0;
virtual void body_clear_shapes(RID p_body) = 0;
- virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID) = 0;
+ virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id) = 0;
virtual uint32_t body_get_object_instance_id(RID p_body) const = 0;
- virtual void body_attach_canvas_instance_id(RID p_body, uint32_t p_ID) = 0;
+ virtual void body_attach_canvas_instance_id(RID p_body, uint32_t p_id) = 0;
virtual uint32_t body_get_canvas_instance_id(RID p_body) const = 0;
enum CCDMode {
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index 0629af663e..fe8c644f0b 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -427,9 +427,10 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_set_space_override_mode", "area", "mode"), &PhysicsServer::area_set_space_override_mode);
ClassDB::bind_method(D_METHOD("area_get_space_override_mode", "area"), &PhysicsServer::area_get_space_override_mode);
- ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform"), &PhysicsServer::area_add_shape, DEFVAL(Transform()));
+ ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform", "disabled"), &PhysicsServer::area_add_shape, DEFVAL(Transform()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("area_set_shape", "area", "shape_idx", "shape"), &PhysicsServer::area_set_shape);
ClassDB::bind_method(D_METHOD("area_set_shape_transform", "area", "shape_idx", "transform"), &PhysicsServer::area_set_shape_transform);
+ ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disabled"), &PhysicsServer::area_set_shape_disabled);
ClassDB::bind_method(D_METHOD("area_get_shape_count", "area"), &PhysicsServer::area_get_shape_count);
ClassDB::bind_method(D_METHOD("area_get_shape", "area", "shape_idx"), &PhysicsServer::area_get_shape);
@@ -471,9 +472,10 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &PhysicsServer::body_set_collision_mask);
ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &PhysicsServer::body_get_collision_mask);
- ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform"), &PhysicsServer::body_add_shape, DEFVAL(Transform()));
+ ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform", "disabled"), &PhysicsServer::body_add_shape, DEFVAL(Transform()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("body_set_shape", "body", "shape_idx", "shape"), &PhysicsServer::body_set_shape);
ClassDB::bind_method(D_METHOD("body_set_shape_transform", "body", "shape_idx", "transform"), &PhysicsServer::body_set_shape_transform);
+ ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disabled"), &PhysicsServer::body_set_shape_disabled);
ClassDB::bind_method(D_METHOD("body_get_shape_count", "body"), &PhysicsServer::body_get_shape_count);
ClassDB::bind_method(D_METHOD("body_get_shape", "body", "shape_idx"), &PhysicsServer::body_get_shape);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 9895ef2455..5e5964ca8d 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -320,7 +320,7 @@ public:
virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) = 0;
virtual AreaSpaceOverrideMode area_get_space_override_mode(RID p_area) const = 0;
- virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform()) = 0;
+ virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false) = 0;
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape) = 0;
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) = 0;
@@ -333,7 +333,7 @@ public:
virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) = 0;
- virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID) = 0;
+ virtual void area_attach_object_instance_id(RID p_area, ObjectID p_id) = 0;
virtual ObjectID area_get_object_instance_id(RID p_area) const = 0;
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) = 0;
@@ -372,7 +372,7 @@ public:
virtual void body_set_mode(RID p_body, BodyMode p_mode) = 0;
virtual BodyMode body_get_mode(RID p_body) const = 0;
- virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform()) = 0;
+ virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false) = 0;
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape) = 0;
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) = 0;
@@ -385,7 +385,7 @@ public:
virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) = 0;
- virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID) = 0;
+ virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id) = 0;
virtual uint32_t body_get_object_instance_id(RID p_body) const = 0;
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) = 0;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index b22e26f903..31888261ec 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -373,6 +373,7 @@ public:
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
+ virtual void light_set_use_gi(RID p_light, bool p_enable) = 0;
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) = 0;
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) = 0;
@@ -392,6 +393,7 @@ public:
virtual AABB light_get_aabb(RID p_light) const = 0;
virtual float light_get_param(RID p_light, VS::LightParam p_param) = 0;
virtual Color light_get_color(RID p_light) = 0;
+ virtual bool light_get_use_gi(RID p_light) = 0;
virtual uint64_t light_get_version(RID p_light) const = 0;
/* PROBE API */
@@ -548,10 +550,12 @@ public:
RENDER_TARGET_NO_SAMPLING,
RENDER_TARGET_HDR,
RENDER_TARGET_KEEP_3D_LINEAR,
+ RENDER_TARGET_DIRECT_TO_SCREEN,
RENDER_TARGET_FLAG_MAX
};
virtual RID render_target_create() = 0;
+ virtual void render_target_set_position(RID p_render_target, int p_x, int p_y) = 0;
virtual void render_target_set_size(RID p_render_target, int p_width, int p_height) = 0;
virtual RID render_target_get_texture(RID p_render_target) const = 0;
virtual void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) = 0;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 33714a79b2..6efd05593e 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -616,7 +616,7 @@ ShaderLanguage::Token ShaderLanguage::_get_token() {
else
tk.type = TK_INT_CONSTANT;
- tk.constant = str.to_double(); //wont work with hex
+ tk.constant = str.to_double(); //won't work with hex
tk.line = tk_line;
return tk;
@@ -2968,6 +2968,10 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
member_type = DataType(dt - 1);
} else if (l == 2) {
member_type = dt;
+ } else if (l == 3) {
+ member_type = DataType(dt + 1);
+ } else if (l == 4) {
+ member_type = DataType(dt + 2);
} else {
ok = false;
break;
@@ -3001,6 +3005,8 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
member_type = DataType(dt - 1);
} else if (l == 3) {
member_type = dt;
+ } else if (l == 4) {
+ member_type = DataType(dt + 1);
} else {
ok = false;
break;
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 7a42bc475e..bc6010117c 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -76,7 +76,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_MATRIX"] = ShaderLanguage::TYPE_MAT4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
@@ -147,6 +147,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["DIFFUSE_LIGHT"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["SPECULAR_LIGHT"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["light"].can_discard = true;
@@ -187,6 +188,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].modes.push_back("shadows_disabled");
shader_modes[VS::SHADER_SPATIAL].modes.push_back("ambient_light_disabled");
+ shader_modes[VS::SHADER_SPATIAL].modes.push_back("shadow_to_opacity");
shader_modes[VS::SHADER_SPATIAL].modes.push_back("vertex_lighting");
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index efe2a99d2e..921d55556d 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -312,6 +312,7 @@ public:
BIND2(light_set_negative, RID, bool)
BIND2(light_set_cull_mask, RID, uint32_t)
BIND2(light_set_reverse_cull_face_mode, RID, bool)
+ BIND2(light_set_use_gi, RID, bool)
BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
@@ -453,6 +454,7 @@ public:
BIND2(viewport_set_clear_mode, RID, ViewportClearMode)
BIND3(viewport_attach_to_screen, RID, const Rect2 &, int)
+ BIND2(viewport_set_render_direct_to_screen, RID, bool)
BIND1(viewport_detach, RID)
BIND2(viewport_set_update_mode, RID, ViewportUpdateMode)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index af580d6794..3ee23e9290 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -607,12 +607,12 @@ void VisualServerScene::instance_set_transform(RID p_instance, const Transform &
instance->transform = p_transform;
_instance_queue_update(instance, true);
}
-void VisualServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_ID) {
+void VisualServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_id) {
Instance *instance = instance_owner.get(p_instance);
ERR_FAIL_COND(!instance);
- instance->object_ID = p_ID;
+ instance->object_id = p_id;
}
void VisualServerScene::instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) {
@@ -791,10 +791,10 @@ Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID
Instance *instance = cull[i];
ERR_CONTINUE(!instance);
- if (instance->object_ID == 0)
+ if (instance->object_id == 0)
continue;
- instances.push_back(instance->object_ID);
+ instances.push_back(instance->object_id);
}
return instances;
@@ -813,10 +813,10 @@ Vector<ObjectID> VisualServerScene::instances_cull_ray(const Vector3 &p_from, co
for (int i = 0; i < culled; i++) {
Instance *instance = cull[i];
ERR_CONTINUE(!instance);
- if (instance->object_ID == 0)
+ if (instance->object_id == 0)
continue;
- instances.push_back(instance->object_ID);
+ instances.push_back(instance->object_id);
}
return instances;
@@ -837,10 +837,10 @@ Vector<ObjectID> VisualServerScene::instances_cull_convex(const Vector<Plane> &p
Instance *instance = cull[i];
ERR_CONTINUE(!instance);
- if (instance->object_ID == 0)
+ if (instance->object_id == 0)
continue;
- instances.push_back(instance->object_ID);
+ instances.push_back(instance->object_id);
}
return instances;
@@ -3117,6 +3117,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
for (List<Instance *>::Element *E = p_gi_probe->scenario->directional_lights.front(); E; E = E->next()) {
+ if (!VSG::storage->light_get_use_gi(E->get()->base))
+ continue;
+
InstanceGIProbeData::LightCache lc;
lc.type = VSG::storage->light_get_type(E->get()->base);
lc.color = VSG::storage->light_get_color(E->get()->base);
@@ -3137,6 +3140,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
for (Set<Instance *>::Element *E = probe_data->lights.front(); E; E = E->next()) {
+ if (!VSG::storage->light_get_use_gi(E->get()->base))
+ continue;
+
InstanceGIProbeData::LightCache lc;
lc.type = VSG::storage->light_get_type(E->get()->base);
lc.color = VSG::storage->light_get_color(E->get()->base);
diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h
index 2c2ba7e15f..629d66c6cb 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/visual/visual_server_scene.h
@@ -174,7 +174,7 @@ public:
AABB transformed_aabb;
AABB *custom_aabb; // <Zylann> would using aabb directly with a bool be better?
float extra_margin;
- uint32_t object_ID;
+ uint32_t object_id;
float lod_begin;
float lod_end;
@@ -211,7 +211,7 @@ public:
extra_margin = 0;
- object_ID = 0;
+ object_id = 0;
visible = true;
lod_begin = 0;
@@ -457,7 +457,7 @@ public:
virtual void instance_set_scenario(RID p_instance, RID p_scenario); // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask);
virtual void instance_set_transform(RID p_instance, const Transform &p_transform);
- virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_ID);
+ virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id);
virtual void instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight);
virtual void instance_set_surface_material(RID p_instance, int p_surface, RID p_material);
virtual void instance_set_visible(RID p_instance, bool p_visible);
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index e7f60c2c1f..b7c54caffd 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -343,7 +343,7 @@ void VisualServerViewport::draw_viewports() {
vp->render_info[VS::VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_SURFACE_CHANGES_IN_FRAME);
vp->render_info[VS::VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_DRAW_CALLS_IN_FRAME);
- if (vp->viewport_to_screen_rect != Rect2()) {
+ if (vp->viewport_to_screen_rect != Rect2() && (!vp->viewport_render_direct_to_screen || !VSG::rasterizer->is_low_end())) {
//copy to screen if set as such
VSG::rasterizer->set_current_render_target(RID());
VSG::rasterizer->blit_render_target_to_screen(vp->render_target, vp->viewport_to_screen_rect, vp->viewport_to_screen);
@@ -368,6 +368,7 @@ RID VisualServerViewport::viewport_create() {
viewport->hide_canvas = false;
viewport->render_target = VSG::storage->render_target_create();
viewport->shadow_atlas = VSG::scene_render->shadow_atlas_create();
+ viewport->viewport_render_direct_to_screen = false;
return rid;
}
@@ -424,14 +425,55 @@ void VisualServerViewport::viewport_attach_to_screen(RID p_viewport, const Rect2
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
+ // If using GLES2 we can optimize this operation by rendering directly to system_fbo
+ // instead of rendering to fbo and copying to system_fbo after
+ if (VSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
+
+ VSG::storage->render_target_set_size(viewport->render_target, p_rect.size.x, p_rect.size.y);
+ VSG::storage->render_target_set_position(viewport->render_target, p_rect.position.x, p_rect.position.y);
+ }
+
viewport->viewport_to_screen_rect = p_rect;
viewport->viewport_to_screen = p_screen;
}
+
+void VisualServerViewport::viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) {
+ Viewport *viewport = viewport_owner.getornull(p_viewport);
+ ERR_FAIL_COND(!viewport);
+
+ if (p_enable == viewport->viewport_render_direct_to_screen)
+ return;
+
+ // if disabled, reset render_target size and position
+ if (!p_enable) {
+
+ VSG::storage->render_target_set_position(viewport->render_target, 0, 0);
+ VSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
+ }
+
+ VSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN, p_enable);
+ viewport->viewport_render_direct_to_screen = p_enable;
+
+ // if attached to screen already, setup screen size and position, this needs to happen after setting flag to avoid an unneccesary buffer allocation
+ if (VSG::rasterizer->is_low_end() && viewport->viewport_to_screen_rect != Rect2() && p_enable) {
+
+ VSG::storage->render_target_set_size(viewport->render_target, viewport->viewport_to_screen_rect.size.x, viewport->viewport_to_screen_rect.size.y);
+ VSG::storage->render_target_set_position(viewport->render_target, viewport->viewport_to_screen_rect.position.x, viewport->viewport_to_screen_rect.position.y);
+ }
+}
+
void VisualServerViewport::viewport_detach(RID p_viewport) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
+ // if render_direct_to_screen was used, reset size and position
+ if (VSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
+
+ VSG::storage->render_target_set_position(viewport->render_target, 0, 0);
+ VSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
+ }
+
viewport->viewport_to_screen_rect = Rect2();
viewport->viewport_to_screen = 0;
}
diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h
index 555b40a103..43bbcb66c3 100644
--- a/servers/visual/visual_server_viewport.h
+++ b/servers/visual/visual_server_viewport.h
@@ -58,6 +58,7 @@ public:
int viewport_to_screen;
Rect2 viewport_to_screen_rect;
+ bool viewport_render_direct_to_screen;
bool hide_scenario;
bool hide_canvas;
@@ -158,6 +159,7 @@ public:
void viewport_set_size(RID p_viewport, int p_width, int p_height);
void viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect = Rect2(), int p_screen = 0);
+ void viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable);
void viewport_detach(RID p_viewport);
void viewport_set_active(RID p_viewport, bool p_active);
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 3e451511cd..cd24deb60c 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -248,6 +248,7 @@ public:
FUNC2(light_set_negative, RID, bool)
FUNC2(light_set_cull_mask, RID, uint32_t)
FUNC2(light_set_reverse_cull_face_mode, RID, bool)
+ FUNC2(light_set_use_gi, RID, bool)
FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
@@ -380,6 +381,7 @@ public:
FUNC2(viewport_set_clear_mode, RID, ViewportClearMode)
FUNC3(viewport_attach_to_screen, RID, const Rect2 &, int)
+ FUNC2(viewport_set_render_direct_to_screen, RID, bool)
FUNC1(viewport_detach, RID)
FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 041fb2b84f..0fe00ad61a 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1780,6 +1780,7 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("light_set_negative", "light", "enable"), &VisualServer::light_set_negative);
ClassDB::bind_method(D_METHOD("light_set_cull_mask", "light", "mask"), &VisualServer::light_set_cull_mask);
ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode", "light", "enabled"), &VisualServer::light_set_reverse_cull_face_mode);
+ ClassDB::bind_method(D_METHOD("light_set_use_gi", "light", "enabled"), &VisualServer::light_set_use_gi);
ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode", "light", "mode"), &VisualServer::light_omni_set_shadow_mode);
ClassDB::bind_method(D_METHOD("light_omni_set_shadow_detail", "light", "detail"), &VisualServer::light_omni_set_shadow_detail);
@@ -1875,6 +1876,7 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("viewport_set_active", "viewport", "active"), &VisualServer::viewport_set_active);
ClassDB::bind_method(D_METHOD("viewport_set_parent_viewport", "viewport", "parent_viewport"), &VisualServer::viewport_set_parent_viewport);
ClassDB::bind_method(D_METHOD("viewport_attach_to_screen", "viewport", "rect", "screen"), &VisualServer::viewport_attach_to_screen, DEFVAL(Rect2()), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("viewport_set_render_direct_to_screen", "viewport", "enabled"), &VisualServer::viewport_set_render_direct_to_screen);
ClassDB::bind_method(D_METHOD("viewport_detach", "viewport"), &VisualServer::viewport_detach);
ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &VisualServer::viewport_set_update_mode);
ClassDB::bind_method(D_METHOD("viewport_set_vflip", "viewport", "enabled"), &VisualServer::viewport_set_vflip);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 7693faf42b..01be996bfc 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -435,6 +435,7 @@ public:
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
+ virtual void light_set_use_gi(RID p_light, bool p_enable) = 0;
// omni light
enum LightOmniShadowMode {
@@ -609,6 +610,7 @@ public:
virtual void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) = 0;
virtual void viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect = Rect2(), int p_screen = 0) = 0;
+ virtual void viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) = 0;
virtual void viewport_detach(RID p_viewport) = 0;
enum ViewportUpdateMode {
@@ -813,7 +815,7 @@ public:
virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0; // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask) = 0;
virtual void instance_set_transform(RID p_instance, const Transform &p_transform) = 0;
- virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_ID) = 0;
+ virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id) = 0;
virtual void instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) = 0;
virtual void instance_set_surface_material(RID p_instance, int p_surface, RID p_material) = 0;
virtual void instance_set_visible(RID p_instance, bool p_visible) = 0;
diff --git a/thirdparty/README.md b/thirdparty/README.md
index e2c2334c0f..732c08fdea 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -185,18 +185,21 @@ Files extracted from upstream source:
## libsimplewebm
- Upstream: https://github.com/zaps166/libsimplewebm
-- Version: git (05cfdc2, 2016)
-- License: MIT, BSD-3-Clause
+- Version: git (fe57fd3, 2019)
+- License: MIT (main), BSD-3-Clause (libwebm)
+
+This contains libwebm, but the version in use is updated from the one used by libsimplewebm,
+and may have *unmarked* alterations from that.
Files extracted from upstream source:
-TODO.
+- all the .cpp, .hpp files in the main folder except `example.cpp`
+- LICENSE
Important: Some files have Godot-made changes.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
comments.
-
## libtheora
- Upstream: https://www.theora.org
@@ -262,17 +265,17 @@ changes are marked with `// -- GODOT --` comments.
## libwebsockets
- Upstream: https://github.com/warmcat/libwebsockets
-- Version: 3.1.0
+- Version: 3.0.1
- License: LGPLv2.1 + static linking exception
File extracted from upstream source:
-- From `lib/` into `thirdparty/libwebsockets/lib`:
+- From `lib/` into `thirdparty/libwebsockets`:
- Everything from `core`
- - From `event-libs` only the `poll` subfolder and the `private.h` header
- - From `misc` only `base64-decode.c`, `getifaddrs.c`, `getifaddrs.h`, `lejp.c`, and `sha-1.c` (and the `private.h` header)
- - From `plat` everything from `unix` and `windows` (and the `private.h` header)
+ - From `event-libs` only the `poll` subfolder
+ - From `misc` only `base64-decode.c`, `getifaddrs.c`, `getifaddrs.h`, `lejp.c`, and `sha-1.c`
+ - From `plat` only `lws-plat-unix.c` and `lws-plat-win.c`
- From `roles` only `private.h`, `h1`, `http`, `listen`, `pipe`, `raw`, `ws`
- - From `roles/http` exclude `minilex.c` and the `compression` subfolder
+ - From `roles/http` exclude `minilex.c`
- From `roles/http/server` exclude `access-log.c`, `lws-spa.c`, `ranges.c`, and `rewrite.c`
- From `roles/ws` exclude `ext` folder.
- From `tls` exclude `openssl` folder.
@@ -343,7 +346,7 @@ Collection of single-file libraries used in Godot components.
* License: Public Domain
- `clipper.{cpp,hpp}`
* Upstream: https://sourceforge.net/projects/polyclipping
- * Version: 6.4.2
+ * Version: 6.4.2 + Godot changes (added optional exceptions handling)
* License: BSL-1.0
- `fastlz.{c,h}`
* Upstream: https://github.com/ariya/FastLZ
diff --git a/thirdparty/assimp/code/res/resource.h b/thirdparty/assimp/code/res/resource.h
deleted file mode 100644
index 37d39284fe..0000000000
--- a/thirdparty/assimp/code/res/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by assimp.rc
-
-// Nächste Standardwerte für neue Objekte
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
index 782e9efaf1..b30ce03164 100644
--- a/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
+++ b/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
@@ -19,9 +19,10 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
-#include "BulletCollision/CollisionShapes/btSphereShape.h" //for raycasting
-#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" //for raycasting
-#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h" //for raycasting
+#include "BulletCollision/CollisionShapes/btSphereShape.h" //for raycasting
+#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" //for raycasting
+#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h" //for raycasting
+#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h" //for raycasting
#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
@@ -413,6 +414,18 @@ void btCollisionWorld::rayTestSingleInternal(const btTransform& rayFromTrans, co
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
triangleMesh->performRaycast(&rcb, rayFromLocalScaled, rayToLocalScaled);
}
+ else if (collisionShape->getShapeType()==TERRAIN_SHAPE_PROXYTYPE)
+ {
+ ///optimized version for btHeightfieldTerrainShape
+ btHeightfieldTerrainShape* heightField = (btHeightfieldTerrainShape*)collisionShape;
+ btTransform worldTocollisionObject = colObjWorldTransform.inverse();
+ btVector3 rayFromLocal = worldTocollisionObject * rayFromTrans.getOrigin();
+ btVector3 rayToLocal = worldTocollisionObject * rayToTrans.getOrigin();
+
+ BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObjectWrap->getCollisionObject(),heightField,colObjWorldTransform);
+ rcb.m_hitFraction = resultCallback.m_closestHitFraction;
+ heightField->performRaycast(&rcb, rayFromLocal, rayToLocal);
+ }
else
{
//generic (slower) case
diff --git a/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp b/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp
index c85ce2498e..4adf27e6bb 100644
--- a/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp
+++ b/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp
@@ -73,6 +73,10 @@ void btHeightfieldTerrainShape::initialize(
m_useZigzagSubdivision = false;
m_upAxis = upAxis;
m_localScaling.setValue(btScalar(1.), btScalar(1.), btScalar(1.));
+ m_vboundsGrid = NULL;
+ m_vboundsChunkSize = 0;
+ m_vboundsGridWidth = 0;
+ m_vboundsGridLength = 0;
// determine min/max axis-aligned bounding box (aabb) values
switch (m_upAxis)
@@ -108,6 +112,7 @@ void btHeightfieldTerrainShape::initialize(
btHeightfieldTerrainShape::~btHeightfieldTerrainShape()
{
+ clearAccelerator();
}
void btHeightfieldTerrainShape::getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
@@ -323,6 +328,8 @@ void btHeightfieldTerrainShape::processAllTriangles(btTriangleCallback* callback
}
}
+ // TODO If m_vboundsGrid is available, use it to determine if we really need to process this area
+
for (int j = startJ; j < endJ; j++)
{
for (int x = startX; x < endX; x++)
@@ -373,3 +380,416 @@ const btVector3& btHeightfieldTerrainShape::getLocalScaling() const
{
return m_localScaling;
}
+
+
+
+struct GridRaycastState
+{
+ int x; // Next quad coords
+ int z;
+ int prev_x; // Previous quad coords
+ int prev_z;
+ btScalar param; // Exit param for previous quad
+ btScalar prevParam; // Enter param for previous quad
+ btScalar maxDistanceFlat;
+ btScalar maxDistance3d;
+};
+
+
+// TODO Does it really need to take 3D vectors?
+/// Iterates through a virtual 2D grid of unit-sized square cells,
+/// and executes an action on each cell intersecting the given segment, ordered from begin to end.
+/// Initially inspired by http://www.cse.yorku.ca/~amana/research/grid.pdf
+template <typename Action_T>
+void gridRaycast(Action_T &quadAction, const btVector3 &beginPos, const btVector3 &endPos)
+{
+ GridRaycastState rs;
+ rs.maxDistance3d = beginPos.distance(endPos);
+ if (rs.maxDistance3d < 0.0001)
+ // Consider the ray is too small to hit anything
+ return;
+
+ btScalar rayDirectionFlatX = endPos[0] - beginPos[0];
+ btScalar rayDirectionFlatZ = endPos[2] - beginPos[2];
+ rs.maxDistanceFlat = btSqrt(rayDirectionFlatX * rayDirectionFlatX + rayDirectionFlatZ * rayDirectionFlatZ);
+
+ if(rs.maxDistanceFlat < 0.0001)
+ {
+ // Consider the ray vertical
+ rayDirectionFlatX = 0;
+ rayDirectionFlatZ = 0;
+ }
+ else
+ {
+ rayDirectionFlatX /= rs.maxDistanceFlat;
+ rayDirectionFlatZ /= rs.maxDistanceFlat;
+ }
+
+ const int xiStep = rayDirectionFlatX > 0 ? 1 : rayDirectionFlatX < 0 ? -1 : 0;
+ const int ziStep = rayDirectionFlatZ > 0 ? 1 : rayDirectionFlatZ < 0 ? -1 : 0;
+
+ const float infinite = 9999999;
+ const btScalar paramDeltaX = xiStep != 0 ? 1.f / btFabs(rayDirectionFlatX) : infinite;
+ const btScalar paramDeltaZ = ziStep != 0 ? 1.f / btFabs(rayDirectionFlatZ) : infinite;
+
+ // pos = param * dir
+ btScalar paramCrossX; // At which value of `param` we will cross a x-axis lane?
+ btScalar paramCrossZ; // At which value of `param` we will cross a z-axis lane?
+
+ // paramCrossX and paramCrossZ are initialized as being the first cross
+ // X initialization
+ if (xiStep != 0)
+ {
+ if (xiStep == 1)
+ paramCrossX = (ceil(beginPos[0]) - beginPos[0]) * paramDeltaX;
+ else
+ paramCrossX = (beginPos[0] - floor(beginPos[0])) * paramDeltaX;
+ }
+ else
+ paramCrossX = infinite; // Will never cross on X
+
+ // Z initialization
+ if (ziStep != 0)
+ {
+ if (ziStep == 1)
+ paramCrossZ = (ceil(beginPos[2]) - beginPos[2]) * paramDeltaZ;
+ else
+ paramCrossZ = (beginPos[2] - floor(beginPos[2])) * paramDeltaZ;
+ }
+ else
+ paramCrossZ = infinite; // Will never cross on Z
+
+ rs.x = static_cast<int>(floor(beginPos[0]));
+ rs.z = static_cast<int>(floor(beginPos[2]));
+
+ // Workaround cases where the ray starts at an integer position
+ if (paramCrossX == 0.0)
+ {
+ paramCrossX += paramDeltaX;
+ // If going backwards, we should ignore the position we would get by the above flooring,
+ // because the ray is not heading in that direction
+ if (xiStep == -1)
+ rs.x -= 1;
+ }
+
+ if (paramCrossZ == 0.0)
+ {
+ paramCrossZ += paramDeltaZ;
+ if (ziStep == -1)
+ rs.z -= 1;
+ }
+
+ rs.prev_x = rs.x;
+ rs.prev_z = rs.z;
+ rs.param = 0;
+
+ while (true)
+ {
+ rs.prev_x = rs.x;
+ rs.prev_z = rs.z;
+ rs.prevParam = rs.param;
+
+ if (paramCrossX < paramCrossZ)
+ {
+ // X lane
+ rs.x += xiStep;
+ // Assign before advancing the param,
+ // to be in sync with the initialization step
+ rs.param = paramCrossX;
+ paramCrossX += paramDeltaX;
+ }
+ else
+ {
+ // Z lane
+ rs.z += ziStep;
+ rs.param = paramCrossZ;
+ paramCrossZ += paramDeltaZ;
+ }
+
+ if (rs.param > rs.maxDistanceFlat)
+ {
+ rs.param = rs.maxDistanceFlat;
+ quadAction(rs);
+ break;
+ }
+ else
+ quadAction(rs);
+ }
+}
+
+
+struct ProcessTrianglesAction
+{
+ const btHeightfieldTerrainShape *shape;
+ bool flipQuadEdges;
+ bool useDiamondSubdivision;
+ int width;
+ int length;
+ btTriangleCallback* callback;
+
+ void exec(int x, int z) const
+ {
+ if(x < 0 || z < 0 || x >= width || z >= length)
+ return;
+
+ btVector3 vertices[3];
+
+ // Check quad
+ if (flipQuadEdges || (useDiamondSubdivision && (((z + x) & 1) > 0)))
+ {
+ // First triangle
+ shape->getVertex(x, z, vertices[0]);
+ shape->getVertex(x + 1, z, vertices[1]);
+ shape->getVertex(x + 1, z + 1, vertices[2]);
+ callback->processTriangle(vertices, x, z);
+
+ // Second triangle
+ shape->getVertex(x, z, vertices[0]);
+ shape->getVertex(x + 1, z + 1, vertices[1]);
+ shape->getVertex(x, z + 1, vertices[2]);
+ callback->processTriangle(vertices, x, z);
+ }
+ else
+ {
+ // First triangle
+ shape->getVertex(x, z, vertices[0]);
+ shape->getVertex(x, z + 1, vertices[1]);
+ shape->getVertex(x + 1, z, vertices[2]);
+ callback->processTriangle(vertices, x, z);
+
+ // Second triangle
+ shape->getVertex(x + 1, z, vertices[0]);
+ shape->getVertex(x, z + 1, vertices[1]);
+ shape->getVertex(x + 1, z + 1, vertices[2]);
+ callback->processTriangle(vertices, x, z);
+ }
+ }
+
+ void operator ()(const GridRaycastState &bs) const
+ {
+ exec(bs.prev_x, bs.prev_z);
+ }
+};
+
+
+struct ProcessVBoundsAction
+{
+ const btHeightfieldTerrainShape::Range *vbounds;
+ int width;
+ int length;
+ int chunkSize;
+
+ btVector3 rayBegin;
+ btVector3 rayEnd;
+ btVector3 rayDir;
+
+ ProcessTrianglesAction processTriangles;
+
+ void operator ()(const GridRaycastState &rs) const
+ {
+ int x = rs.prev_x;
+ int z = rs.prev_z;
+
+ if(x < 0 || z < 0 || x >= width || z >= length)
+ return;
+
+ const btHeightfieldTerrainShape::Range chunk = vbounds[x + z * width];
+
+ btVector3 enterPos;
+ btVector3 exitPos;
+
+ if (rs.maxDistanceFlat > 0.0001)
+ {
+ btScalar flatTo3d = chunkSize * rs.maxDistance3d / rs.maxDistanceFlat;
+ btScalar enterParam3d = rs.prevParam * flatTo3d;
+ btScalar exitParam3d = rs.param * flatTo3d;
+ enterPos = rayBegin + rayDir * enterParam3d;
+ exitPos = rayBegin + rayDir * exitParam3d;
+
+ // We did enter the flat projection of the AABB,
+ // but we have to check if we intersect it on the vertical axis
+ if (enterPos[1] > chunk.max && exitPos[1] > chunk.max)
+ return;
+ if (enterPos[1] < chunk.min && exitPos[1] < chunk.min)
+ return;
+ }
+ else
+ {
+ // Consider the ray vertical
+ // (though we shouldn't reach this often because there is an early check up-front)
+ enterPos = rayBegin;
+ exitPos = rayEnd;
+ }
+
+ gridRaycast(processTriangles, enterPos, exitPos);
+ // Note: it could be possible to have more than one grid at different levels,
+ // to do this there would be a branch using a pointer to another ProcessVBoundsAction
+ }
+};
+
+
+// TODO How do I interrupt the ray when there is a hit? `callback` does not return any result
+/// Performs a raycast using a hierarchical Bresenham algorithm.
+/// Does not allocate any memory by itself.
+void btHeightfieldTerrainShape::performRaycast(btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget) const
+{
+ // Transform to cell-local
+ btVector3 beginPos = raySource / m_localScaling;
+ btVector3 endPos = rayTarget / m_localScaling;
+ beginPos += m_localOrigin;
+ endPos += m_localOrigin;
+
+ ProcessTrianglesAction processTriangles;
+ processTriangles.shape = this;
+ processTriangles.flipQuadEdges = m_flipQuadEdges;
+ processTriangles.useDiamondSubdivision = m_useDiamondSubdivision;
+ processTriangles.callback = callback;
+ processTriangles.width = m_heightStickWidth - 1;
+ processTriangles.length = m_heightStickLength - 1;
+
+ // TODO Transform vectors to account for m_upAxis
+ int iBeginX = static_cast<int>(floor(beginPos[0]));
+ int iBeginZ = static_cast<int>(floor(beginPos[2]));
+ int iEndX = static_cast<int>(floor(endPos[0]));
+ int iEndZ = static_cast<int>(floor(endPos[2]));
+
+ if (iBeginX == iEndX && iBeginZ == iEndZ)
+ {
+ // The ray will never cross quads within the plane,
+ // so directly process triangles within one quad
+ // (typically, vertical rays should end up here)
+ processTriangles.exec(iBeginX, iEndZ);
+ return;
+ }
+
+ if (m_vboundsGrid == NULL)
+ {
+ // Process all quads intersecting the flat projection of the ray
+ gridRaycast(processTriangles, beginPos, endPos);
+ }
+ else
+ {
+ btVector3 rayDiff = endPos - beginPos;
+ btScalar flatDistance2 = rayDiff[0] * rayDiff[0] + rayDiff[2] * rayDiff[2];
+ if (flatDistance2 < m_vboundsChunkSize * m_vboundsChunkSize)
+ {
+ // Don't use chunks, the ray is too short in the plane
+ gridRaycast(processTriangles, beginPos, endPos);
+ }
+
+ ProcessVBoundsAction processVBounds;
+ processVBounds.width = m_vboundsGridWidth;
+ processVBounds.length = m_vboundsGridLength;
+ processVBounds.vbounds = m_vboundsGrid;
+ processVBounds.rayBegin = beginPos;
+ processVBounds.rayEnd = endPos;
+ processVBounds.rayDir = rayDiff.normalized();
+ processVBounds.processTriangles = processTriangles;
+ processVBounds.chunkSize = m_vboundsChunkSize;
+ // The ray is long, run raycast on a higher-level grid
+ gridRaycast(processVBounds, beginPos / m_vboundsChunkSize, endPos / m_vboundsChunkSize);
+ }
+}
+
+
+/// Builds a grid data structure storing the min and max heights of the terrain in chunks.
+/// if chunkSize is zero, that accelerator is removed.
+/// If you modify the heights, you need to rebuild this accelerator.
+void btHeightfieldTerrainShape::buildAccelerator(int chunkSize)
+{
+ if (chunkSize <= 0)
+ {
+ clearAccelerator();
+ return;
+ }
+
+ m_vboundsChunkSize = chunkSize;
+ int nChunksX = m_heightStickWidth / chunkSize;
+ int nChunksZ = m_heightStickLength / chunkSize;
+
+ if (m_heightStickWidth % chunkSize > 0)
+ ++nChunksX; // In case terrain size isn't dividable by chunk size
+ if (m_heightStickLength % chunkSize > 0)
+ ++nChunksZ;
+
+ if(m_vboundsGridWidth != nChunksX || m_vboundsGridLength != nChunksZ)
+ {
+ clearAccelerator();
+ m_vboundsGridWidth = nChunksX;
+ m_vboundsGridLength = nChunksZ;
+ }
+
+ if (nChunksX == 0 || nChunksZ == 0)
+ return;
+
+ // TODO What is the recommended way to allocate this?
+ // This data structure is only reallocated if the required size changed
+ if (m_vboundsGrid == NULL)
+ m_vboundsGrid = new Range[nChunksX * nChunksZ];
+
+ // Compute min and max height for all chunks
+ for (int cz = 0; cz < nChunksZ; ++cz)
+ {
+ int z0 = cz * chunkSize;
+
+ for (int cx = 0; cx < nChunksX; ++cx)
+ {
+ int x0 = cx * chunkSize;
+
+ Range r;
+
+ r.min = getRawHeightFieldValue(x0, z0);
+ r.max = r.min;
+
+ // Compute min and max height for this chunk.
+ // We have to include one extra cell to account for neighbors.
+ // Here is why:
+ // Say we have a flat terrain, and a plateau that fits a chunk perfectly.
+ //
+ // Left Right
+ // 0---0---0---1---1---1
+ // | | | | | |
+ // 0---0---0---1---1---1
+ // | | | | | |
+ // 0---0---0---1---1---1
+ // x
+ //
+ // If the AABB for the Left chunk did not share vertices with the Right,
+ // then we would fail collision tests at x due to a gap.
+ //
+ for (int z = z0; z < z0 + chunkSize + 1; ++z)
+ {
+ if (z >= m_heightStickLength)
+ continue;
+
+ for (int x = x0; x < x0 + chunkSize + 1; ++x)
+ {
+ if (x >= m_heightStickWidth)
+ continue;
+
+ btScalar height = getRawHeightFieldValue(x, z);
+
+ if (height < r.min)
+ r.min = height;
+ else if (height > r.max)
+ r.max = height;
+ }
+ }
+
+ m_vboundsGrid[cx + cz * nChunksX] = r;
+ }
+ }
+}
+
+
+void btHeightfieldTerrainShape::clearAccelerator()
+{
+ if (m_vboundsGrid)
+ {
+ // TODO What is the recommended way to deallocate this?
+ delete[] m_vboundsGrid;
+ m_vboundsGrid = 0;
+ }
+}
+
+
diff --git a/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h b/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
index 8a50a57e31..e23b548cb2 100644
--- a/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
+++ b/thirdparty/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
@@ -18,6 +18,7 @@ subject to the following restrictions:
#include "btConcaveShape.h"
+
///btHeightfieldTerrainShape simulates a 2D heightfield terrain
/**
The caller is responsible for maintaining the heightfield array; this
@@ -71,6 +72,12 @@ subject to the following restrictions:
ATTRIBUTE_ALIGNED16(class)
btHeightfieldTerrainShape : public btConcaveShape
{
+public:
+ struct Range {
+ btScalar min;
+ btScalar max;
+ };
+
protected:
btVector3 m_localAabbMin;
btVector3 m_localAabbMax;
@@ -100,9 +107,14 @@ protected:
btVector3 m_localScaling;
+ // Accelerator
+ Range *m_vboundsGrid;
+ int m_vboundsGridWidth;
+ int m_vboundsGridLength;
+ int m_vboundsChunkSize;
+
virtual btScalar getRawHeightFieldValue(int x, int y) const;
void quantizeWithClamp(int* out, const btVector3& point, int isMax) const;
- void getVertex(int x, int y, btVector3& vertex) const;
/// protected initialization
/**
@@ -154,6 +166,13 @@ public:
virtual void setLocalScaling(const btVector3& scaling);
virtual const btVector3& getLocalScaling() const;
+
+ void getVertex(int x,int y,btVector3& vertex) const;
+
+ void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget) const;
+
+ void buildAccelerator(int chunkSize=16);
+ void clearAccelerator();
//debugging
virtual const char* getName() const { return "HEIGHTFIELD"; }
diff --git a/thirdparty/cvtt/LICENSE.txt b/thirdparty/cvtt/LICENSE.txt
index 6964f6e43f..d79aec44e3 100644
--- a/thirdparty/cvtt/LICENSE.txt
+++ b/thirdparty/cvtt/LICENSE.txt
@@ -1,45 +1,45 @@
-Convection Texture Tools Stand-Alone Kernels
-
-Copyright (c) 2018 Eric Lasota
-
-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.
-
-**************************************************************************
-
-Based on DirectX Texture Library
-
-Copyright (c) 2018 Microsoft Corp
-
-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
+Convection Texture Tools Stand-Alone Kernels
+
+Copyright (c) 2018 Eric Lasota
+
+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.
+
+**************************************************************************
+
+Based on DirectX Texture Library
+
+Copyright (c) 2018 Microsoft Corp
+
+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. \ No newline at end of file
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp
index 2e1519b7b2..822a294781 100644
--- a/thirdparty/enet/godot.cpp
+++ b/thirdparty/enet/godot.cpp
@@ -95,7 +95,6 @@ ENetSocket enet_socket_create(ENetSocketType type) {
NetSocket *socket = NetSocket::create();
IP::Type ip_type = IP::TYPE_ANY;
socket->open(NetSocket::TYPE_UDP, ip_type);
- socket->set_blocking_enabled(false);
return socket;
}
@@ -216,6 +215,46 @@ int enet_socket_listen(ENetSocket socket, int backlog) {
int enet_socket_set_option(ENetSocket socket, ENetSocketOption option, int value) {
+ NetSocket *sock = (NetSocket *)socket;
+
+ switch (option) {
+ case ENET_SOCKOPT_NONBLOCK: {
+ sock->set_blocking_enabled(value ? false : true);
+ return 0;
+ } break;
+
+ case ENET_SOCKOPT_BROADCAST: {
+ sock->set_broadcasting_enabled(value ? true : false);
+ return 0;
+ } break;
+
+ case ENET_SOCKOPT_REUSEADDR: {
+ sock->set_reuse_address_enabled(value ? true : false);
+ return 0;
+ } break;
+
+ case ENET_SOCKOPT_RCVBUF: {
+ return -1;
+ } break;
+
+ case ENET_SOCKOPT_SNDBUF: {
+ return -1;
+ } break;
+
+ case ENET_SOCKOPT_RCVTIMEO: {
+ return -1;
+ } break;
+
+ case ENET_SOCKOPT_SNDTIMEO: {
+ return -1;
+ } break;
+
+ case ENET_SOCKOPT_NODELAY: {
+ sock->set_tcp_no_delay_enabled(value ? true : false);
+ return 0;
+ } break;
+ }
+
return -1;
}
diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c
index e7c64a7e17..9704c1079f 100644
--- a/thirdparty/glad/glad.c
+++ b/thirdparty/glad/glad.c
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.29 on Mon Mar 4 12:47:22 2019.
+ OpenGL loader generated by glad 0.1.29 on Wed May 1 23:16:34 2019.
Language/Generator: C/C++
Specification: gl
@@ -9,6 +9,8 @@
Extensions:
GL_ARB_debug_output,
GL_ARB_framebuffer_object,
+ GL_EXT_framebuffer_blit,
+ GL_EXT_framebuffer_multisample,
GL_EXT_framebuffer_object
Loader: True
Local files: False
@@ -16,9 +18,9 @@
Reproducible: False
Commandline:
- --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
+ --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_EXT_framebuffer_blit,GL_EXT_framebuffer_multisample,GL_EXT_framebuffer_object"
Online:
- https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
+ https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_blit&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_framebuffer_object
*/
#include <stdio.h>
@@ -992,11 +994,15 @@ PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL;
PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL;
int GLAD_GL_ARB_debug_output = 0;
int GLAD_GL_ARB_framebuffer_object = 0;
+int GLAD_GL_EXT_framebuffer_blit = 0;
+int GLAD_GL_EXT_framebuffer_multisample = 0;
int GLAD_GL_EXT_framebuffer_object = 0;
PFNGLDEBUGMESSAGECONTROLARBPROC glad_glDebugMessageControlARB = NULL;
PFNGLDEBUGMESSAGEINSERTARBPROC glad_glDebugMessageInsertARB = NULL;
PFNGLDEBUGMESSAGECALLBACKARBPROC glad_glDebugMessageCallbackARB = NULL;
PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB = NULL;
+PFNGLBLITFRAMEBUFFEREXTPROC glad_glBlitFramebufferEXT = NULL;
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT = NULL;
PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT = NULL;
PFNGLBINDRENDERBUFFEREXTPROC glad_glBindRenderbufferEXT = NULL;
PFNGLDELETERENDERBUFFERSEXTPROC glad_glDeleteRenderbuffersEXT = NULL;
@@ -1807,6 +1813,14 @@ static void load_GL_ARB_framebuffer_object(GLADloadproc load) {
glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample");
glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer");
}
+static void load_GL_EXT_framebuffer_blit(GLADloadproc load) {
+ if(!GLAD_GL_EXT_framebuffer_blit) return;
+ glad_glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)load("glBlitFramebufferEXT");
+}
+static void load_GL_EXT_framebuffer_multisample(GLADloadproc load) {
+ if(!GLAD_GL_EXT_framebuffer_multisample) return;
+ glad_glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)load("glRenderbufferStorageMultisampleEXT");
+}
static void load_GL_EXT_framebuffer_object(GLADloadproc load) {
if(!GLAD_GL_EXT_framebuffer_object) return;
glad_glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)load("glIsRenderbufferEXT");
@@ -1831,6 +1845,8 @@ static int find_extensionsGL(void) {
if (!get_exts()) return 0;
GLAD_GL_ARB_debug_output = has_ext("GL_ARB_debug_output");
GLAD_GL_ARB_framebuffer_object = has_ext("GL_ARB_framebuffer_object");
+ GLAD_GL_EXT_framebuffer_blit = has_ext("GL_EXT_framebuffer_blit");
+ GLAD_GL_EXT_framebuffer_multisample = has_ext("GL_EXT_framebuffer_multisample");
GLAD_GL_EXT_framebuffer_object = has_ext("GL_EXT_framebuffer_object");
free_exts();
return 1;
@@ -1912,6 +1928,8 @@ int gladLoadGLLoader(GLADloadproc load) {
if (!find_extensionsGL()) return 0;
load_GL_ARB_debug_output(load);
load_GL_ARB_framebuffer_object(load);
+ load_GL_EXT_framebuffer_blit(load);
+ load_GL_EXT_framebuffer_multisample(load);
load_GL_EXT_framebuffer_object(load);
return GLVersion.major != 0 || GLVersion.minor != 0;
}
diff --git a/thirdparty/glad/glad/glad.h b/thirdparty/glad/glad/glad.h
index 6345de6f7a..b398faf627 100644
--- a/thirdparty/glad/glad/glad.h
+++ b/thirdparty/glad/glad/glad.h
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.29 on Mon Mar 4 12:47:22 2019.
+ OpenGL loader generated by glad 0.1.29 on Wed May 1 23:16:34 2019.
Language/Generator: C/C++
Specification: gl
@@ -9,6 +9,8 @@
Extensions:
GL_ARB_debug_output,
GL_ARB_framebuffer_object,
+ GL_EXT_framebuffer_blit,
+ GL_EXT_framebuffer_multisample,
GL_EXT_framebuffer_object
Loader: True
Local files: False
@@ -16,9 +18,9 @@
Reproducible: False
Commandline:
- --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
+ --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_EXT_framebuffer_blit,GL_EXT_framebuffer_multisample,GL_EXT_framebuffer_object"
Online:
- https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
+ https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_blit&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_framebuffer_object
*/
@@ -3633,6 +3635,13 @@ GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv;
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
+#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
@@ -3704,6 +3713,20 @@ GLAPI PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB;
#define GL_ARB_framebuffer_object 1
GLAPI int GLAD_GL_ARB_framebuffer_object;
#endif
+#ifndef GL_EXT_framebuffer_blit
+#define GL_EXT_framebuffer_blit 1
+GLAPI int GLAD_GL_EXT_framebuffer_blit;
+typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GLAPI PFNGLBLITFRAMEBUFFEREXTPROC glad_glBlitFramebufferEXT;
+#define glBlitFramebufferEXT glad_glBlitFramebufferEXT
+#endif
+#ifndef GL_EXT_framebuffer_multisample
+#define GL_EXT_framebuffer_multisample 1
+GLAPI int GLAD_GL_EXT_framebuffer_multisample;
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT;
+#define glRenderbufferStorageMultisampleEXT glad_glRenderbufferStorageMultisampleEXT
+#endif
#ifndef GL_EXT_framebuffer_object
#define GL_EXT_framebuffer_object 1
GLAPI int GLAD_GL_EXT_framebuffer_object;
diff --git a/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp b/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp
index c9e71eb733..b5824b17be 100644
--- a/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp
+++ b/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp
@@ -122,6 +122,7 @@ bool OpusVorbisDecoder::getPCMS16(WebMFrame &frame, short *buffer, int &numOutSa
return false;
}
+// -- GODOT begin --
bool OpusVorbisDecoder::getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples) {
if (m_vorbis) {
m_vorbis->op.packet = frame.buffer;
@@ -158,6 +159,7 @@ bool OpusVorbisDecoder::getPCMF(WebMFrame &frame, float *buffer, int &numOutSamp
}
return false;
}
+// -- GODOT end --
bool OpusVorbisDecoder::openVorbis(const WebMDemuxer &demuxer)
{
diff --git a/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp b/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
index b7619d6a25..f285b3fbd6 100644
--- a/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
+++ b/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
@@ -44,8 +44,10 @@ public:
{
return m_numSamples;
}
- bool getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples);
bool getPCMS16(WebMFrame &frame, short *buffer, int &numOutSamples);
+// -- GODOT begin --
+ bool getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples);
+// -- GODOT end --
private:
bool openVorbis(const WebMDemuxer &demuxer);
diff --git a/thirdparty/libsimplewebm/VPXDecoder.cpp b/thirdparty/libsimplewebm/VPXDecoder.cpp
index 3f77b8f5cd..e2606f83ba 100644
--- a/thirdparty/libsimplewebm/VPXDecoder.cpp
+++ b/thirdparty/libsimplewebm/VPXDecoder.cpp
@@ -33,7 +33,8 @@
VPXDecoder::VPXDecoder(const WebMDemuxer &demuxer, unsigned threads) :
m_ctx(NULL),
m_iter(NULL),
- m_delay(0)
+ m_delay(0),
+ m_last_space(VPX_CS_UNKNOWN)
{
if (threads > 8)
threads = 8;
@@ -86,6 +87,11 @@ VPXDecoder::IMAGE_ERROR VPXDecoder::getImage(Image &image)
IMAGE_ERROR err = NO_FRAME;
if (vpx_image_t *img = vpx_codec_get_frame(m_ctx, &m_iter))
{
+ // It seems to be a common problem that UNKNOWN comes up a lot, yet FFMPEG is somehow getting accurate colour-space information.
+ // After checking FFMPEG code, *they're* getting colour-space information, so I'm assuming something like this is going on.
+ // It appears to work, at least.
+ if (img->cs != VPX_CS_UNKNOWN)
+ m_last_space = img->cs;
if ((img->fmt & VPX_IMG_FMT_PLANAR) && !(img->fmt & (VPX_IMG_FMT_HAS_ALPHA | VPX_IMG_FMT_HIGHBITDEPTH)))
{
if (img->stride[0] && img->stride[1] && img->stride[2])
@@ -95,6 +101,7 @@ VPXDecoder::IMAGE_ERROR VPXDecoder::getImage(Image &image)
image.w = img->d_w;
image.h = img->d_h;
+ image.cs = m_last_space;
image.chromaShiftW = img->x_chroma_shift;
image.chromaShiftH = img->y_chroma_shift;
@@ -119,7 +126,9 @@ VPXDecoder::IMAGE_ERROR VPXDecoder::getImage(Image &image)
/**/
+// -- GODOT begin --
#if 0
+// -- GODOT end --
static inline int ceilRshift(int val, int shift)
{
@@ -139,4 +148,7 @@ int VPXDecoder::Image::getHeight(int plane) const
return ceilRshift(h, chromaShiftH);
}
+// -- GODOT begin --
#endif
+// -- GODOT end --
+
diff --git a/thirdparty/libsimplewebm/VPXDecoder.hpp b/thirdparty/libsimplewebm/VPXDecoder.hpp
index 6108395871..5071b069cb 100644
--- a/thirdparty/libsimplewebm/VPXDecoder.hpp
+++ b/thirdparty/libsimplewebm/VPXDecoder.hpp
@@ -37,12 +37,17 @@ public:
class Image
{
public:
+// -- GODOT begin --
#if 0
+// -- GODOT end --
int getWidth(int plane) const;
int getHeight(int plane) const;
+// -- GODOT begin --
#endif
+// -- GODOT end --
int w, h;
+ int cs;
int chromaShiftW, chromaShiftH;
unsigned char *planes[3];
int linesize[3];
@@ -75,6 +80,7 @@ private:
vpx_codec_ctx *m_ctx;
const void *m_iter;
int m_delay;
+ int m_last_space;
};
#endif // VPXDECODER_HPP
diff --git a/thirdparty/libwebsockets/lib/core/alloc.c b/thirdparty/libwebsockets/core/alloc.c
index f169fc3767..f169fc3767 100644
--- a/thirdparty/libwebsockets/lib/core/alloc.c
+++ b/thirdparty/libwebsockets/core/alloc.c
diff --git a/thirdparty/libwebsockets/lib/core/context.c b/thirdparty/libwebsockets/core/context.c
index 94b2d86339..7be004df33 100644
--- a/thirdparty/libwebsockets/lib/core/context.c
+++ b/thirdparty/libwebsockets/core/context.c
@@ -35,9 +35,6 @@ const struct lws_role_ops *available_roles[] = {
#if defined(LWS_ROLE_WS)
&role_ops_ws,
#endif
-#if defined(LWS_ROLE_DBUS)
- &role_ops_dbus,
-#endif
NULL
};
@@ -89,57 +86,6 @@ lws_role_call_alpn_negotiated(struct lws *wsi, const char *alpn)
return 0;
}
-#if !defined(LWS_WITHOUT_SERVER)
-int
-lws_role_call_adoption_bind(struct lws *wsi, int type, const char *prot)
-{
- LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
- if (ar->adoption_bind)
- if (ar->adoption_bind(wsi, type, prot))
- return 0;
- LWS_FOR_EVERY_AVAILABLE_ROLE_END;
-
- /* fall back to raw socket role if, eg, h1 not configured */
-
- if (role_ops_raw_skt.adoption_bind &&
- role_ops_raw_skt.adoption_bind(wsi, type, prot))
- return 0;
-
- /* fall back to raw file role if, eg, h1 not configured */
-
- if (role_ops_raw_file.adoption_bind &&
- role_ops_raw_file.adoption_bind(wsi, type, prot))
- return 0;
-
- return 1;
-}
-#endif
-
-#if !defined(LWS_WITHOUT_CLIENT)
-int
-lws_role_call_client_bind(struct lws *wsi,
- const struct lws_client_connect_info *i)
-{
- LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
- if (ar->client_bind) {
- int m = ar->client_bind(wsi, i);
- if (m < 0)
- return m;
- if (m)
- return 0;
- }
- LWS_FOR_EVERY_AVAILABLE_ROLE_END;
-
- /* fall back to raw socket role if, eg, h1 not configured */
-
- if (role_ops_raw_skt.client_bind &&
- role_ops_raw_skt.client_bind(wsi, i))
- return 0;
-
- return 1;
-}
-#endif
-
static const char * const mount_protocols[] = {
"http://",
"https://",
@@ -317,10 +263,8 @@ lws_protocol_init(struct lws_context *context)
(void *)pvo, 0)) {
lws_free(vh->protocol_vh_privs[n]);
vh->protocol_vh_privs[n] = NULL;
- lwsl_err("%s: protocol %s failed init\n",
- __func__, vh->protocols[n].name);
-
- return 1;
+ lwsl_err("%s: protocol %s failed init\n", __func__,
+ vh->protocols[n].name);
}
}
@@ -342,6 +286,229 @@ next:
return 0;
}
+LWS_VISIBLE int
+lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
+ void *user, void *in, size_t len)
+{
+ struct lws_ssl_info *si;
+#ifdef LWS_WITH_CGI
+ struct lws_cgi_args *args;
+#endif
+#if defined(LWS_WITH_CGI) || defined(LWS_WITH_HTTP_PROXY)
+ char buf[512];
+ int n;
+#endif
+
+ switch (reason) {
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ case LWS_CALLBACK_HTTP:
+#ifndef LWS_NO_SERVER
+ if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL))
+ return -1;
+
+ if (lws_http_transaction_completed(wsi))
+#endif
+ return -1;
+ break;
+#if !defined(LWS_NO_SERVER)
+ case LWS_CALLBACK_HTTP_FILE_COMPLETION:
+ if (lws_http_transaction_completed(wsi))
+ return -1;
+ break;
+#endif
+
+ case LWS_CALLBACK_HTTP_WRITEABLE:
+#ifdef LWS_WITH_CGI
+ if (wsi->reason_bf & (LWS_CB_REASON_AUX_BF__CGI_HEADERS |
+ LWS_CB_REASON_AUX_BF__CGI)) {
+ n = lws_cgi_write_split_stdout_headers(wsi);
+ if (n < 0) {
+ lwsl_debug("AUX_BF__CGI forcing close\n");
+ return -1;
+ }
+ if (!n)
+ lws_rx_flow_control(
+ wsi->http.cgi->stdwsi[LWS_STDOUT], 1);
+
+ if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_HEADERS)
+ wsi->reason_bf &=
+ ~LWS_CB_REASON_AUX_BF__CGI_HEADERS;
+ else
+ wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__CGI;
+ break;
+ }
+
+ if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_CHUNK_END) {
+ if (!wsi->http2_substream) {
+ memcpy(buf + LWS_PRE, "0\x0d\x0a\x0d\x0a", 5);
+ lwsl_debug("writing chunk term and exiting\n");
+ n = lws_write(wsi, (unsigned char *)buf +
+ LWS_PRE, 5, LWS_WRITE_HTTP);
+ } else
+ n = lws_write(wsi, (unsigned char *)buf +
+ LWS_PRE, 0,
+ LWS_WRITE_HTTP_FINAL);
+
+ /* always close after sending it */
+ return -1;
+ }
+#endif
+#if defined(LWS_WITH_HTTP_PROXY)
+ if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__PROXY) {
+ char *px = buf + LWS_PRE;
+ int lenx = sizeof(buf) - LWS_PRE;
+
+ /*
+ * our sink is writeable and our source has something
+ * to read. So read a lump of source material of
+ * suitable size to send or what's available, whichever
+ * is the smaller.
+ */
+ wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__PROXY;
+ if (!lws_get_child(wsi))
+ break;
+ if (lws_http_client_read(lws_get_child(wsi), &px,
+ &lenx) < 0)
+ return -1;
+ break;
+ }
+#endif
+ break;
+
+#if defined(LWS_WITH_HTTP_PROXY)
+ case LWS_CALLBACK_RECEIVE_CLIENT_HTTP:
+ assert(lws_get_parent(wsi));
+ if (!lws_get_parent(wsi))
+ break;
+ lws_get_parent(wsi)->reason_bf |= LWS_CB_REASON_AUX_BF__PROXY;
+ lws_callback_on_writable(lws_get_parent(wsi));
+ break;
+
+ case LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ:
+ assert(lws_get_parent(wsi));
+ n = lws_write(lws_get_parent(wsi), (unsigned char *)in,
+ len, LWS_WRITE_HTTP);
+ if (n < 0)
+ return -1;
+ break;
+
+ case LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP: {
+ unsigned char *p, *end;
+ char ctype[64], ctlen = 0;
+
+ p = (unsigned char *)buf + LWS_PRE;
+ end = p + sizeof(buf) - LWS_PRE;
+
+ if (lws_add_http_header_status(lws_get_parent(wsi),
+ HTTP_STATUS_OK, &p, end))
+ return 1;
+ if (lws_add_http_header_by_token(lws_get_parent(wsi),
+ WSI_TOKEN_HTTP_SERVER,
+ (unsigned char *)"libwebsockets",
+ 13, &p, end))
+ return 1;
+
+ ctlen = lws_hdr_copy(wsi, ctype, sizeof(ctype),
+ WSI_TOKEN_HTTP_CONTENT_TYPE);
+ if (ctlen > 0) {
+ if (lws_add_http_header_by_token(lws_get_parent(wsi),
+ WSI_TOKEN_HTTP_CONTENT_TYPE,
+ (unsigned char *)ctype, ctlen, &p, end))
+ return 1;
+ }
+
+ if (lws_finalize_http_header(lws_get_parent(wsi), &p, end))
+ return 1;
+
+ *p = '\0';
+ n = lws_write(lws_get_parent(wsi),
+ (unsigned char *)buf + LWS_PRE,
+ p - ((unsigned char *)buf + LWS_PRE),
+ LWS_WRITE_HTTP_HEADERS);
+ if (n < 0)
+ return -1;
+
+ break; }
+
+#endif
+
+#ifdef LWS_WITH_CGI
+ /* CGI IO events (POLLIN/OUT) appear here, our default policy is:
+ *
+ * - POST data goes on subprocess stdin
+ * - subprocess stdout goes on http via writeable callback
+ * - subprocess stderr goes to the logs
+ */
+ case LWS_CALLBACK_CGI:
+ args = (struct lws_cgi_args *)in;
+ switch (args->ch) { /* which of stdin/out/err ? */
+ case LWS_STDIN:
+ /* TBD stdin rx flow control */
+ break;
+ case LWS_STDOUT:
+ /* quench POLLIN on STDOUT until MASTER got writeable */
+ lws_rx_flow_control(args->stdwsi[LWS_STDOUT], 0);
+ wsi->reason_bf |= LWS_CB_REASON_AUX_BF__CGI;
+ /* when writing to MASTER would not block */
+ lws_callback_on_writable(wsi);
+ break;
+ case LWS_STDERR:
+ n = lws_get_socket_fd(args->stdwsi[LWS_STDERR]);
+ if (n < 0)
+ break;
+ n = read(n, buf, sizeof(buf) - 2);
+ if (n > 0) {
+ if (buf[n - 1] != '\n')
+ buf[n++] = '\n';
+ buf[n] = '\0';
+ lwsl_notice("CGI-stderr: %s\n", buf);
+ }
+ break;
+ }
+ break;
+
+ case LWS_CALLBACK_CGI_TERMINATED:
+ lwsl_debug("LWS_CALLBACK_CGI_TERMINATED: %d %" PRIu64 "\n",
+ wsi->http.cgi->explicitly_chunked,
+ (uint64_t)wsi->http.cgi->content_length);
+ if (!wsi->http.cgi->explicitly_chunked &&
+ !wsi->http.cgi->content_length) {
+ /* send terminating chunk */
+ lwsl_debug("LWS_CALLBACK_CGI_TERMINATED: ending\n");
+ wsi->reason_bf |= LWS_CB_REASON_AUX_BF__CGI_CHUNK_END;
+ lws_callback_on_writable(wsi);
+ lws_set_timeout(wsi, PENDING_TIMEOUT_CGI, 3);
+ break;
+ }
+ return -1;
+
+ case LWS_CALLBACK_CGI_STDIN_DATA: /* POST body for stdin */
+ args = (struct lws_cgi_args *)in;
+ args->data[args->len] = '\0';
+ n = lws_get_socket_fd(args->stdwsi[LWS_STDIN]);
+ if (n < 0)
+ return -1;
+ n = write(n, args->data, args->len);
+ if (n < args->len)
+ lwsl_notice("LWS_CALLBACK_CGI_STDIN_DATA: "
+ "sent %d only %d went", n, args->len);
+ return n;
+#endif
+#endif
+ case LWS_CALLBACK_SSL_INFO:
+ si = in;
+
+ (void)si;
+ lwsl_notice("LWS_CALLBACK_SSL_INFO: where: 0x%x, ret: 0x%x\n",
+ si->where, si->ret);
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
/* list of supported protocols and callbacks */
@@ -367,6 +534,9 @@ static const struct lws_protocols protocols_dummy[] = {
#undef LWS_HAVE_GETENV
#endif
+static void
+lws_vhost_destroy2(struct lws_vhost *vh);
+
LWS_VISIBLE struct lws_vhost *
lws_create_vhost(struct lws_context *context,
const struct lws_context_creation_info *info)
@@ -425,8 +595,6 @@ lws_create_vhost(struct lws_context *context,
vh->pvo = info->pvo;
vh->headers = info->headers;
vh->user = info->user;
- vh->finalize = info->finalize;
- vh->finalize_arg = info->finalize_arg;
LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
if (ar->init_vhost)
@@ -462,12 +630,10 @@ lws_create_vhost(struct lws_context *context,
n += (int)strlen(info->ssl_private_key_filepath) + 1;
if (n) {
- vh->tls.key_path = vh->tls.alloc_cert_path =
- lws_malloc(n, "vh paths");
+ vh->tls.key_path = vh->tls.alloc_cert_path = lws_malloc(n, "vh paths");
if (info->ssl_cert_filepath) {
n = (int)strlen(info->ssl_cert_filepath) + 1;
- memcpy(vh->tls.alloc_cert_path,
- info->ssl_cert_filepath, n);
+ memcpy(vh->tls.alloc_cert_path, info->ssl_cert_filepath, n);
vh->tls.key_path += n;
}
if (info->ssl_private_key_filepath)
@@ -482,7 +648,7 @@ lws_create_vhost(struct lws_context *context,
*/
lwsp = lws_zalloc(sizeof(struct lws_protocols) * (vh->count_protocols +
context->plugin_protocol_count + 1),
- "vhost-specific plugin table");
+ "vhost-specific plugin table");
if (!lwsp) {
lwsl_err("OOM\n");
return NULL;
@@ -533,15 +699,15 @@ lws_create_vhost(struct lws_context *context,
lws_free(lwsp);
}
- vh->same_vh_protocol_heads = (struct lws_dll_lws *)
- lws_zalloc(sizeof(struct lws_dll_lws) *
- vh->count_protocols, "same vh list");
+ vh->same_vh_protocol_list = (struct lws **)
+ lws_zalloc(sizeof(struct lws *) * vh->count_protocols,
+ "same vh list");
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
vh->http.mount_list = info->mounts;
#endif
#ifdef LWS_WITH_UNIX_SOCK
- if (LWS_UNIX_SOCK_ENABLED(vh)) {
+ if (LWS_UNIX_SOCK_ENABLED(context)) {
lwsl_notice("Creating Vhost '%s' path \"%s\", %d protocols\n",
vh->name, vh->iface, vh->count_protocols);
} else
@@ -559,8 +725,8 @@ lws_create_vhost(struct lws_context *context,
break;
}
lwsl_notice("Creating Vhost '%s' %s, %d protocols, IPv6 %s\n",
- vh->name, buf, vh->count_protocols,
- LWS_IPV6_ENABLED(vh) ? "on" : "off");
+ vh->name, buf, vh->count_protocols,
+ LWS_IPV6_ENABLED(vh) ? "on" : "off");
}
mounts = info->mounts;
while (mounts) {
@@ -667,7 +833,7 @@ lws_create_vhost(struct lws_context *context,
lwsl_err("%s: lws_context_init_client_ssl failed\n", __func__);
goto bail1;
}
- lws_context_lock(context, "create_vhost");
+ lws_context_lock(context);
n = _lws_vhost_init_server(info, vh);
lws_context_unlock(context);
if (n < 0) {
@@ -675,6 +841,7 @@ lws_create_vhost(struct lws_context *context,
goto bail1;
}
+
while (1) {
if (!(*vh1)) {
*vh1 = vh;
@@ -695,6 +862,7 @@ lws_create_vhost(struct lws_context *context,
bail1:
lws_vhost_destroy(vh);
+ lws_vhost_destroy2(vh);
return NULL;
@@ -759,7 +927,7 @@ lws_create_event_pipes(struct lws_context *context)
wsi = lws_zalloc(sizeof(*wsi), "event pipe wsi");
if (!wsi) {
- lwsl_err("%s: Out of mem\n", __func__);
+ lwsl_err("Out of mem\n");
return 1;
}
wsi->context = context;
@@ -787,8 +955,7 @@ lws_create_event_pipes(struct lws_context *context)
lwsl_debug("event pipe fd %d\n", wsi->desc.sockfd);
if (context->event_loop_ops->accept)
- if (context->event_loop_ops->accept(wsi))
- return 1;
+ context->event_loop_ops->accept(wsi);
if (__insert_wsi_socket_into_fds(context, wsi))
return 1;
@@ -806,7 +973,6 @@ lws_destroy_event_pipe(struct lws *wsi)
if (wsi->context->event_loop_ops->wsi_logical_close) {
wsi->context->event_loop_ops->wsi_logical_close(wsi);
lws_plat_pipe_close(wsi);
- wsi->context->count_wsi_allocated--;
return;
}
@@ -830,8 +996,13 @@ lws_create_context(const struct lws_context_creation_info *info)
struct rlimit rt;
#endif
+
+
lwsl_info("Initial logging level %d\n", log_level);
lwsl_info("Libwebsockets version: %s\n", library_version);
+#if defined(GCC_VER)
+ lwsl_info("Compiled with %s\n", GCC_VER);
+#endif
#ifdef LWS_WITH_IPV6
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DISABLE_IPV6))
@@ -882,7 +1053,7 @@ lws_create_context(const struct lws_context_creation_info *info)
#endif
#if LWS_MAX_SMP > 1
- lws_mutex_refcount_init(&context->mr);
+ pthread_mutex_init(&context->lock, NULL);
#endif
#if defined(LWS_WITH_ESP32)
@@ -1042,11 +1213,7 @@ lws_create_context(const struct lws_context_creation_info *info)
if (info->max_http_header_pool)
context->max_http_header_pool = info->max_http_header_pool;
else
- if (info->max_http_header_pool2)
- context->max_http_header_pool =
- info->max_http_header_pool2;
- else
- context->max_http_header_pool = context->max_fds;
+ context->max_http_header_pool = context->max_fds;
if (info->fd_limit_per_thread)
context->fd_limit_per_thread = info->fd_limit_per_thread;
@@ -1084,17 +1251,16 @@ lws_create_context(const struct lws_context_creation_info *info)
return NULL;
}
+
#if defined(LWS_WITH_PEER_LIMITS)
/* scale the peer hash table according to the max fds for the process,
* so that the max list depth averages 16. Eg, 1024 fd -> 64,
* 102400 fd -> 6400
*/
-
context->pl_hash_elements =
(context->count_threads * context->fd_limit_per_thread) / 16;
context->pl_hash_table = lws_zalloc(sizeof(struct lws_peer *) *
context->pl_hash_elements, "peer limits hash table");
-
context->ip_limit_ah = info->ip_limit_ah;
context->ip_limit_wsi = info->ip_limit_wsi;
#endif
@@ -1238,6 +1404,7 @@ LWS_VISIBLE LWS_EXTERN void
lws_context_deprecate(struct lws_context *context, lws_reload_func cb)
{
struct lws_vhost *vh = context->vhost_list, *vh1;
+ struct lws *wsi;
/*
* "deprecation" means disable the context from accepting any new
@@ -1251,8 +1418,7 @@ lws_context_deprecate(struct lws_context *context, lws_reload_func cb)
/* for each vhost, close his listen socket */
while (vh) {
- struct lws *wsi = vh->lserv_wsi;
-
+ wsi = vh->lserv_wsi;
if (wsi) {
wsi->socket_is_permanently_unusable = 1;
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "ctx deprecate");
@@ -1284,29 +1450,24 @@ lws_context_is_deprecated(struct lws_context *context)
void
lws_vhost_destroy1(struct lws_vhost *vh)
{
+ const struct lws_protocols *protocol = NULL;
+ struct lws_context_per_thread *pt;
+ int n, m = vh->context->count_threads;
struct lws_context *context = vh->context;
+ struct lws wsi;
lwsl_info("%s\n", __func__);
- lws_context_lock(context, "vhost destroy 1"); /* ---------- context { */
-
if (vh->being_destroyed)
- goto out;
-
- lws_vhost_lock(vh); /* -------------- vh { */
+ return;
vh->being_destroyed = 1;
/*
- * PHASE 1: take down or reassign any listen wsi
- *
* Are there other vhosts that are piggybacking on our listen socket?
* If so we need to hand the listen socket off to one of the others
- * so it will remain open.
- *
- * If not, leave it attached to the closing vhost, the vh being marked
- * being_destroyed will defeat any service and it will get closed in
- * later phases.
+ * so it will remain open. If not, leave it attached to the closing
+ * vhost and it will get closed.
*/
if (vh->lserv_wsi)
@@ -1327,48 +1488,46 @@ lws_vhost_destroy1(struct lws_vhost *vh)
*/
assert(v->lserv_wsi == NULL);
v->lserv_wsi = vh->lserv_wsi;
+ vh->lserv_wsi = NULL;
+ if (v->lserv_wsi)
+ v->lserv_wsi->vhost = v;
lwsl_notice("%s: listen skt from %s to %s\n",
__func__, vh->name, v->name);
-
- if (v->lserv_wsi) {
- lws_vhost_unbind_wsi(vh->lserv_wsi);
- lws_vhost_bind_wsi(v, v->lserv_wsi);
- }
-
break;
}
} lws_end_foreach_ll(v, vhost_next);
- lws_vhost_unlock(vh); /* } vh -------------- */
-
/*
- * lws_check_deferred_free() will notice there is a vhost that is
- * marked for destruction during the next 1s, for all tsi.
- *
- * It will start closing all wsi on this vhost. When the last wsi
- * is closed, it will trigger lws_vhost_destroy2()
+ * Forcibly close every wsi assoicated with this vhost. That will
+ * include the listen socket if it is still associated with the closing
+ * vhost.
*/
-out:
- lws_context_unlock(context); /* --------------------------- context { */
-}
+ while (m--) {
+ pt = &context->pt[m];
-void
-__lws_vhost_destroy2(struct lws_vhost *vh)
-{
- const struct lws_protocols *protocol = NULL;
- struct lws_context *context = vh->context;
- struct lws_deferred_free *df;
- struct lws wsi;
- int n;
+ for (n = 0; (unsigned int)n < context->pt[m].fds_count; n++) {
+ struct lws *wsi = wsi_from_fd(context, pt->fds[n].fd);
+ if (!wsi)
+ continue;
+ if (wsi->vhost != vh)
+ continue;
+
+ lws_close_free_wsi(wsi,
+ LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY,
+ "vh destroy"
+ /* no protocol close */);
+ n--;
+ }
+ }
/*
* destroy any pending timed events
*/
while (vh->timed_vh_protocol_list)
- __lws_timed_callback_remove(vh, vh->timed_vh_protocol_list);
+ lws_timed_callback_remove(vh, vh->timed_vh_protocol_list);
/*
* let the protocols destroy the per-vhost protocol objects
@@ -1376,7 +1535,7 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
memset(&wsi, 0, sizeof(wsi));
wsi.context = vh->context;
- wsi.vhost = vh; /* not a real bound wsi */
+ wsi.vhost = vh;
protocol = vh->protocols;
if (protocol && vh->created_vhost_protocols) {
n = 0;
@@ -1404,6 +1563,15 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
vh->vhost_next = vh->context->vhost_pending_destruction_list;
vh->context->vhost_pending_destruction_list = vh;
+}
+
+static void
+lws_vhost_destroy2(struct lws_vhost *vh)
+{
+ const struct lws_protocols *protocol = NULL;
+ struct lws_context *context = vh->context;
+ struct lws_deferred_free *df;
+ int n;
lwsl_info("%s: %p\n", __func__, vh);
@@ -1449,7 +1617,7 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
if (vh->protocol_vh_privs)
lws_free(vh->protocol_vh_privs);
lws_ssl_SSL_CTX_destroy(vh);
- lws_free(vh->same_vh_protocol_heads);
+ lws_free(vh->same_vh_protocol_list);
if (context->plugin_list ||
(context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS))
@@ -1474,7 +1642,7 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
#endif
#if defined(LWS_WITH_UNIX_SOCK)
- if (LWS_UNIX_SOCK_ENABLED(vh)) {
+ if (LWS_UNIX_SOCK_ENABLED(context)) {
n = unlink(vh->iface);
if (n)
lwsl_info("Closing unix socket %s: errno %d\n",
@@ -1487,74 +1655,31 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
* they do not refer to the vhost. So it's safe to free.
*/
- if (vh->finalize)
- vh->finalize(vh, vh->finalize_arg);
-
lwsl_info(" %s: Freeing vhost %p\n", __func__, vh);
memset(vh, 0, sizeof(*vh));
lws_free(vh);
}
-/*
- * each service thread calls this once a second or so
- */
-
int
-lws_check_deferred_free(struct lws_context *context, int tsi, int force)
+lws_check_deferred_free(struct lws_context *context, int force)
{
- struct lws_context_per_thread *pt;
- int n;
-
- /*
- * If we see a vhost is being destroyed, forcibly close every wsi on
- * this tsi associated with this vhost. That will include the listen
- * socket if it is still associated with the closing vhost.
- *
- * For SMP, we do this once per tsi per destroyed vhost. The reference
- * counting on the vhost as the bound wsi close will notice that there
- * are no bound wsi left, that vhost destruction can complete,
- * and perform it. It doesn't matter which service thread does that
- * because there is nothing left using the vhost to conflict.
- */
-
- lws_context_lock(context, "check deferred free"); /* ------ context { */
-
- lws_start_foreach_ll_safe(struct lws_vhost *, v, context->vhost_list, vhost_next) {
- if (v->being_destroyed
-#if LWS_MAX_SMP > 1
- && !v->close_flow_vs_tsi[tsi]
-#endif
- ) {
-
- pt = &context->pt[tsi];
-
- lws_pt_lock(pt, "vhost removal"); /* -------------- pt { */
-
-#if LWS_MAX_SMP > 1
- v->close_flow_vs_tsi[tsi] = 1;
-#endif
-
- for (n = 0; (unsigned int)n < pt->fds_count; n++) {
- struct lws *wsi = wsi_from_fd(context, pt->fds[n].fd);
- if (!wsi)
- continue;
- if (wsi->vhost != v)
- continue;
-
- __lws_close_free_wsi(wsi,
- LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY,
- "vh destroy"
- /* no protocol close */);
- n--;
- }
+ struct lws_deferred_free *df;
+ time_t now = lws_now_secs();
- lws_pt_unlock(pt); /* } pt -------------- */
+ lws_start_foreach_llp(struct lws_deferred_free **, pdf,
+ context->deferred_free_list) {
+ if (force ||
+ lws_compare_time_t(context, now, (*pdf)->deadline) > 5) {
+ df = *pdf;
+ *pdf = df->next;
+ /* finalize vh destruction */
+ lwsl_notice("deferred vh %p destroy\n", df->payload);
+ lws_vhost_destroy2(df->payload);
+ lws_free(df);
+ continue; /* after deletion we already point to next */
}
- } lws_end_foreach_ll_safe(v);
-
-
- lws_context_unlock(context); /* } context ------------------- */
+ } lws_end_foreach_llp(pdf, next);
return 0;
}
@@ -1563,38 +1688,18 @@ LWS_VISIBLE void
lws_vhost_destroy(struct lws_vhost *vh)
{
struct lws_deferred_free *df = lws_malloc(sizeof(*df), "deferred free");
- struct lws_context *context = vh->context;
if (!df)
return;
- lws_context_lock(context, __func__); /* ------ context { */
-
lws_vhost_destroy1(vh);
- if (!vh->count_bound_wsi) {
- /*
- * After listen handoff, there are already no wsi bound to this
- * vhost by any pt: nothing can be servicing any wsi belonging
- * to it any more.
- *
- * Finalize the vh destruction immediately
- */
- __lws_vhost_destroy2(vh);
- lws_free(df);
-
- goto out;
- }
-
/* part 2 is deferred to allow all the handle closes to complete */
df->next = vh->context->deferred_free_list;
df->deadline = lws_now_secs();
df->payload = vh;
vh->context->deferred_free_list = df;
-
-out:
- lws_context_unlock(context); /* } context ------------------- */
}
/*
@@ -1628,12 +1733,11 @@ static void
lws_context_destroy3(struct lws_context *context)
{
struct lws_context **pcontext_finalize = context->pcontext_finalize;
+ struct lws_context_per_thread *pt;
int n;
for (n = 0; n < context->count_threads; n++) {
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
- struct lws_context_per_thread *pt = &context->pt[n];
-#endif
+ pt = &context->pt[n];
if (context->event_loop_ops->destroy_pt)
context->event_loop_ops->destroy_pt(context, n);
@@ -1646,9 +1750,6 @@ lws_context_destroy3(struct lws_context *context)
#endif
}
- if (context->pt[0].fds)
- lws_free_set_NULL(context->pt[0].fds);
-
lws_free(context);
lwsl_info("%s: ctx %p freed\n", __func__, context);
@@ -1667,13 +1768,15 @@ lws_context_destroy2(struct lws_context *context)
#if defined(LWS_WITH_PEER_LIMITS)
uint32_t nu;
#endif
+ int n;
lwsl_info("%s: ctx %p\n", __func__, context);
- lws_context_lock(context, "context destroy 2"); /* ------ context { */
-
context->being_destroyed2 = 1;
+ if (context->pt[0].fds)
+ lws_free_set_NULL(context->pt[0].fds);
+
/*
* free all the per-vhost allocations
*/
@@ -1681,7 +1784,7 @@ lws_context_destroy2(struct lws_context *context)
vh = context->vhost_list;
while (vh) {
vh1 = vh->vhost_next;
- __lws_vhost_destroy2(vh);
+ lws_vhost_destroy2(vh);
vh = vh1;
}
@@ -1689,7 +1792,7 @@ lws_context_destroy2(struct lws_context *context)
while (context->vhost_pending_destruction_list)
/* removes itself from list */
- __lws_vhost_destroy2(context->vhost_pending_destruction_list);
+ lws_vhost_destroy2(context->vhost_pending_destruction_list);
lws_stats_log_dump(context);
@@ -1713,29 +1816,22 @@ lws_context_destroy2(struct lws_context *context)
if (context->external_baggage_free_on_destroy)
free(context->external_baggage_free_on_destroy);
- lws_check_deferred_free(context, 0, 1);
+ lws_check_deferred_free(context, 1);
#if LWS_MAX_SMP > 1
- lws_mutex_refcount_destroy(&context->mr);
+ pthread_mutex_destroy(&context->lock);
#endif
if (context->event_loop_ops->destroy_context2)
if (context->event_loop_ops->destroy_context2(context)) {
- lws_context_unlock(context); /* } context ----------- */
context->finalize_destroy_after_internal_loops_stopped = 1;
return;
}
- if (!context->pt[0].event_loop_foreign) {
- int n;
+ if (!context->pt[0].event_loop_foreign)
for (n = 0; n < context->count_threads; n++)
- if (context->pt[n].inside_service) {
- lws_context_unlock(context); /* } context --- */
+ if (context->pt[n].inside_service)
return;
- }
- }
-
- lws_context_unlock(context); /* } context ------------------- */
lws_context_destroy3(context);
}
@@ -1749,6 +1845,7 @@ lws_context_destroy(struct lws_context *context)
{
volatile struct lws_foreign_thread_pollfd *ftp, *next;
volatile struct lws_context_per_thread *vpt;
+ struct lws_context_per_thread *pt;
struct lws_vhost *vh = NULL;
struct lws wsi;
int n, m;
@@ -1794,7 +1891,7 @@ lws_context_destroy(struct lws_context *context)
#endif
while (m--) {
- struct lws_context_per_thread *pt = &context->pt[m];
+ pt = &context->pt[m];
vpt = (volatile struct lws_context_per_thread *)pt;
ftp = vpt->foreign_pfd_list;
diff --git a/thirdparty/libwebsockets/lib/core/libwebsockets.c b/thirdparty/libwebsockets/core/libwebsockets.c
index 972422114a..58f00226f6 100644
--- a/thirdparty/libwebsockets/lib/core/libwebsockets.c
+++ b/thirdparty/libwebsockets/core/libwebsockets.c
@@ -53,42 +53,11 @@ static const char * const log_level_names[] = {
"CLIENT",
"LATENCY",
"USER",
- "THREAD",
"?",
"?"
};
#endif
-#if defined (_DEBUG)
-void lwsi_set_role(struct lws *wsi, lws_wsi_state_t role)
-{
- wsi->wsistate = (wsi->wsistate & (~LWSI_ROLE_MASK)) | role;
-
- lwsl_debug("lwsi_set_role(%p, 0x%x)\n", wsi, wsi->wsistate);
-}
-
-void lwsi_set_state(struct lws *wsi, lws_wsi_state_t lrs)
-{
- wsi->wsistate = (wsi->wsistate & (~LRS_MASK)) | lrs;
-
- lwsl_debug("lwsi_set_state(%p, 0x%x)\n", wsi, wsi->wsistate);
-}
-#endif
-
-signed char char_to_hex(const char c)
-{
- if (c >= '0' && c <= '9')
- return c - '0';
-
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
-
- if (c >= 'A' && c <= 'F')
- return c - 'A' + 10;
-
- return -1;
-}
-
int lws_open(const char *__file, int __oflag, ...)
{
va_list ap;
@@ -106,56 +75,39 @@ int lws_open(const char *__file, int __oflag, ...)
n = open(__file, __oflag);
va_end(ap);
- if (n != -1 && lws_plat_apply_FD_CLOEXEC(n)) {
- close(n);
-
- return -1;
- }
+ lws_plat_apply_FD_CLOEXEC(n);
return n;
}
-void
-lws_vhost_bind_wsi(struct lws_vhost *vh, struct lws *wsi)
+#if defined (_DEBUG)
+void lwsi_set_role(struct lws *wsi, lws_wsi_state_t role)
{
- if (wsi->vhost == vh)
- return;
- lws_context_lock(vh->context, __func__); /* ---------- context { */
- wsi->vhost = vh;
- vh->count_bound_wsi++;
- lws_context_unlock(vh->context); /* } context ---------- */
- lwsl_info("%s: vh %s: count_bound_wsi %d\n",
- __func__, vh->name, vh->count_bound_wsi);
- assert(wsi->vhost->count_bound_wsi > 0);
+ wsi->wsistate = (wsi->wsistate & (~LWSI_ROLE_MASK)) | role;
+
+ lwsl_debug("lwsi_set_role(%p, 0x%x)\n", wsi, wsi->wsistate);
}
-void
-lws_vhost_unbind_wsi(struct lws *wsi)
+void lwsi_set_state(struct lws *wsi, lws_wsi_state_t lrs)
{
- if (!wsi->vhost)
- return;
+ wsi->wsistate = (wsi->wsistate & (~LRS_MASK)) | lrs;
- lws_context_lock(wsi->context, __func__); /* ---------- context { */
+ lwsl_debug("lwsi_set_state(%p, 0x%x)\n", wsi, wsi->wsistate);
+}
+#endif
- assert(wsi->vhost->count_bound_wsi > 0);
- wsi->vhost->count_bound_wsi--;
- lwsl_info("%s: vh %s: count_bound_wsi %d\n", __func__,
- wsi->vhost->name, wsi->vhost->count_bound_wsi);
+signed char char_to_hex(const char c)
+{
+ if (c >= '0' && c <= '9')
+ return c - '0';
- if (!wsi->vhost->count_bound_wsi &&
- wsi->vhost->being_destroyed) {
- /*
- * We have closed all wsi that were bound to this vhost
- * by any pt: nothing can be servicing any wsi belonging
- * to it any more.
- *
- * Finalize the vh destruction
- */
- __lws_vhost_destroy2(wsi->vhost);
- }
- wsi->vhost = NULL;
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
- lws_context_unlock(wsi->context); /* } context ---------- */
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+
+ return -1;
}
void
@@ -173,24 +125,13 @@ __lws_free_wsi(struct lws *wsi)
lws_free(wsi->user_space);
lws_buflist_destroy_all_segments(&wsi->buflist);
- lws_buflist_destroy_all_segments(&wsi->buflist_out);
+ lws_free_set_NULL(wsi->trunc_alloc);
lws_free_set_NULL(wsi->udp);
if (wsi->vhost && wsi->vhost->lserv_wsi == wsi)
wsi->vhost->lserv_wsi = NULL;
-#if !defined(LWS_NO_CLIENT)
- lws_dll_lws_remove(&wsi->dll_active_client_conns);
-#endif
- wsi->context->count_wsi_allocated--;
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
- __lws_header_table_detach(wsi, 0);
-#endif
- __lws_same_vh_protocol_remove(wsi);
-#if !defined(LWS_NO_CLIENT)
- lws_client_stash_destroy(wsi);
- lws_free_set_NULL(wsi->client_hostname_copy);
-#endif
+ // lws_peer_dump_from_wsi(wsi);
if (wsi->role_ops->destroy_role)
wsi->role_ops->destroy_role(wsi);
@@ -210,8 +151,7 @@ __lws_free_wsi(struct lws *wsi)
if (wsi->context->event_loop_ops->destroy_wsi)
wsi->context->event_loop_ops->destroy_wsi(wsi);
- lws_vhost_unbind_wsi(wsi);
-
+ wsi->context->count_wsi_allocated--;
lwsl_debug("%s: %p, remaining wsi %d\n", __func__, wsi,
wsi->context->count_wsi_allocated);
@@ -387,15 +327,6 @@ __lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs)
// lws_dll_dump(&pt->dll_head_hrtimer, "after set_timer_usec");
}
-LWS_VISIBLE lws_usec_t
-lws_now_usecs(void)
-{
- struct timeval now;
-
- gettimeofday(&now, NULL);
- return (now.tv_sec * 1000000ll) + now.tv_usec;
-}
-
LWS_VISIBLE void
lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs)
{
@@ -439,8 +370,7 @@ __lws_hrtimer_service(struct lws_context_per_thread *pt)
if (!pt->dll_head_hrtimer.next)
return LWS_HRTIMER_NOWAIT;
- wsi = lws_container_of(pt->dll_head_hrtimer.next, struct lws,
- dll_hrtimer);
+ wsi = lws_container_of(pt->dll_head_hrtimer.next, struct lws, dll_hrtimer);
gettimeofday(&now, NULL);
t = (now.tv_sec * 1000000ll) + now.tv_usec;
@@ -459,7 +389,7 @@ __lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
time(&now);
- lwsl_debug("%s: %p: %d secs (reason %d)\n", __func__, wsi, secs, reason);
+ lwsl_debug("%s: %p: %d secs\n", __func__, wsi, secs);
wsi->pending_timeout_limit = secs;
wsi->pending_timeout_set = now;
wsi->pending_timeout = reason;
@@ -478,8 +408,7 @@ lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
if (secs == LWS_TO_KILL_SYNC) {
lws_remove_from_timeout_list(wsi);
lwsl_debug("synchronously killing %p\n", wsi);
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
- "to sync kill");
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "to sync kill");
return;
}
@@ -491,10 +420,8 @@ lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
lws_pt_unlock(pt);
}
-/* requires context + vh lock */
-
int
-__lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p)
+lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p)
{
lws_start_foreach_llp(struct lws_timed_vh_protocol **, pt,
vh->timed_vh_protocol_list) {
@@ -509,30 +436,9 @@ __lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *
return 1;
}
-int
-lws_pthread_self_to_tsi(struct lws_context *context)
-{
-#if LWS_MAX_SMP > 1
- pthread_t ps = pthread_self();
- struct lws_context_per_thread *pt = &context->pt[0];
- int n;
-
- for (n = 0; n < context->count_threads; n++) {
- if (pthread_equal(ps, pt->self))
- return n;
- pt++;
- }
-
- return -1;
-#else
- return 0;
-#endif
-}
-
LWS_VISIBLE LWS_EXTERN int
-lws_timed_callback_vh_protocol(struct lws_vhost *vh,
- const struct lws_protocols *prot, int reason,
- int secs)
+lws_timed_callback_vh_protocol(struct lws_vhost *vh, const struct lws_protocols *prot,
+ int reason, int secs)
{
struct lws_timed_vh_protocol *p = (struct lws_timed_vh_protocol *)
lws_malloc(sizeof(*p), "timed_vh");
@@ -540,27 +446,17 @@ lws_timed_callback_vh_protocol(struct lws_vhost *vh,
if (!p)
return 1;
- p->tsi_req = lws_pthread_self_to_tsi(vh->context);
- if (p->tsi_req < 0) /* not called from a service thread --> tsi 0 */
- p->tsi_req = 0;
-
- lws_context_lock(vh->context, __func__); /* context ----------------- */
-
p->protocol = prot;
p->reason = reason;
p->time = lws_now_secs() + secs;
-
- lws_vhost_lock(vh); /* vhost ---------------------------------------- */
p->next = vh->timed_vh_protocol_list;
- vh->timed_vh_protocol_list = p;
- lws_vhost_unlock(vh); /* -------------------------------------- vhost */
- lws_context_unlock(vh->context); /* ------------------------- context */
+ vh->timed_vh_protocol_list = p;
return 0;
}
-void
+static void
lws_remove_child_from_any_parent(struct lws *wsi)
{
struct lws **pwsi;
@@ -594,17 +490,15 @@ lws_remove_child_from_any_parent(struct lws *wsi)
}
int
-lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p,
- const char *reason)
+lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p)
{
// if (wsi->protocol == p)
// return 0;
const struct lws_protocols *vp = wsi->vhost->protocols, *vpo;
if (wsi->protocol && wsi->protocol_bind_balance) {
- wsi->protocol->callback(wsi,
- wsi->role_ops->protocol_unbind_cb[!!lwsi_role_server(wsi)],
- wsi->user_space, (void *)reason, 0);
+ wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_DROP_PROTOCOL,
+ wsi->user_space, NULL, 0);
wsi->protocol_bind_balance = 0;
}
if (!wsi->user_space_externally_allocated)
@@ -640,8 +534,7 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p,
__func__, p, wsi->vhost->name);
}
- if (wsi->protocol->callback(wsi, wsi->role_ops->protocol_bind_cb[
- !!lwsi_role_server(wsi)],
+ if (wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_BIND_PROTOCOL,
wsi->user_space, NULL, 0))
return 1;
@@ -651,8 +544,7 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p,
}
void
-__lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
- const char *caller)
+__lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason, const char *caller)
{
struct lws_context_per_thread *pt;
struct lws *wsi1, *wsi2;
@@ -684,21 +576,20 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
if ((int)reason != -1)
lws_vhost_lock(wsi->vhost);
lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
- wsi->dll_client_transaction_queue_head.next) {
+ wsi->dll_client_transaction_queue_head.next) {
struct lws *w = lws_container_of(d, struct lws,
- dll_client_transaction_queue);
+ dll_client_transaction_queue);
__lws_close_free_wsi(w, -1, "trans q leader closing");
} lws_end_foreach_dll_safe(d, d1);
/*
- * !!! If we are closing, but we have pending pipelined
- * transaction results we already sent headers for, that's going
- * to destroy sync for HTTP/1 and leave H2 stream with no live
- * swsi.
+ * !!! If we are closing, but we have pending pipelined transaction
+ * results we already sent headers for, that's going to destroy sync
+ * for HTTP/1 and leave H2 stream with no live swsi.
*
- * However this is normal if we are being closed because the
- * transaction queue leader is closing.
+ * However this is normal if we are being closed because the transaction
+ * queue leader is closing.
*/
lws_dll_lws_remove(&wsi->dll_client_transaction_queue);
if ((int)reason !=-1)
@@ -714,8 +605,7 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
wsi2->parent = NULL;
/* stop it doing shutdown processing */
wsi2->socket_is_permanently_unusable = 1;
- __lws_close_free_wsi(wsi2, reason,
- "general child recurse");
+ __lws_close_free_wsi(wsi2, reason, "general child recurse");
wsi2 = wsi1;
}
wsi->child_list = NULL;
@@ -740,8 +630,7 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
lws_cgi_remove_and_kill(wsi->parent);
/* end the binding between us and master */
- wsi->parent->http.cgi->stdwsi[(int)wsi->cgi_channel] =
- NULL;
+ wsi->parent->http.cgi->stdwsi[(int)wsi->cgi_channel] = NULL;
}
wsi->socket_is_permanently_unusable = 1;
@@ -785,24 +674,14 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
goto just_kill_connection;
case LRS_FLUSHING_BEFORE_CLOSE:
- if (lws_has_buffered_out(wsi)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- || wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more
-#endif
- ) {
+ if (wsi->trunc_len) {
lws_callback_on_writable(wsi);
return;
}
lwsl_info("%p: end LRS_FLUSHING_BEFORE_CLOSE\n", wsi);
goto just_kill_connection;
default:
- if (lws_has_buffered_out(wsi)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- || wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more
-#endif
- ) {
+ if (wsi->trunc_len) {
lwsl_info("%p: LRS_FLUSHING_BEFORE_CLOSE\n", wsi);
lwsi_set_state(wsi, LRS_FLUSHING_BEFORE_CLOSE);
__lws_set_timeout(wsi,
@@ -816,13 +695,15 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
lwsi_state(wsi) == LRS_H1C_ISSUE_HANDSHAKE)
goto just_kill_connection;
- if (!wsi->told_user_closed && wsi->user_space && wsi->protocol &&
- wsi->protocol_bind_balance) {
- wsi->protocol->callback(wsi,
- wsi->role_ops->protocol_unbind_cb[
- !!lwsi_role_server(wsi)],
- wsi->user_space, (void *)__func__, 0);
- wsi->protocol_bind_balance = 0;
+ if (!wsi->told_user_closed && lwsi_role_http(wsi) &&
+ lwsi_role_server(wsi)) {
+ if (wsi->user_space && wsi->protocol &&
+ wsi->protocol_bind_balance) {
+ wsi->protocol->callback(wsi,
+ LWS_CALLBACK_HTTP_DROP_PROTOCOL,
+ wsi->user_space, NULL, 0);
+ wsi->protocol_bind_balance = 0;
+ }
}
/*
@@ -853,10 +734,8 @@ just_kill_connection:
wsi->protocol_bind_balance) {
lwsl_debug("%s: %p: DROP_PROTOCOL %s\n", __func__, wsi,
wsi->protocol->name);
- wsi->protocol->callback(wsi,
- wsi->role_ops->protocol_unbind_cb[
- !!lwsi_role_server(wsi)],
- wsi->user_space, (void *)__func__, 0);
+ wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_DROP_PROTOCOL,
+ wsi->user_space, NULL, 0);
wsi->protocol_bind_balance = 0;
}
@@ -893,7 +772,7 @@ just_kill_connection:
} else
#endif
{
- lwsl_info("%s: shutdown conn: %p (sk %d, state 0x%x)\n",
+ lwsl_info("%s: shutdown conn: %p (sock %d, state 0x%x)\n",
__func__, wsi, (int)(long)wsi->desc.sockfd,
lwsi_state(wsi));
if (!wsi->socket_is_permanently_unusable &&
@@ -929,16 +808,12 @@ just_kill_connection:
lwsl_debug("%s: real just_kill_connection: %p (sockfd %d)\n", __func__,
wsi, wsi->desc.sockfd);
-#ifdef LWS_WITH_HUBBUB
+#ifdef LWS_WITH_HTTP_PROXY
if (wsi->http.rw) {
lws_rewrite_destroy(wsi->http.rw);
wsi->http.rw = NULL;
}
#endif
-
- if (wsi->http.pending_return_headers)
- lws_free_set_NULL(wsi->http.pending_return_headers);
-
/*
* we won't be servicing or receiving anything further from this guy
* delete socket from the internal poll list if still present
@@ -955,7 +830,7 @@ just_kill_connection:
if (wsi->desc.sockfd != LWS_SOCK_INVALID)
__remove_wsi_socket_from_fds(wsi);
else
- __lws_same_vh_protocol_remove(wsi);
+ lws_same_vh_protocol_remove(wsi);
lwsi_set_state(wsi, LRS_DEAD_SOCKET);
lws_buflist_destroy_all_segments(&wsi->buflist);
@@ -966,9 +841,7 @@ just_kill_connection:
/* tell the user it's all over for this guy */
- if ((lwsi_state_est_PRE_CLOSE(wsi) ||
- lwsi_state_PRE_CLOSE(wsi) == LRS_WAITING_SERVER_REPLY) &&
- !wsi->told_user_closed &&
+ if (lwsi_state_est_PRE_CLOSE(wsi) && !wsi->told_user_closed &&
wsi->role_ops->close_cb[lwsi_role_server(wsi)]) {
const struct lws_protocols *pro = wsi->protocol;
@@ -1004,9 +877,7 @@ __lws_close_free_wsi_final(struct lws *wsi)
{
int n;
- if (!wsi->shadow &&
- lws_socket_is_valid(wsi->desc.sockfd) && !lws_ssl_close(wsi)) {
- lwsl_debug("%s: wsi %p: fd %d\n", __func__, wsi, wsi->desc.sockfd);
+ if (lws_socket_is_valid(wsi->desc.sockfd) && !lws_ssl_close(wsi)) {
n = compatible_close(wsi->desc.sockfd);
if (n)
lwsl_debug("closing: close ret %d\n", LWS_ERRNO);
@@ -1073,7 +944,8 @@ lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
lwsl_info("%s: len %u first %d %p\n", __func__, (uint32_t)len, first, p);
- nbuf = (struct lws_buflist *)lws_malloc(sizeof(**head) + len, __func__);
+ nbuf = (struct lws_buflist *)
+ lws_malloc(sizeof(**head) + len, __func__);
if (!nbuf) {
lwsl_err("%s: OOM\n", __func__);
return -1;
@@ -1307,6 +1179,9 @@ lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
wsi = lws_get_network_wsi(wsi);
+ if (wsi->parent_carries_io)
+ wsi = wsi->parent;
+
#ifdef LWS_WITH_IPV6
if (LWS_IPV6_ENABLED(wsi->vhost)) {
len = sizeof(sin6);
@@ -1423,11 +1298,7 @@ lws_get_network_wsi(struct lws *wsi)
return NULL;
#if defined(LWS_WITH_HTTP2)
- if (!wsi->http2_substream
-#if !defined(LWS_NO_CLIENT)
- && !wsi->client_h2_substream
-#endif
- )
+ if (!wsi->http2_substream && !wsi->client_h2_substream)
return wsi;
while (wsi->h2.parent_wsi)
@@ -1525,7 +1396,7 @@ lws_callback_vhost_protocols_vhost(struct lws_vhost *vh, int reason, void *in,
struct lws *wsi = lws_zalloc(sizeof(*wsi), "fake wsi");
wsi->context = vh->context;
- lws_vhost_bind_wsi(vh, wsi);
+ wsi->vhost = vh;
for (n = 0; n < wsi->vhost->count_protocols; n++) {
wsi->protocol = &vh->protocols[n];
@@ -1615,8 +1486,8 @@ lws_vfs_select_fops(const struct lws_plat_file_ops *fops, const char *vfs_path,
while (n < (int)LWS_ARRAY_SIZE(pf->fi) && pf->fi[n].sig) {
if (p >= vfs_path + pf->fi[n].len)
if (!strncmp(p - (pf->fi[n].len - 1),
- pf->fi[n].sig,
- pf->fi[n].len - 1)) {
+ pf->fi[n].sig,
+ pf->fi[n].len - 1)) {
*vpath = p + 1;
return pf;
}
@@ -1686,7 +1557,7 @@ lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
unsigned long long u;
char buf[256];
- u = lws_time_in_microseconds();
+ u = time_in_microseconds();
if (!action) {
wsi->latency_start = u;
@@ -1754,8 +1625,7 @@ lws_rx_flow_control(struct lws *wsi, int _enable)
wsi->rxflow_change_to)
goto skip;
- wsi->rxflow_change_to = LWS_RXFLOW_PENDING_CHANGE |
- (!wsi->rxflow_bitmap);
+ wsi->rxflow_change_to = LWS_RXFLOW_PENDING_CHANGE | !wsi->rxflow_bitmap;
lwsl_info("%s: %p: bitmap 0x%x: en 0x%x, ch 0x%x\n", __func__, wsi,
wsi->rxflow_bitmap, en, wsi->rxflow_change_to);
@@ -1806,7 +1676,7 @@ lws_broadcast(struct lws_context *context, int reason, void *in, size_t len)
while (v) {
const struct lws_protocols *p = v->protocols;
- wsi.vhost = v; /* not a real bound wsi */
+ wsi.vhost = v;
for (n = 0; n < v->count_protocols; n++) {
wsi.protocol = p;
@@ -1896,9 +1766,7 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
lwsl_info(" Proxy auth in use\n");
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
proxy = p + 1;
-#endif
} else
vhost->proxy_basic_auth_token[0] = '\0';
@@ -2045,9 +1913,7 @@ LWS_VISIBLE int
lwsl_timestamp(int level, char *p, int len)
{
#ifndef LWS_PLAT_OPTEE
-#ifndef _WIN32_WCE
time_t o_now = time(NULL);
-#endif
unsigned long long now;
struct tm *ptm = NULL;
#ifndef WIN32
@@ -2067,7 +1933,7 @@ lwsl_timestamp(int level, char *p, int len)
for (n = 0; n < LLL_COUNT; n++) {
if (level != (1 << n))
continue;
- now = lws_time_in_microseconds() / 100;
+ now = time_in_microseconds() / 100;
if (ptm)
n = lws_snprintf(p, len,
"[%04d/%02d/%02d %02d:%02d:%02d:%04d] %s: ",
@@ -2104,15 +1970,12 @@ static const char * const colours[] = {
"[33m", /* LLL_CLIENT */
"[33;1m", /* LLL_LATENCY */
"[30;1m", /* LLL_USER */
- "[31m", /* LLL_THREAD */
};
-static char tty;
-
-LWS_VISIBLE void
-lwsl_emit_stderr(int level, const char *line)
+LWS_VISIBLE void lwsl_emit_stderr(int level, const char *line)
{
char buf[50];
+ static char tty = 3;
int n, m = LWS_ARRAY_SIZE(colours) - 1;
if (!tty)
@@ -2131,28 +1994,6 @@ lwsl_emit_stderr(int level, const char *line)
} else
fprintf(stderr, "%s%s", buf, line);
}
-
-LWS_VISIBLE void
-lwsl_emit_stderr_notimestamp(int level, const char *line)
-{
- int n, m = LWS_ARRAY_SIZE(colours) - 1;
-
- if (!tty)
- tty = isatty(2) | 2;
-
- if (tty == 3) {
- n = 1 << (LWS_ARRAY_SIZE(colours) - 1);
- while (n) {
- if (level & n)
- break;
- m--;
- n >>= 1;
- }
- fprintf(stderr, "%c%s%s%c[0m", 27, colours[m], line, 27);
- } else
- fprintf(stderr, "%s", line);
-}
-
#endif
LWS_VISIBLE void _lws_logv(int filter, const char *format, va_list vl)
@@ -2166,14 +2007,8 @@ LWS_VISIBLE void _lws_logv(int filter, const char *format, va_list vl)
n = vsnprintf(buf, sizeof(buf) - 1, format, vl);
(void)n;
/* vnsprintf returns what it would have written, even if truncated */
- if (n > (int)sizeof(buf) - 1) {
- n = sizeof(buf) - 5;
- buf[n++] = '.';
- buf[n++] = '.';
- buf[n++] = '.';
- buf[n++] = '\n';
- buf[n] = '\0';
- }
+ if (n > (int)sizeof(buf) - 1)
+ n = sizeof(buf) - 1;
if (n > 0)
buf[n] = '\0';
@@ -2206,7 +2041,9 @@ LWS_VISIBLE void
lwsl_hexdump_level(int hexdump_level, const void *vbuf, size_t len)
{
unsigned char *buf = (unsigned char *)vbuf;
- unsigned int n;
+ unsigned int n, m, start;
+ char line[80];
+ char *p;
if (!lwsl_visible(hexdump_level))
return;
@@ -2220,8 +2057,8 @@ lwsl_hexdump_level(int hexdump_level, const void *vbuf, size_t len)
_lws_log(hexdump_level, "\n");
for (n = 0; n < len;) {
- unsigned int start = n, m;
- char line[80], *p = line;
+ start = n;
+ p = line;
p += sprintf(p, "%04X: ", start);
@@ -2280,7 +2117,7 @@ lws_get_ssl(struct lws *wsi)
LWS_VISIBLE int
lws_partial_buffered(struct lws *wsi)
{
- return lws_has_buffered_out(wsi);
+ return !!wsi->trunc_len;
}
LWS_VISIBLE lws_fileofs_t
@@ -2293,7 +2130,7 @@ lws_get_peer_write_allowance(struct lws *wsi)
LWS_VISIBLE void
lws_role_transition(struct lws *wsi, enum lwsi_role role, enum lwsi_state state,
- struct lws_role_ops *ops)
+ struct lws_role_ops *ops)
{
#if defined(_DEBUG)
const char *name = "(unset)";
@@ -2355,6 +2192,12 @@ lws_get_child(const struct lws *wsi)
return wsi->child_list;
}
+LWS_VISIBLE LWS_EXTERN void
+lws_set_parent_carries_io(struct lws *wsi)
+{
+ wsi->parent_carries_io = 1;
+}
+
LWS_VISIBLE LWS_EXTERN void *
lws_get_opaque_parent_data(const struct lws *wsi)
{
@@ -2414,7 +2257,7 @@ __lws_rx_flow_control(struct lws *wsi)
wsi->rxflow_change_to &= ~LWS_RXFLOW_PENDING_CHANGE;
lwsl_info("rxflow: wsi %p change_to %d\n", wsi,
- wsi->rxflow_change_to & LWS_RXFLOW_ALLOW);
+ wsi->rxflow_change_to & LWS_RXFLOW_ALLOW);
/* adjust the pollfd for this wsi */
@@ -2430,60 +2273,36 @@ __lws_rx_flow_control(struct lws *wsi)
return 0;
}
-static const unsigned char e0f4[] = {
- 0xa0 | ((2 - 1) << 2) | 1, /* e0 */
- 0x80 | ((4 - 1) << 2) | 1, /* e1 */
- 0x80 | ((4 - 1) << 2) | 1, /* e2 */
- 0x80 | ((4 - 1) << 2) | 1, /* e3 */
- 0x80 | ((4 - 1) << 2) | 1, /* e4 */
- 0x80 | ((4 - 1) << 2) | 1, /* e5 */
- 0x80 | ((4 - 1) << 2) | 1, /* e6 */
- 0x80 | ((4 - 1) << 2) | 1, /* e7 */
- 0x80 | ((4 - 1) << 2) | 1, /* e8 */
- 0x80 | ((4 - 1) << 2) | 1, /* e9 */
- 0x80 | ((4 - 1) << 2) | 1, /* ea */
- 0x80 | ((4 - 1) << 2) | 1, /* eb */
- 0x80 | ((4 - 1) << 2) | 1, /* ec */
- 0x80 | ((2 - 1) << 2) | 1, /* ed */
- 0x80 | ((4 - 1) << 2) | 1, /* ee */
- 0x80 | ((4 - 1) << 2) | 1, /* ef */
- 0x90 | ((3 - 1) << 2) | 2, /* f0 */
- 0x80 | ((4 - 1) << 2) | 2, /* f1 */
- 0x80 | ((4 - 1) << 2) | 2, /* f2 */
- 0x80 | ((4 - 1) << 2) | 2, /* f3 */
- 0x80 | ((1 - 1) << 2) | 2, /* f4 */
-
- 0, /* s0 */
- 0x80 | ((4 - 1) << 2) | 0, /* s2 */
- 0x80 | ((4 - 1) << 2) | 1, /* s3 */
-};
-
-LWS_EXTERN int
-lws_check_byte_utf8(unsigned char state, unsigned char c)
-{
- unsigned char s = state;
-
- if (!s) {
- if (c >= 0x80) {
- if (c < 0xc2 || c > 0xf4)
- return -1;
- if (c < 0xe0)
- return 0x80 | ((4 - 1) << 2);
- else
- return e0f4[c - 0xe0];
- }
-
- return s;
- }
- if (c < (s & 0xf0) || c >= (s & 0xf0) + 0x10 + ((s << 2) & 0x30))
- return -1;
-
- return e0f4[21 + (s & 3)];
-}
-
LWS_EXTERN int
lws_check_utf8(unsigned char *state, unsigned char *buf, size_t len)
{
+ static const unsigned char e0f4[] = {
+ 0xa0 | ((2 - 1) << 2) | 1, /* e0 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e1 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e2 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e3 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e4 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e5 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e6 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e7 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e8 */
+ 0x80 | ((4 - 1) << 2) | 1, /* e9 */
+ 0x80 | ((4 - 1) << 2) | 1, /* ea */
+ 0x80 | ((4 - 1) << 2) | 1, /* eb */
+ 0x80 | ((4 - 1) << 2) | 1, /* ec */
+ 0x80 | ((2 - 1) << 2) | 1, /* ed */
+ 0x80 | ((4 - 1) << 2) | 1, /* ee */
+ 0x80 | ((4 - 1) << 2) | 1, /* ef */
+ 0x90 | ((3 - 1) << 2) | 2, /* f0 */
+ 0x80 | ((4 - 1) << 2) | 2, /* f1 */
+ 0x80 | ((4 - 1) << 2) | 2, /* f2 */
+ 0x80 | ((4 - 1) << 2) | 2, /* f3 */
+ 0x80 | ((1 - 1) << 2) | 2, /* f4 */
+
+ 0, /* s0 */
+ 0x80 | ((4 - 1) << 2) | 0, /* s2 */
+ 0x80 | ((4 - 1) << 2) | 1, /* s3 */
+ };
unsigned char s = *state;
while (len--) {
@@ -2516,7 +2335,7 @@ lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
const char **path)
{
const char *end;
- char unix_skt = 0;
+ static const char *slash = "/";
/* cut up the location into address, port and path */
*prot = p;
@@ -2530,32 +2349,32 @@ lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
*p = '\0';
p += 3;
}
- if (*p == '+') /* unix skt */
- unix_skt = 1;
-
*ads = p;
if (!strcmp(*prot, "http") || !strcmp(*prot, "ws"))
*port = 80;
else if (!strcmp(*prot, "https") || !strcmp(*prot, "wss"))
*port = 443;
- if (*p == '[') {
- ++(*ads);
- while (*p && *p != ']')
- p++;
- if (*p)
- *p++ = '\0';
- } else
- while (*p && *p != ':' && (unix_skt || *p != '/'))
- p++;
-
+ if (*p == '[')
+ {
+ ++(*ads);
+ while (*p && *p != ']')
+ p++;
+ if (*p)
+ *p++ = '\0';
+ }
+ else
+ {
+ while (*p && *p != ':' && *p != '/')
+ p++;
+ }
if (*p == ':') {
*p++ = '\0';
*port = atoi(p);
while (*p && *p != '/')
p++;
}
- *path = "/";
+ *path = slash;
if (*p) {
*p++ = '\0';
if (*p)
@@ -2565,17 +2384,6 @@ lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
return 0;
}
-char *
-lws_strdup(const char *s)
-{
- char *d = lws_malloc(strlen(s) + 1, "strdup");
-
- if (d)
- strcpy(d, s);
-
- return d;
-}
-
#if defined(LWS_WITHOUT_EXTENSIONS)
/* we need to provide dummy callbacks for internal exts
@@ -2609,14 +2417,6 @@ lws_set_extension_option(struct lws *wsi, const char *ext_name,
}
#endif
-/* note: this returns a random port, or one of these <= 0 return codes:
- *
- * LWS_ITOSA_USABLE: the interface is usable, returned if so and sockfd invalid
- * LWS_ITOSA_NOT_EXIST: the requested iface does not even exist
- * LWS_ITOSA_NOT_USABLE: the requested iface exists but is not usable (eg, no IP)
- * LWS_ITOSA_BUSY: the port at the requested iface + port is already in use
- */
-
LWS_EXTERN int
lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
const char *iface)
@@ -2638,26 +2438,22 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
struct sockaddr_storage sin;
struct sockaddr *v;
- memset(&sin, 0, sizeof(sin));
-
-#if defined(LWS_WITH_UNIX_SOCK)
+#ifdef LWS_WITH_UNIX_SOCK
if (LWS_UNIX_SOCK_ENABLED(vhost)) {
v = (struct sockaddr *)&serv_unix;
n = sizeof(struct sockaddr_un);
bzero((char *) &serv_unix, sizeof(serv_unix));
serv_unix.sun_family = AF_UNIX;
if (!iface)
- return LWS_ITOSA_NOT_EXIST;
+ return -1;
if (sizeof(serv_unix.sun_path) <= strlen(iface)) {
lwsl_err("\"%s\" too long for UNIX domain socket\n",
iface);
- return LWS_ITOSA_NOT_EXIST;
+ return -1;
}
strcpy(serv_unix.sun_path, iface);
if (serv_unix.sun_path[0] == '@')
serv_unix.sun_path[0] = '\0';
- else
- unlink(serv_unix.sun_path);
} else
#endif
@@ -2692,8 +2488,8 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
bzero((char *) &serv_addr4, sizeof(serv_addr4));
serv_addr4.sin_addr.s_addr = INADDR_ANY;
serv_addr4.sin_family = AF_INET;
-
#if !defined(LWS_WITH_ESP32)
+
if (iface) {
m = interface_to_sa(vhost, iface,
(struct sockaddr_in *)v, n);
@@ -2714,38 +2510,22 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
/* just checking for the interface extant */
if (sockfd == LWS_SOCK_INVALID)
- return LWS_ITOSA_USABLE;
+ return 0;
n = bind(sockfd, v, n);
#ifdef LWS_WITH_UNIX_SOCK
if (n < 0 && LWS_UNIX_SOCK_ENABLED(vhost)) {
lwsl_err("ERROR on binding fd %d to \"%s\" (%d %d)\n",
- sockfd, iface, n, LWS_ERRNO);
- return LWS_ITOSA_NOT_EXIST;
+ sockfd, iface, n, LWS_ERRNO);
+ return -1;
} else
#endif
if (n < 0) {
lwsl_err("ERROR on binding fd %d to port %d (%d %d)\n",
- sockfd, port, n, LWS_ERRNO);
-
- /* if something already listening, tell caller to fail permanently */
-
- if (LWS_ERRNO == LWS_EADDRINUSE)
- return LWS_ITOSA_BUSY;
-
- /* otherwise ask caller to retry later */
-
- return LWS_ITOSA_NOT_EXIST;
+ sockfd, port, n, LWS_ERRNO);
+ return -1;
}
-#if defined(LWS_WITH_UNIX_SOCK)
- if (LWS_UNIX_SOCK_ENABLED(vhost) && vhost->context->uid)
- if (chown(serv_unix.sun_path, vhost->context->uid,
- vhost->context->gid))
- lwsl_notice("%s: chown for unix skt %s failed\n",
- __func__, serv_unix.sun_path);
-#endif
-
#ifndef LWS_PLAT_OPTEE
if (getsockname(sockfd, (struct sockaddr *)&sin, &len) == -1)
lwsl_warn("getsockname: %s\n", strerror(LWS_ERRNO));
@@ -2820,7 +2600,7 @@ lws_get_addr_scope(const char *ipaddr)
for (i = 0; i < 5; i++)
{
ret = GetAdaptersAddresses(AF_INET6, GAA_FLAG_INCLUDE_PREFIX,
- NULL, addrs, &size);
+ NULL, addrs, &size);
if ((ret == NO_ERROR) || (ret == ERROR_NO_DATA)) {
break;
} else if (ret == ERROR_BUFFER_OVERFLOW)
@@ -2873,6 +2653,73 @@ lws_get_addr_scope(const char *ipaddr)
}
#endif
+#if !defined(LWS_NO_SERVER)
+
+LWS_EXTERN struct lws *
+lws_create_adopt_udp(struct lws_vhost *vhost, int port, int flags,
+ const char *protocol_name, struct lws *parent_wsi)
+{
+ lws_sock_file_fd_type sock;
+ struct addrinfo h, *r, *rp;
+ struct lws *wsi = NULL;
+ char buf[16];
+ int n;
+
+ memset(&h, 0, sizeof(h));
+ h.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
+ h.ai_socktype = SOCK_DGRAM;
+ h.ai_protocol = IPPROTO_UDP;
+ h.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+
+ lws_snprintf(buf, sizeof(buf), "%u", port);
+ n = getaddrinfo(NULL, buf, &h, &r);
+ if (n) {
+ lwsl_info("%s: getaddrinfo error: %s\n", __func__,
+ gai_strerror(n));
+ goto bail;
+ }
+
+ for (rp = r; rp; rp = rp->ai_next) {
+ sock.sockfd = socket(rp->ai_family, rp->ai_socktype,
+ rp->ai_protocol);
+ if (sock.sockfd >= 0)
+ break;
+ }
+ if (!rp) {
+ lwsl_err("%s: unable to create INET socket\n", __func__);
+ goto bail1;
+ }
+
+ if ((flags & LWS_CAUDP_BIND) && bind(sock.sockfd, rp->ai_addr,
+#if defined(_WIN32)
+ (int)rp->ai_addrlen
+#else
+ rp->ai_addrlen
+#endif
+ ) == -1) {
+ lwsl_err("%s: bind failed\n", __func__);
+ goto bail2;
+ }
+
+ wsi = lws_adopt_descriptor_vhost(vhost, LWS_ADOPT_RAW_SOCKET_UDP, sock,
+ protocol_name, parent_wsi);
+ if (!wsi)
+ lwsl_err("%s: udp adoption failed\n", __func__);
+
+bail2:
+ if (!wsi)
+ close((int)sock.sockfd);
+bail1:
+ freeaddrinfo(r);
+
+bail:
+ return wsi;
+}
+
+#endif
+
+
+
static const char *hex = "0123456789ABCDEF";
LWS_VISIBLE LWS_EXTERN const char *
@@ -2907,27 +2754,6 @@ lws_json_purify(char *escaped, const char *string, int len)
}
while (*p && len-- > 6) {
- if (*p == '\t') {
- p++;
- *q++ = '\\';
- *q++ = 't';
- continue;
- }
-
- if (*p == '\n') {
- p++;
- *q++ = '\\';
- *q++ = 'n';
- continue;
- }
-
- if (*p == '\r') {
- p++;
- *q++ = '\\';
- *q++ = 'r';
- continue;
- }
-
if (*p == '\"' || *p == '\\' || *p < 0x20) {
*q++ = '\\';
*q++ = 'u';
@@ -3064,13 +2890,6 @@ lws_finalize_startup(struct lws_context *context)
return 0;
}
-LWS_VISIBLE LWS_EXTERN void
-lws_get_effective_uid_gid(struct lws_context *context, int *uid, int *gid)
-{
- *uid = context->uid;
- *gid = context->gid;
-}
-
int
lws_snprintf(char *str, size_t size, const char *format, ...)
{
@@ -3100,316 +2919,6 @@ lws_strncpy(char *dest, const char *src, size_t size)
}
-typedef enum {
- LWS_TOKZS_LEADING_WHITESPACE,
- LWS_TOKZS_QUOTED_STRING,
- LWS_TOKZS_TOKEN,
- LWS_TOKZS_TOKEN_POST_TERMINAL
-} lws_tokenize_state;
-
-int
-lws_tokenize(struct lws_tokenize *ts)
-{
- const char *rfc7230_delims = "(),/:;<=>?@[\\]{}";
- lws_tokenize_state state = LWS_TOKZS_LEADING_WHITESPACE;
- char c, flo = 0, d_minus = '-', d_dot = '.', s_minus = '\0',
- s_dot = '\0';
- signed char num = -1;
- int utf8 = 0;
-
- /* for speed, compute the effect of the flags outside the loop */
-
- if (ts->flags & LWS_TOKENIZE_F_MINUS_NONTERM) {
- d_minus = '\0';
- s_minus = '-';
- }
- if (ts->flags & LWS_TOKENIZE_F_DOT_NONTERM) {
- d_dot = '\0';
- s_dot = '.';
- }
-
- ts->token = NULL;
- ts->token_len = 0;
-
- while (ts->len) {
- c = *ts->start++;
- ts->len--;
-
- utf8 = lws_check_byte_utf8((unsigned char)utf8, c);
- if (utf8 < 0)
- return LWS_TOKZE_ERR_BROKEN_UTF8;
-
- if (!c)
- break;
-
- /* whitespace */
-
- if (c == ' ' || c == '\t' || c == '\n' || c == '\r' ||
- c == '\f') {
- switch (state) {
- case LWS_TOKZS_LEADING_WHITESPACE:
- case LWS_TOKZS_TOKEN_POST_TERMINAL:
- continue;
- case LWS_TOKZS_QUOTED_STRING:
- ts->token_len++;
- continue;
- case LWS_TOKZS_TOKEN:
- /* we want to scan forward to look for = */
-
- state = LWS_TOKZS_TOKEN_POST_TERMINAL;
- continue;
- }
- }
-
- /* quoted string */
-
- if (c == '\"') {
- if (state == LWS_TOKZS_QUOTED_STRING)
- return LWS_TOKZE_QUOTED_STRING;
-
- /* starting a quoted string */
-
- if (ts->flags & LWS_TOKENIZE_F_COMMA_SEP_LIST) {
- if (ts->delim == LWSTZ_DT_NEED_DELIM)
- return LWS_TOKZE_ERR_COMMA_LIST;
- ts->delim = LWSTZ_DT_NEED_DELIM;
- }
-
- state = LWS_TOKZS_QUOTED_STRING;
- ts->token = ts->start;
- ts->token_len = 0;
-
- continue;
- }
-
- /* token= aggregation */
-
- if (c == '=' && (state == LWS_TOKZS_TOKEN_POST_TERMINAL ||
- state == LWS_TOKZS_TOKEN)) {
- if (num == 1)
- return LWS_TOKZE_ERR_NUM_ON_LHS;
- /* swallow the = */
- return LWS_TOKZE_TOKEN_NAME_EQUALS;
- }
-
- /* optional token: aggregation */
-
- if ((ts->flags & LWS_TOKENIZE_F_AGG_COLON) && c == ':' &&
- (state == LWS_TOKZS_TOKEN_POST_TERMINAL ||
- state == LWS_TOKZS_TOKEN))
- /* swallow the : */
- return LWS_TOKZE_TOKEN_NAME_COLON;
-
- /* aggregate . in a number as a float */
-
- if (c == '.' && !(ts->flags & LWS_TOKENIZE_F_NO_FLOATS) &&
- state == LWS_TOKZS_TOKEN && num == 1) {
- if (flo)
- return LWS_TOKZE_ERR_MALFORMED_FLOAT;
- flo = 1;
- ts->token_len++;
- continue;
- }
-
- /*
- * Delimiter... by default anything that:
- *
- * - isn't matched earlier, or
- * - is [A-Z, a-z, 0-9, _], and
- * - is not a partial utf8 char
- *
- * is a "delimiter", it marks the end of a token and is itself
- * reported as a single LWS_TOKZE_DELIMITER each time.
- *
- * However with LWS_TOKENIZE_F_RFC7230_DELIMS flag, tokens may
- * contain any noncontrol character that isn't defined in
- * rfc7230_delims, and only characters listed there are treated
- * as delimiters.
- */
-
- if (!utf8 &&
- ((ts->flags & LWS_TOKENIZE_F_RFC7230_DELIMS &&
- strchr(rfc7230_delims, c) && c > 32) ||
- ((!(ts->flags & LWS_TOKENIZE_F_RFC7230_DELIMS) &&
- (c < '0' || c > '9') && (c < 'A' || c > 'Z') &&
- (c < 'a' || c > 'z') && c != '_') &&
- c != s_minus && c != s_dot) ||
- c == d_minus || c == d_dot
- )) {
- switch (state) {
- case LWS_TOKZS_LEADING_WHITESPACE:
- if (ts->flags & LWS_TOKENIZE_F_COMMA_SEP_LIST) {
- if (c != ',' ||
- ts->delim != LWSTZ_DT_NEED_DELIM)
- return LWS_TOKZE_ERR_COMMA_LIST;
- ts->delim = LWSTZ_DT_NEED_NEXT_CONTENT;
- }
-
- ts->token = ts->start - 1;
- ts->token_len = 1;
- return LWS_TOKZE_DELIMITER;
-
- case LWS_TOKZS_QUOTED_STRING:
- ts->token_len++;
- continue;
-
- case LWS_TOKZS_TOKEN_POST_TERMINAL:
- case LWS_TOKZS_TOKEN:
- /* report the delimiter next time */
- ts->start--;
- ts->len++;
- goto token_or_numeric;
- }
- }
-
- /* anything that's not whitespace or delimiter is payload */
-
- switch (state) {
- case LWS_TOKZS_LEADING_WHITESPACE:
-
- if (ts->flags & LWS_TOKENIZE_F_COMMA_SEP_LIST) {
- if (ts->delim == LWSTZ_DT_NEED_DELIM)
- return LWS_TOKZE_ERR_COMMA_LIST;
- ts->delim = LWSTZ_DT_NEED_DELIM;
- }
-
- state = LWS_TOKZS_TOKEN;
- ts->token = ts->start - 1;
- ts->token_len = 1;
- if (c < '0' || c > '9')
- num = 0;
- else
- if (num < 0)
- num = 1;
- continue;
- case LWS_TOKZS_QUOTED_STRING:
- case LWS_TOKZS_TOKEN:
- if (c < '0' || c > '9')
- num = 0;
- else
- if (num < 0)
- num = 1;
- ts->token_len++;
- continue;
- case LWS_TOKZS_TOKEN_POST_TERMINAL:
- /* report the new token next time */
- ts->start--;
- ts->len++;
- goto token_or_numeric;
- }
- }
-
- /* we ran out of content */
-
- if (utf8) /* ended partway through a multibyte char */
- return LWS_TOKZE_ERR_BROKEN_UTF8;
-
- if (state == LWS_TOKZS_QUOTED_STRING)
- return LWS_TOKZE_ERR_UNTERM_STRING;
-
- if (state != LWS_TOKZS_TOKEN_POST_TERMINAL &&
- state != LWS_TOKZS_TOKEN) {
- if ((ts->flags & LWS_TOKENIZE_F_COMMA_SEP_LIST) &&
- ts->delim == LWSTZ_DT_NEED_NEXT_CONTENT)
- return LWS_TOKZE_ERR_COMMA_LIST;
-
- return LWS_TOKZE_ENDED;
- }
-
- /* report the pending token */
-
-token_or_numeric:
-
- if (num != 1)
- return LWS_TOKZE_TOKEN;
- if (flo)
- return LWS_TOKZE_FLOAT;
-
- return LWS_TOKZE_INTEGER;
-}
-
-
-LWS_VISIBLE LWS_EXTERN int
-lws_tokenize_cstr(struct lws_tokenize *ts, char *str, int max)
-{
- if (ts->token_len + 1 >= max)
- return 1;
-
- memcpy(str, ts->token, ts->token_len);
- str[ts->token_len] = '\0';
-
- return 0;
-}
-
-LWS_VISIBLE LWS_EXTERN void
-lws_tokenize_init(struct lws_tokenize *ts, const char *start, int flags)
-{
- ts->start = start;
- ts->len = 0x7fffffff;
- ts->flags = flags;
- ts->delim = LWSTZ_DT_NEED_FIRST_CONTENT;
-}
-
-#if LWS_MAX_SMP > 1
-
-void
-lws_mutex_refcount_init(struct lws_mutex_refcount *mr)
-{
- pthread_mutex_init(&mr->lock, NULL);
- mr->last_lock_reason = NULL;
- mr->lock_depth = 0;
- mr->metadata = 0;
- mr->lock_owner = 0;
-}
-
-void
-lws_mutex_refcount_destroy(struct lws_mutex_refcount *mr)
-{
- pthread_mutex_destroy(&mr->lock);
-}
-
-void
-lws_mutex_refcount_lock(struct lws_mutex_refcount *mr, const char *reason)
-{
- /* if true, this sequence is atomic because our thread has the lock
- *
- * - if true, only guy who can race to make it untrue is our thread,
- * and we are here.
- *
- * - if false, only guy who could race to make it true is our thread,
- * and we are here
- *
- * - it can be false and change to a different tid that is also false
- */
- if (mr->lock_owner == pthread_self()) {
- /* atomic because we only change it if we own the lock */
- mr->lock_depth++;
- return;
- }
-
- pthread_mutex_lock(&mr->lock);
- /* atomic because only we can have the lock */
- mr->last_lock_reason = reason;
- mr->lock_owner = pthread_self();
- mr->lock_depth = 1;
- //lwsl_notice("tid %d: lock %s\n", mr->tid, reason);
-}
-
-void
-lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr)
-{
- if (--mr->lock_depth)
- /* atomic because only thread that has the lock can unlock */
- return;
-
- mr->last_lock_reason = "free";
- mr->lock_owner = 0;
- //lwsl_notice("tid %d: unlock %s\n", mr->tid, mr->last_lock_reason);
- pthread_mutex_unlock(&mr->lock);
-}
-
-#endif /* SMP */
-
LWS_VISIBLE LWS_EXTERN int
lws_is_cgi(struct lws *wsi) {
#ifdef LWS_WITH_CGI
@@ -3432,21 +2941,6 @@ lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name)
return pvo;
}
-int
-lws_pvo_get_str(void *in, const char *name, const char **result)
-{
- const struct lws_protocol_vhost_options *pv =
- lws_pvo_search((const struct lws_protocol_vhost_options *)in,
- name);
-
- if (!pv)
- return 1;
-
- *result = (const char *)pv->value;
-
- return 0;
-}
-
void
lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs)
{
@@ -3761,10 +3255,9 @@ LWS_VISIBLE LWS_EXTERN void
lws_stats_log_dump(struct lws_context *context)
{
struct lws_vhost *v = context->vhost_list;
- int n;
-#if defined(LWS_WITH_PEER_LIMITS)
- int m;
-#endif
+ int n, m;
+
+ (void)m;
if (!context->updated)
return;
diff --git a/thirdparty/libwebsockets/lib/core/output.c b/thirdparty/libwebsockets/core/output.c
index 49d289db40..11965a06b9 100644
--- a/thirdparty/libwebsockets/lib/core/output.c
+++ b/thirdparty/libwebsockets/core/output.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -29,65 +29,49 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
struct lws_context *context = lws_get_context(wsi);
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
size_t real_len = len;
- unsigned int n, m;
+ unsigned int n;
- // lwsl_notice("%s: len %d\n", __func__, (int)len);
- // lwsl_hexdump_level(LLL_NOTICE, buf, len);
+ // lwsl_hexdump_err(buf, len);
/*
* Detect if we got called twice without going through the
- * event loop to handle pending. Since that guarantees extending any
- * existing buflist_out it's inefficient.
+ * event loop to handle pending. This would be caused by either
+ * back-to-back writes in one WRITABLE (illegal) or calling lws_write()
+ * from outside the WRITABLE callback (illegal).
*/
- if (0 && buf && wsi->could_have_pending) {
- lwsl_hexdump_level(LLL_INFO, buf, len);
- lwsl_info("** %p: vh: %s, prot: %s, role %s: "
- "Inefficient back-to-back write of %lu detected...\n",
+ if (wsi->could_have_pending) {
+ lwsl_hexdump_level(LLL_ERR, buf, len);
+ lwsl_err("** %p: vh: %s, prot: %s, role %s: "
+ "Illegal back-to-back write of %lu detected...\n",
wsi, wsi->vhost->name, wsi->protocol->name,
wsi->role_ops->name,
(unsigned long)len);
+ // assert(0);
+
+ return -1;
}
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_WRITE, 1);
+ if (!len)
+ return 0;
/* just ignore sends after we cleared the truncation buffer */
- if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE &&
- !lws_has_buffered_out(wsi)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- && !wsi->http.comp_ctx.may_have_more
-#endif
- )
+ if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE && !wsi->trunc_len)
return (int)len;
- if (buf && lws_has_buffered_out(wsi)) {
- lwsl_info("** %p: vh: %s, prot: %s, incr buflist_out by %lu\n",
+ if (wsi->trunc_len && (buf < wsi->trunc_alloc ||
+ buf > (wsi->trunc_alloc + wsi->trunc_len + wsi->trunc_offset))) {
+ lwsl_hexdump_level(LLL_ERR, buf, len);
+ lwsl_err("** %p: vh: %s, prot: %s, Sending new %lu, pending truncated ...\n"
+ " It's illegal to do an lws_write outside of\n"
+ " the writable callback: fix your code\n",
wsi, wsi->vhost->name, wsi->protocol->name,
(unsigned long)len);
+ assert(0);
- /*
- * already buflist ahead of this, add it on the tail of the
- * buflist, then ignore it for now and act like we're flushing
- * the buflist...
- */
-
- lws_buflist_append_segment(&wsi->buflist_out, buf, len);
-
- buf = NULL;
- len = 0;
- }
-
- if (wsi->buflist_out) {
- /* we have to drain the earliest buflist_out stuff first */
-
- len = lws_buflist_next_segment_len(&wsi->buflist_out, &buf);
- real_len = len;
-
- lwsl_debug("%s: draining %d\n", __func__, (int)len);
+ return -1;
}
- if (!len || !buf)
- return 0;
-
if (!wsi->http2_substream && !lws_socket_is_valid(wsi->desc.sockfd))
lwsl_warn("** error invalid sock but expected to send\n");
@@ -105,15 +89,13 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
/* nope, send it on the socket directly */
lws_latency_pre(context, wsi);
- m = lws_ssl_capable_write(wsi, buf, n);
- lws_latency(context, wsi, "send lws_issue_raw", n, n == m);
-
- lwsl_info("%s: ssl_capable_write (%d) says %d\n", __func__, n, m);
+ n = lws_ssl_capable_write(wsi, buf, n);
+ lws_latency(context, wsi, "send lws_issue_raw", n, n == len);
/* something got written, it can have been truncated now */
wsi->could_have_pending = 1;
- switch (m) {
+ switch (n) {
case LWS_SSL_CAPABLE_ERROR:
/* we're going to close, let close know sends aren't possible */
wsi->socket_is_permanently_unusable = 1;
@@ -124,29 +106,24 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
* ie, implying treat it was a truncated send so it gets
* retried
*/
- m = 0;
+ n = 0;
break;
}
/*
- * we were sending this from buflist_out? Then not sending everything
- * is a small matter of advancing ourselves only by the amount we did
- * send in the buflist.
+ * we were already handling a truncated send?
*/
- if (lws_has_buffered_out(wsi)) {
- if (m) {
- lwsl_info("%p partial adv %d (vs %ld)\n", wsi, m,
- (long)real_len);
- lws_buflist_use_segment(&wsi->buflist_out, m);
- }
-
- if (!lws_has_buffered_out(wsi)) {
- lwsl_info("%s: wsi %p: buflist_out flushed\n",
- __func__, wsi);
-
- m = (int)real_len;
+ if (wsi->trunc_len) {
+ lwsl_info("%p partial adv %d (vs %ld)\n", wsi, n, (long)real_len);
+ wsi->trunc_offset += n;
+ wsi->trunc_len -= n;
+
+ if (!wsi->trunc_len) {
+ lwsl_info("** %p partial send completed\n", wsi);
+ /* done with it, but don't free it */
+ n = (int)real_len;
if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE) {
- lwsl_info("*%p signalling to close now\n", wsi);
+ lwsl_info("** %p signalling to close now\n", wsi);
return -1; /* retry closing now */
}
@@ -157,8 +134,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
"deferred transaction completed\n",
__func__);
wsi->http.deferred_transaction_completed = 0;
- return lws_http_transaction_completed(wsi) ?
- -1 : (int)real_len;
+ return lws_http_transaction_completed(wsi);
}
#endif
#endif
@@ -166,32 +142,43 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
/* always callback on writeable */
lws_callback_on_writable(wsi);
- return m;
+ return n;
}
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.comp_ctx.may_have_more)
- lws_callback_on_writable(wsi);
-#endif
-
- if (m == real_len)
+ if ((unsigned int)n == real_len)
/* what we just sent went out cleanly */
- return m;
+ return n;
/*
- * We were not able to send everything... and we were not sending from
- * an existing buflist_out. So we are starting a fresh buflist_out, by
- * buffering the unsent remainder on it.
- * (it will get first priority next time the socket is writable).
+ * Newly truncated send. Buffer the remainder (it will get
+ * first priority next time the socket is writable).
*/
- lwsl_debug("%p new partial sent %d from %lu total\n", wsi, m,
+ lwsl_debug("%p new partial sent %d from %lu total\n", wsi, n,
(unsigned long)real_len);
- lws_buflist_append_segment(&wsi->buflist_out, buf + m, real_len - m);
-
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITE_PARTIALS, 1);
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_B_PARTIALS_ACCEPTED_PARTS, m);
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_B_PARTIALS_ACCEPTED_PARTS, n);
+
+ /*
+ * - if we still have a suitable malloc lying around, use it
+ * - or, if too small, reallocate it
+ * - or, if no buffer, create it
+ */
+ if (!wsi->trunc_alloc || real_len - n > wsi->trunc_alloc_len) {
+ lws_free(wsi->trunc_alloc);
+
+ wsi->trunc_alloc_len = (unsigned int)(real_len - n);
+ wsi->trunc_alloc = lws_malloc(real_len - n,
+ "truncated send alloc");
+ if (!wsi->trunc_alloc) {
+ lwsl_err("truncated send: unable to malloc %lu\n",
+ (unsigned long)(real_len - n));
+ return -1;
+ }
+ }
+ wsi->trunc_offset = 0;
+ wsi->trunc_len = (unsigned int)(real_len - n);
+ memcpy(wsi->trunc_alloc, buf + n, real_len - n);
#if !defined(LWS_WITH_ESP32)
if (lws_wsi_is_udp(wsi)) {
@@ -212,6 +199,23 @@ LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len,
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ if (wsi->parent_carries_io) {
+ struct lws_write_passthru pas;
+
+ pas.buf = buf;
+ pas.len = len;
+ pas.wp = wp;
+ pas.wsi = wsi;
+
+ if (wsi->parent->protocol->callback(wsi->parent,
+ LWS_CALLBACK_CHILD_WRITE_VIA_PARENT,
+ wsi->parent->user_space,
+ (void *)&pas, 0))
+ return 1;
+
+ return (int)len;
+ }
+
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_LWS_WRITE, 1);
if ((int)len < 0) {
@@ -254,10 +258,6 @@ lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
n = recv(wsi->desc.sockfd, (char *)buf, len, 0);
if (n >= 0) {
-
- if (!n && wsi->unix_skt)
- return LWS_SSL_CAPABLE_ERROR;
-
if (wsi->vhost)
wsi->vhost->conn_stats.rx += n;
lws_stats_atomic_bump(context, pt, LWSSTATS_B_READ, n);
@@ -270,7 +270,7 @@ lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
LWS_ERRNO == LWS_EINTR)
return LWS_SSL_CAPABLE_MORE_SERVICE;
- lwsl_info("error on reading from skt : %d\n", LWS_ERRNO);
+ lwsl_notice("error on reading from skt : %d\n", LWS_ERRNO);
return LWS_SSL_CAPABLE_ERROR;
}
@@ -281,13 +281,10 @@ lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len)
if (lws_wsi_is_udp(wsi)) {
#if !defined(LWS_WITH_ESP32)
- if (lws_has_buffered_out(wsi))
- n = sendto(wsi->desc.sockfd, (const char *)buf,
- len, 0, &wsi->udp->sa_pending,
- wsi->udp->salen_pending);
+ if (wsi->trunc_len)
+ n = sendto(wsi->desc.sockfd, buf, len, 0, &wsi->udp->sa_pending, wsi->udp->salen_pending);
else
- n = sendto(wsi->desc.sockfd, (const char *)buf,
- len, 0, &wsi->udp->sa, wsi->udp->salen);
+ n = sendto(wsi->desc.sockfd, buf, len, 0, &wsi->udp->sa, wsi->udp->salen);
#endif
} else
n = send(wsi->desc.sockfd, (char *)buf, len, MSG_NOSIGNAL);
@@ -306,7 +303,7 @@ lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len)
}
lwsl_debug("ERROR writing len %d to skt fd %d err %d / errno %d\n",
- len, wsi->desc.sockfd, n, LWS_ERRNO);
+ len, wsi->desc.sockfd, n, LWS_ERRNO);
return LWS_SSL_CAPABLE_ERROR;
}
diff --git a/thirdparty/libwebsockets/lib/core/pollfd.c b/thirdparty/libwebsockets/core/pollfd.c
index 834298577a..2a632ce8ec 100644
--- a/thirdparty/libwebsockets/lib/core/pollfd.c
+++ b/thirdparty/libwebsockets/core/pollfd.c
@@ -134,8 +134,7 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
pfd = &pt->fds[wsi->position_in_fds_table];
pa->fd = wsi->desc.sockfd;
- lwsl_debug("%s: wsi %p: fd %d events %d -> %d\n", __func__, wsi,
- pa->fd, pfd->events, (pfd->events & ~_and) | _or);
+ lwsl_debug("%s: wsi %p: fd %d events %d -> %d\n", __func__, wsi, pa->fd, pfd->events, (pfd->events & ~_and) | _or);
pa->prev_events = pfd->events;
pa->events = pfd->events = (pfd->events & ~_and) | _or;
@@ -183,7 +182,7 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
ret = -1;
goto bail;
}
- sampled_tid = pt->service_tid;
+ sampled_tid = context->service_tid;
if (sampled_tid && wsi->vhost) {
tid = wsi->vhost->protocols[0].callback(wsi,
LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0);
@@ -246,8 +245,7 @@ __insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi)
#if !defined(_WIN32)
if (wsi->desc.sockfd - lws_plat_socket_offset() >= context->max_fds) {
lwsl_err("Socket fd %d is too high (%d) offset %d\n",
- wsi->desc.sockfd, context->max_fds,
- lws_plat_socket_offset());
+ wsi->desc.sockfd, context->max_fds, lws_plat_socket_offset());
return 1;
}
#endif
@@ -300,6 +298,11 @@ __remove_wsi_socket_from_fds(struct lws *wsi)
int v;
int m, ret = 0;
+ if (wsi->parent_carries_io) {
+ lws_same_vh_protocol_remove(wsi);
+ return 0;
+ }
+
#if !defined(_WIN32)
if (wsi->desc.sockfd - lws_plat_socket_offset() > context->max_fds) {
lwsl_err("fd %d too high (%d)\n", wsi->desc.sockfd,
@@ -327,7 +330,7 @@ __remove_wsi_socket_from_fds(struct lws *wsi)
LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE |
LWS_EV_PREPARE_DELETION);
- lwsl_debug("%s: wsi=%p, skt=%d, fds pos=%d, end guy pos=%d, endfd=%d\n",
+ lwsl_debug("%s: wsi=%p, sock=%d, fds pos=%d, end guy pos=%d, endfd=%d\n",
__func__, wsi, wsi->desc.sockfd, wsi->position_in_fds_table,
pt->fds_count, pt->fds[pt->fds_count].fd);
@@ -337,13 +340,11 @@ __remove_wsi_socket_from_fds(struct lws *wsi)
pt->fds[m] = pt->fds[pt->fds_count - 1];
/* this decrements pt->fds_count */
lws_plat_delete_socket_from_fds(context, wsi, m);
- pt->count_conns--;
v = (int) pt->fds[m].fd;
- /* end guy's "position in fds table" is now the deletion
- * guy's old one */
+ /* end guy's "position in fds table" is now the deletion guy's old one */
end_wsi = wsi_from_fd(context, v);
if (!end_wsi) {
- lwsl_err("no wsi for fd %d pos %d, pt->fds_count=%d\n",
+ lwsl_err("no wsi for fd %d at pos %d, pt->fds_count=%d\n",
(int)pt->fds[m].fd, m, pt->fds_count);
assert(0);
} else
@@ -425,6 +426,7 @@ LWS_VISIBLE int
lws_callback_on_writable(struct lws *wsi)
{
struct lws_context_per_thread *pt;
+ int n;
if (lwsi_state(wsi) == LRS_SHUTDOWN)
return 0;
@@ -434,10 +436,26 @@ lws_callback_on_writable(struct lws *wsi)
pt = &wsi->context->pt[(int)wsi->tsi];
+ if (wsi->parent_carries_io) {
+#if defined(LWS_WITH_STATS)
+ if (!wsi->active_writable_req_us) {
+ wsi->active_writable_req_us = time_in_microseconds();
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
+ }
+#endif
+ n = lws_callback_on_writable(wsi->parent);
+ if (n < 0)
+ return n;
+
+ wsi->parent_pending_cb_on_writable = 1;
+ return 1;
+ }
+
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB_REQ, 1);
#if defined(LWS_WITH_STATS)
if (!wsi->active_writable_req_us) {
- wsi->active_writable_req_us = lws_time_in_microseconds();
+ wsi->active_writable_req_us = time_in_microseconds();
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
}
@@ -475,33 +493,64 @@ lws_callback_on_writable(struct lws *wsi)
void
lws_same_vh_protocol_insert(struct lws *wsi, int n)
{
+ if (wsi->same_vh_protocol_prev || wsi->same_vh_protocol_next) {
+ lws_same_vh_protocol_remove(wsi);
+ lwsl_notice("Attempted to attach wsi twice to same vh prot\n");
+ }
+
lws_vhost_lock(wsi->vhost);
- if (!lws_dll_is_null(&wsi->same_vh_protocol))
- lws_dll_lws_remove(&wsi->same_vh_protocol);
+ wsi->same_vh_protocol_prev = &wsi->vhost->same_vh_protocol_list[n];
+ /* old first guy is our next */
+ wsi->same_vh_protocol_next = wsi->vhost->same_vh_protocol_list[n];
+ /* we become the new first guy */
+ wsi->vhost->same_vh_protocol_list[n] = wsi;
- lws_dll_lws_add_front(&wsi->same_vh_protocol,
- &wsi->vhost->same_vh_protocol_heads[n]);
+ if (wsi->same_vh_protocol_next)
+ /* old first guy points back to us now */
+ wsi->same_vh_protocol_next->same_vh_protocol_prev =
+ &wsi->same_vh_protocol_next;
- lws_vhost_unlock(wsi->vhost);
-}
+ wsi->on_same_vh_list = 1;
-void
-__lws_same_vh_protocol_remove(struct lws *wsi)
-{
- if (!lws_dll_is_null(&wsi->same_vh_protocol))
- lws_dll_lws_remove(&wsi->same_vh_protocol);
+ lws_vhost_unlock(wsi->vhost);
}
void
lws_same_vh_protocol_remove(struct lws *wsi)
{
- if (!wsi->vhost)
+ /*
+ * detach ourselves from vh protocol list if we're on one
+ * A -> B -> C
+ * A -> C , or, B -> C, or A -> B
+ *
+ * OK to call on already-detached wsi
+ */
+ lwsl_info("%s: removing same prot wsi %p\n", __func__, wsi);
+
+ if (!wsi->vhost || !wsi->on_same_vh_list)
return;
lws_vhost_lock(wsi->vhost);
- __lws_same_vh_protocol_remove(wsi);
+ if (wsi->same_vh_protocol_prev) {
+ assert (*(wsi->same_vh_protocol_prev) == wsi);
+ lwsl_info("have prev %p, setting him to our next %p\n",
+ wsi->same_vh_protocol_prev,
+ wsi->same_vh_protocol_next);
+
+ /* guy who pointed to us should point to our next */
+ *(wsi->same_vh_protocol_prev) = wsi->same_vh_protocol_next;
+ }
+
+ /* our next should point back to our prev */
+ if (wsi->same_vh_protocol_next)
+ wsi->same_vh_protocol_next->same_vh_protocol_prev =
+ wsi->same_vh_protocol_prev;
+
+ wsi->same_vh_protocol_prev = NULL;
+ wsi->same_vh_protocol_next = NULL;
+ wsi->on_same_vh_list = 0;
lws_vhost_unlock(wsi->vhost);
}
@@ -509,10 +558,9 @@ lws_same_vh_protocol_remove(struct lws *wsi)
LWS_VISIBLE int
lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
- const struct lws_protocols *protocol)
+ const struct lws_protocols *protocol)
{
struct lws *wsi;
- int n;
if (protocol < vhost->protocols ||
protocol >= (vhost->protocols + vhost->count_protocols)) {
@@ -523,16 +571,18 @@ lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
return -1;
}
- n = (int)(protocol - vhost->protocols);
-
- lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
- vhost->same_vh_protocol_heads[n].next) {
- wsi = lws_container_of(d, struct lws, same_vh_protocol);
-
+ wsi = vhost->same_vh_protocol_list[protocol - vhost->protocols];
+ while (wsi) {
assert(wsi->protocol == protocol);
- lws_callback_on_writable(wsi);
+ assert(*wsi->same_vh_protocol_prev == wsi);
+ if (wsi->same_vh_protocol_next)
+ assert(wsi->same_vh_protocol_next->
+ same_vh_protocol_prev ==
+ &wsi->same_vh_protocol_next);
- } lws_end_foreach_dll_safe(d, d1);
+ lws_callback_on_writable(wsi);
+ wsi = wsi->same_vh_protocol_next;
+ }
return 0;
}
@@ -552,7 +602,7 @@ lws_callback_on_writable_all_protocol(const struct lws_context *context,
while (vhost) {
for (n = 0; n < vhost->count_protocols; n++)
if (protocol->callback ==
- vhost->protocols[n].callback &&
+ vhost->protocols[n].callback &&
!strcmp(protocol->name, vhost->protocols[n].name))
break;
if (n != vhost->count_protocols)
diff --git a/thirdparty/libwebsockets/lib/core/private.h b/thirdparty/libwebsockets/core/private.h
index c1a0a661b1..73748b0498 100644
--- a/thirdparty/libwebsockets/lib/core/private.h
+++ b/thirdparty/libwebsockets/core/private.h
@@ -36,6 +36,10 @@
typedef float _Float128x;
#endif
+#ifdef LWS_HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,17 +48,271 @@
#include <limits.h>
#include <stdarg.h>
#include <inttypes.h>
+
+#if defined(LWS_WITH_ESP32)
+ #define MSG_NOSIGNAL 0
+ #define SOMAXCONN 3
+#endif
+
+#define STORE_IN_ROM
#include <assert.h>
+#if LWS_MAX_SMP > 1
+ #include <pthread.h>
+#endif
-#ifdef LWS_HAVE_SYS_TYPES_H
+#ifdef LWS_HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+#endif
+
+#if defined(WIN32) || defined(_WIN32)
+
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
+
+ #if (WINVER < 0x0501)
+ #undef WINVER
+ #undef _WIN32_WINNT
+ #define WINVER 0x0501
+ #define _WIN32_WINNT WINVER
+ #endif
+
+ #define LWS_NO_DAEMONIZE
+ #define LWS_ERRNO WSAGetLastError()
+ #define LWS_EAGAIN WSAEWOULDBLOCK
+ #define LWS_EALREADY WSAEALREADY
+ #define LWS_EINPROGRESS WSAEINPROGRESS
+ #define LWS_EINTR WSAEINTR
+ #define LWS_EISCONN WSAEISCONN
+ #define LWS_EWOULDBLOCK WSAEWOULDBLOCK
+ #define MSG_NOSIGNAL 0
+ #define SHUT_RDWR SD_BOTH
+ #define SOL_TCP IPPROTO_TCP
+ #define SHUT_WR SD_SEND
+
+ #define compatible_close(fd) closesocket(fd)
+ #define lws_set_blocking_send(wsi) wsi->sock_send_blocking = 1
+ #define LWS_SOCK_INVALID (INVALID_SOCKET)
+
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #include <windows.h>
+ #include <tchar.h>
+ #ifdef LWS_HAVE_IN6ADDR_H
+ #include <in6addr.h>
+ #endif
+ #include <mstcpip.h>
+ #include <io.h>
+
+ #if !defined(LWS_HAVE_ATOLL)
+ #if defined(LWS_HAVE__ATOI64)
+ #define atoll _atoi64
+ #else
+ #warning No atoll or _atoi64 available, using atoi
+ #define atoll atoi
+ #endif
+ #endif
+
+ #ifndef __func__
+ #define __func__ __FUNCTION__
+ #endif
+
+ #ifdef LWS_HAVE__VSNPRINTF
+ #define vsnprintf _vsnprintf
+ #endif
+
+ /* we don't have an implementation for this on windows... */
+ int kill(int pid, int sig);
+ int fork(void);
+ #ifndef SIGINT
+ #define SIGINT 2
+ #endif
+
+#else /* not windows --> */
+
+ #include <fcntl.h>
+ #include <strings.h>
+ #include <unistd.h>
#include <sys/types.h>
+
+ #ifndef __cplusplus
+ #include <errno.h>
+ #endif
+ #include <netdb.h>
+ #include <signal.h>
+ #include <sys/socket.h>
+
+ #if defined(LWS_BUILTIN_GETIFADDRS)
+ #include "./misc/getifaddrs.h"
+ #else
+ #if !defined(LWS_WITH_ESP32)
+ #if defined(__HAIKU__)
+ #define _BSD_SOURCE
+ #endif
+ #include <ifaddrs.h>
+ #endif
+ #endif
+ #if defined (__ANDROID__)
+ #include <syslog.h>
+ #include <sys/resource.h>
+ #elif defined (__sun) || defined(__HAIKU__) || defined(__QNX__)
+ #include <syslog.h>
+ #else
+ #if !defined(LWS_WITH_ESP32)
+ #include <sys/syslog.h>
+ #endif
+ #endif
+ #include <netdb.h>
+ #if !defined(LWS_WITH_ESP32)
+ #include <sys/mman.h>
+ #include <sys/un.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
+ #include <arpa/inet.h>
+ #include <poll.h>
+ #endif
+ #ifndef LWS_NO_FORK
+ #ifdef LWS_HAVE_SYS_PRCTL_H
+ #include <sys/prctl.h>
+ #endif
+ #endif
+
+ #include <sys/time.h>
+
+ #define LWS_ERRNO errno
+ #define LWS_EAGAIN EAGAIN
+ #define LWS_EALREADY EALREADY
+ #define LWS_EINPROGRESS EINPROGRESS
+ #define LWS_EINTR EINTR
+ #define LWS_EISCONN EISCONN
+ #define LWS_EWOULDBLOCK EWOULDBLOCK
+
+ #define lws_set_blocking_send(wsi)
+
+ #define LWS_SOCK_INVALID (-1)
+#endif /* not windows */
+
+#ifndef LWS_HAVE_BZERO
+ #ifndef bzero
+ #define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
+ #endif
#endif
-#ifdef LWS_HAVE_SYS_STAT_H
+
+#ifndef LWS_HAVE_STRERROR
+ #define strerror(x) ""
+#endif
+
+
+#define lws_socket_is_valid(x) (x != LWS_SOCK_INVALID)
+
+#include "libwebsockets.h"
+
+#include "tls/private.h"
+
+#if defined(WIN32) || defined(_WIN32)
+ #include <gettimeofday.h>
+
+ #ifndef BIG_ENDIAN
+ #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */
+ #endif
+ #ifndef LITTLE_ENDIAN
+ #define LITTLE_ENDIAN 1234
+ #endif
+ #ifndef BYTE_ORDER
+ #define BYTE_ORDER LITTLE_ENDIAN
+ #endif
+
+ #undef __P
+ #ifndef __P
+ #if __STDC__
+ #define __P(protos) protos
+ #else
+ #define __P(protos) ()
+ #endif
+ #endif
+
+#else /* not windows */
+ static LWS_INLINE int compatible_close(int fd) { return close(fd); }
+
#include <sys/stat.h>
+ #include <sys/time.h>
+
+ #if defined(__APPLE__)
+ #include <machine/endian.h>
+ #elif defined(__FreeBSD__)
+ #include <sys/endian.h>
+ #elif defined(__linux__)
+ #include <endian.h>
+ #endif
#endif
-#if LWS_MAX_SMP > 1
- #include <pthread.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__QNX__)
+ #include <gulliver.h>
+ #if defined(__LITTLEENDIAN__)
+ #define BYTE_ORDER __LITTLEENDIAN__
+ #define LITTLE_ENDIAN __LITTLEENDIAN__
+ #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc); for suppres warning that BIG_ENDIAN is not defined. */
+ #endif
+ #if defined(__BIGENDIAN__)
+ #define BYTE_ORDER __BIGENDIAN__
+ #define LITTLE_ENDIAN 1234 /* to show byte order (taken from gcc); for suppres warning that LITTLE_ENDIAN is not defined. */
+ #define BIG_ENDIAN __BIGENDIAN__
+ #endif
+#endif
+
+#if defined(__sun) && defined(__GNUC__)
+
+ #include <arpa/nameser_compat.h>
+
+ #if !defined (BYTE_ORDER)
+ #define BYTE_ORDER __BYTE_ORDER__
+ #endif
+
+ #if !defined(LITTLE_ENDIAN)
+ #define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+ #endif
+
+ #if !defined(BIG_ENDIAN)
+ #define BIG_ENDIAN __ORDER_BIG_ENDIAN__
+ #endif
+
+#endif /* sun + GNUC */
+
+#if !defined(BYTE_ORDER)
+ #define BYTE_ORDER __BYTE_ORDER
+#endif
+#if !defined(LITTLE_ENDIAN)
+ #define LITTLE_ENDIAN __LITTLE_ENDIAN
+#endif
+#if !defined(BIG_ENDIAN)
+ #define BIG_ENDIAN __BIG_ENDIAN
+#endif
+
+
+/*
+ * Mac OSX as well as iOS do not define the MSG_NOSIGNAL flag,
+ * but happily have something equivalent in the SO_NOSIGPIPE flag.
+ */
+#ifdef __APPLE__
+#define MSG_NOSIGNAL SO_NOSIGPIPE
+#endif
+
+/*
+ * Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in
+ * POSIX 2008.
+ */
+#ifdef __sun
+ #define MSG_NOSIGNAL 0
+#endif
+
+#ifdef _WIN32
+ #ifndef FD_HASHTABLE_MODULUS
+ #define FD_HASHTABLE_MODULUS 32
+ #endif
#endif
#ifndef LWS_DEF_HEADER_LEN
@@ -93,49 +351,6 @@
#define LWS_H2_RX_SCRATCH_SIZE 512
-#define lws_socket_is_valid(x) (x != LWS_SOCK_INVALID)
-
-#ifndef LWS_HAVE_STRERROR
- #define strerror(x) ""
-#endif
-
- /*
- *
- * ------ private platform defines ------
- *
- */
-
-#if defined(LWS_WITH_ESP32)
- #include "plat/esp32/private.h"
-#else
- #if defined(WIN32) || defined(_WIN32)
- #include "plat/windows/private.h"
- #else
- #if defined(LWS_PLAT_OPTEE)
- #include "plat/optee/private.h"
- #else
- #include "plat/unix/private.h"
- #endif
- #endif
-#endif
-
-#ifndef LWS_HAVE_BZERO
- #ifndef bzero
- #define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
- #endif
-#endif
-
- /*
- *
- * ------ public api ------
- *
- */
-
-#include "libwebsockets.h"
-
-
-#include "tls/private.h"
-
#if defined(WIN32) || defined(_WIN32)
// Visual studio older than 2015 and WIN_CE has only _stricmp
#if (defined(_MSC_VER) && _MSC_VER < 1900) || defined(_WIN32_WCE)
@@ -146,14 +361,6 @@
#define getdtablesize() 30000
#endif
-#ifndef LWS_ARRAY_SIZE
-#define LWS_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
* All lws_tls...() functions must return this type, converting the
* native backend result and doing the extra work to determine which one
@@ -164,11 +371,11 @@ extern "C" {
* Non-SSL mode also uses these types.
*/
enum lws_ssl_capable_status {
- LWS_SSL_CAPABLE_ERROR = -1, /* it failed */
- LWS_SSL_CAPABLE_DONE = 0, /* it succeeded */
- LWS_SSL_CAPABLE_MORE_SERVICE_READ = -2, /* retry WANT_READ */
- LWS_SSL_CAPABLE_MORE_SERVICE_WRITE = -3, /* retry WANT_WRITE */
- LWS_SSL_CAPABLE_MORE_SERVICE = -4, /* general retry */
+ LWS_SSL_CAPABLE_ERROR = -1, /* it failed */
+ LWS_SSL_CAPABLE_DONE = 0, /* it succeeded */
+ LWS_SSL_CAPABLE_MORE_SERVICE_READ = -2, /* retry WANT_READ */
+ LWS_SSL_CAPABLE_MORE_SERVICE_WRITE = -3, /* retry WANT_WRITE */
+ LWS_SSL_CAPABLE_MORE_SERVICE = -4, /* general retry */
};
#if defined(__clang__)
@@ -310,6 +517,14 @@ struct lws_signal_watcher {
struct lws_context *context;
};
+#ifdef _WIN32
+#define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) % FD_HASHTABLE_MODULUS)
+struct lws_fd_hashtable {
+ struct lws **wsi;
+ int length;
+};
+#endif
+
struct lws_foreign_thread_pollfd {
struct lws_foreign_thread_pollfd *next;
int fd_index;
@@ -317,28 +532,6 @@ struct lws_foreign_thread_pollfd {
int _or;
};
-#if LWS_MAX_SMP > 1
-
-struct lws_mutex_refcount {
- pthread_mutex_t lock;
- pthread_t lock_owner;
- const char *last_lock_reason;
- char lock_depth;
- char metadata;
-};
-
-void
-lws_mutex_refcount_init(struct lws_mutex_refcount *mr);
-
-void
-lws_mutex_refcount_destroy(struct lws_mutex_refcount *mr);
-
-void
-lws_mutex_refcount_lock(struct lws_mutex_refcount *mr, const char *reason);
-
-void
-lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr);
-#endif
#define LWS_HRTIMER_NOWAIT (0x7fffffffffffffffll)
@@ -349,9 +542,10 @@ lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr);
struct lws_context_per_thread {
#if LWS_MAX_SMP > 1
+ pthread_mutex_t lock;
pthread_mutex_t lock_stats;
- struct lws_mutex_refcount mr;
- pthread_t self;
+ pthread_t lock_owner;
+ const char *last_lock_reason;
#endif
struct lws_context *context;
@@ -374,7 +568,7 @@ struct lws_context_per_thread {
struct lws_pollfd *fds;
volatile struct lws_foreign_thread_pollfd * volatile foreign_pfd_list;
#ifdef _WIN32
- WSAEVENT events;
+ WSAEVENT *events;
#endif
lws_sockfd_type dummy_pipe_fds[2];
struct lws *pipe_wsi;
@@ -387,9 +581,6 @@ struct lws_context_per_thread {
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
struct lws_pt_role_http http;
#endif
-#if defined(LWS_ROLE_DBUS)
- struct lws_pt_role_dbus dbus;
-#endif
/* --- event library based members --- */
@@ -403,8 +594,7 @@ struct lws_context_per_thread {
struct lws_pt_eventlibs_libevent event;
#endif
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || \
- defined(LWS_WITH_LIBEVENT)
+#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
struct lws_signal_watcher w_sigint;
#endif
@@ -413,20 +603,12 @@ struct lws_context_per_thread {
unsigned long count_conns;
unsigned int fds_count;
- /*
- * set to the Thread ID that's doing the service loop just before entry
- * to poll indicates service thread likely idling in poll()
- * volatile because other threads may check it as part of processing
- * for pollfd event change.
- */
- volatile int service_tid;
- int service_tid_detected;
-
volatile unsigned char inside_poll;
volatile unsigned char foreign_spinlock;
unsigned char tid;
+ unsigned char lock_depth;
unsigned char inside_service:1;
unsigned char event_loop_foreign:1;
unsigned char event_loop_destroy_processing_done:1;
@@ -444,10 +626,8 @@ lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs);
struct lws_timed_vh_protocol {
struct lws_timed_vh_protocol *next;
const struct lws_protocols *protocol;
- struct lws_vhost *vhost; /* only used for pending processing */
time_t time;
int reason;
- int tsi_req;
};
/*
@@ -475,7 +655,6 @@ struct lws_vhost {
#endif
#if LWS_MAX_SMP > 1
pthread_mutex_t lock;
- char close_flow_vs_tsi[LWS_MAX_SMP];
#endif
#if defined(LWS_ROLE_H2)
@@ -504,9 +683,6 @@ struct lws_vhost {
const char *name;
const char *iface;
- void (*finalize)(struct lws_vhost *vh, void *arg);
- void *finalize_arg;
-
#if !defined(LWS_WITH_ESP32) && !defined(OPTEE_TA) && !defined(WIN32)
int bind_iface;
#endif
@@ -514,7 +690,7 @@ struct lws_vhost {
void **protocol_vh_privs;
const struct lws_protocol_vhost_options *pvo;
const struct lws_protocol_vhost_options *headers;
- struct lws_dll_lws *same_vh_protocol_heads;
+ struct lws **same_vh_protocol_list;
struct lws_vhost *no_listener_vhost_list;
#if !defined(LWS_NO_CLIENT)
struct lws_dll_lws dll_active_client_conns;
@@ -540,8 +716,6 @@ struct lws_vhost {
int keepalive_timeout;
int timeout_secs_ah_idle;
- int count_bound_wsi;
-
#ifdef LWS_WITH_ACCESS_LOG
int log_fd;
#endif
@@ -553,13 +727,6 @@ struct lws_vhost {
unsigned char raw_protocol_index;
};
-void
-lws_vhost_bind_wsi(struct lws_vhost *vh, struct lws *wsi);
-void
-lws_vhost_unbind_wsi(struct lws *wsi);
-void
-__lws_vhost_destroy2(struct lws_vhost *vh);
-
struct lws_deferred_free
{
struct lws_deferred_free *next;
@@ -624,7 +791,8 @@ struct lws_context {
struct lws_context_per_thread pt[LWS_MAX_SMP];
struct lws_conn_stats conn_stats;
#if LWS_MAX_SMP > 1
- struct lws_mutex_refcount mr;
+ pthread_mutex_t lock;
+ int lock_depth;
#endif
#ifdef _WIN32
/* different implementation between unix and windows */
@@ -637,11 +805,6 @@ struct lws_context {
struct lws_vhost *vhost_pending_destruction_list;
struct lws_plugin *plugin_list;
struct lws_deferred_free *deferred_free_list;
-
-#if defined(LWS_WITH_THREADPOOL)
- struct lws_threadpool *tp_list_head;
-#endif
-
#if defined(LWS_WITH_PEER_LIMITS)
struct lws_peer **pl_hash_table;
struct lws_peer *peer_wait_list;
@@ -726,6 +889,14 @@ struct lws_context {
unsigned int doing_protocol_init:1;
unsigned int done_protocol_destroy_cb:1;
unsigned int finalize_destroy_after_internal_loops_stopped:1;
+ /*
+ * set to the Thread ID that's doing the service loop just before entry
+ * to poll indicates service thread likely idling in poll()
+ * volatile because other threads may check it as part of processing
+ * for pollfd event change.
+ */
+ volatile int service_tid;
+ int service_tid_detected;
short count_threads;
short plugin_protocol_count;
@@ -738,7 +909,7 @@ struct lws_context {
};
int
-lws_check_deferred_free(struct lws_context *context, int tsi, int force);
+lws_check_deferred_free(struct lws_context *context, int force);
#define lws_get_context_protocol(ctx, x) ctx->vhost_list->protocols[x]
#define lws_get_vh_protocol(vh, x) vh->protocols[x]
@@ -774,13 +945,13 @@ enum {
LWS_EV_START = (1 << 2),
LWS_EV_STOP = (1 << 3),
- LWS_EV_PREPARE_DELETION = (1u << 31),
+ LWS_EV_PREPARE_DELETION = (1 << 31),
};
#if defined(LWS_WITH_ESP32)
LWS_EXTERN int
-lws_find_string_in_file(const char *filename, const char *str, int stringlen);
+lws_find_string_in_file(const char *filename, const char *string, int stringlen);
#endif
#ifdef LWS_WITH_IPV6
@@ -855,9 +1026,6 @@ struct lws {
#if defined(LWS_ROLE_WS)
struct _lws_websocket_related *ws; /* allocated if we upgrade to ws */
#endif
-#if defined(LWS_ROLE_DBUS)
- struct _lws_dbus_mode_related dbus;
-#endif
const struct lws_role_ops *role_ops;
lws_wsi_state_t wsistate;
@@ -865,8 +1033,7 @@ struct lws {
/* lifetime members */
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || \
- defined(LWS_WITH_LIBEVENT)
+#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
struct lws_io_watcher w_read;
#endif
#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBEVENT)
@@ -882,16 +1049,12 @@ struct lws {
struct lws *sibling_list; /* subsequent children at same level */
const struct lws_protocols *protocol;
- struct lws_dll_lws same_vh_protocol;
+ struct lws **same_vh_protocol_prev, *same_vh_protocol_next;
struct lws_dll_lws dll_timeout;
struct lws_dll_lws dll_hrtimer;
struct lws_dll_lws dll_buflist; /* guys with pending rxflow */
-#if defined(LWS_WITH_THREADPOOL)
- struct lws_threadpool_task *tp_task;
-#endif
-
#if defined(LWS_WITH_PEER_LIMITS)
struct lws_peer *peer;
#endif
@@ -907,8 +1070,10 @@ struct lws {
void *user_space;
void *opaque_parent_data;
- struct lws_buflist *buflist; /* input-side buflist */
- struct lws_buflist *buflist_out; /* output-side buflist */
+ struct lws_buflist *buflist;
+
+ /* truncated send handling */
+ unsigned char *trunc_alloc; /* non-NULL means buffering in progress */
#if defined(LWS_WITH_TLS)
struct lws_lws_tls tls;
@@ -933,7 +1098,9 @@ struct lws {
/* ints */
#define LWS_NO_FDS_POS (-1)
int position_in_fds_table;
-
+ unsigned int trunc_alloc_len; /* size of malloc */
+ unsigned int trunc_offset; /* where we are in terms of spilling */
+ unsigned int trunc_len; /* how much is buffered */
#ifndef LWS_NO_CLIENT
int chunk_remaining;
#endif
@@ -961,18 +1128,18 @@ struct lws {
unsigned int waiting_to_send_close_frame:1;
unsigned int close_needs_ack:1;
unsigned int ipv6:1;
+ unsigned int parent_carries_io:1;
unsigned int parent_pending_cb_on_writable:1;
unsigned int cgi_stdout_zero_length:1;
unsigned int seen_zero_length_recv:1;
unsigned int rxflow_will_be_applied:1;
unsigned int event_pipe:1;
+ unsigned int on_same_vh_list:1;
unsigned int handling_404:1;
unsigned int protocol_bind_balance:1;
- unsigned int unix_skt:1;
unsigned int could_have_pending:1; /* detect back-to-back writes */
unsigned int outer_will_close:1;
- unsigned int shadow:1; /* we do not control fd lifecycle at all */
#ifdef LWS_WITH_ACCESS_LOG
unsigned int access_log_pending:1;
@@ -1027,9 +1194,6 @@ struct lws {
volatile char leave_pollout_active;
};
-LWS_EXTERN char *
-lws_strdup(const char *s);
-
#define lws_is_flowcontrolled(w) (!!(wsi->rxflow_bitmap))
void
@@ -1079,9 +1243,6 @@ lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
int ret, int completion);
#endif
-static LWS_INLINE int
-lws_has_buffered_out(struct lws *wsi) { return !!wsi->buflist_out; }
-
LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_ws_client_rx_sm(struct lws *wsi, unsigned char c);
@@ -1101,7 +1262,22 @@ LWS_EXTERN int
lws_service_flag_pending(struct lws_context *context, int tsi);
LWS_EXTERN int
-__lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p);
+lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p);
+
+#if defined(_WIN32)
+LWS_EXTERN struct lws *
+wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd);
+
+LWS_EXTERN int
+insert_wsi(struct lws_context *context, struct lws *wsi);
+
+LWS_EXTERN int
+delete_from_fd(struct lws_context *context, lws_sockfd_type fd);
+#else
+#define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]
+#define insert_wsi(A,B) assert(A->lws_lookup[B->desc.sockfd - lws_plat_socket_offset()] == 0); A->lws_lookup[B->desc.sockfd - lws_plat_socket_offset()]=B
+#define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]=0
+#endif
LWS_EXTERN int LWS_WARN_UNUSED_RESULT
__insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi);
@@ -1129,7 +1305,7 @@ LWS_EXTERN int
lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd);
LWS_EXTERN struct lws *
-lws_http_client_connect_via_info2(struct lws *wsi);
+lws_client_connect_via_info2(struct lws *wsi);
@@ -1167,8 +1343,10 @@ user_callback_handle_rxflow(lws_callback_function, struct lws *wsi,
void *in, size_t len);
LWS_EXTERN int
-lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
- int unix_skt);
+lws_plat_socket_offset(void);
+
+LWS_EXTERN int
+lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd);
LWS_EXTERN int
lws_plat_check_connection_error(struct lws *wsi);
@@ -1251,7 +1429,7 @@ LWS_EXTERN void lwsl_emit_stderr(int level, const char *line);
static LWS_INLINE void
lws_pt_mutex_init(struct lws_context_per_thread *pt)
{
- lws_mutex_refcount_init(&pt->mr);
+ pthread_mutex_init(&pt->lock, NULL);
pthread_mutex_init(&pt->lock_stats, NULL);
}
@@ -1259,11 +1437,34 @@ static LWS_INLINE void
lws_pt_mutex_destroy(struct lws_context_per_thread *pt)
{
pthread_mutex_destroy(&pt->lock_stats);
- lws_mutex_refcount_destroy(&pt->mr);
+ pthread_mutex_destroy(&pt->lock);
}
-#define lws_pt_lock(pt, reason) lws_mutex_refcount_lock(&pt->mr, reason)
-#define lws_pt_unlock(pt) lws_mutex_refcount_unlock(&pt->mr)
+static LWS_INLINE void
+lws_pt_lock(struct lws_context_per_thread *pt, const char *reason)
+{
+ if (pt->lock_owner == pthread_self()) {
+ pt->lock_depth++;
+ return;
+ }
+ pthread_mutex_lock(&pt->lock);
+ pt->last_lock_reason = reason;
+ pt->lock_owner = pthread_self();
+ //lwsl_notice("tid %d: lock %s\n", pt->tid, reason);
+}
+
+static LWS_INLINE void
+lws_pt_unlock(struct lws_context_per_thread *pt)
+{
+ if (pt->lock_depth) {
+ pt->lock_depth--;
+ return;
+ }
+ pt->last_lock_reason = "free";
+ pt->lock_owner = 0;
+ //lwsl_notice("tid %d: unlock %s\n", pt->tid, pt->last_lock_reason);
+ pthread_mutex_unlock(&pt->lock);
+}
static LWS_INLINE void
lws_pt_stats_lock(struct lws_context_per_thread *pt)
@@ -1277,8 +1478,17 @@ lws_pt_stats_unlock(struct lws_context_per_thread *pt)
pthread_mutex_unlock(&pt->lock_stats);
}
-#define lws_context_lock(c, reason) lws_mutex_refcount_lock(&c->mr, reason)
-#define lws_context_unlock(c) lws_mutex_refcount_unlock(&c->mr)
+static LWS_INLINE void
+lws_context_lock(struct lws_context *context)
+{
+ pthread_mutex_lock(&context->lock);
+}
+
+static LWS_INLINE void
+lws_context_unlock(struct lws_context *context)
+{
+ pthread_mutex_unlock(&context->lock);
+}
static LWS_INLINE void
lws_vhost_lock(struct lws_vhost *vhost)
@@ -1298,7 +1508,7 @@ lws_vhost_unlock(struct lws_vhost *vhost)
#define lws_pt_mutex_destroy(_a) (void)(_a)
#define lws_pt_lock(_a, b) (void)(_a)
#define lws_pt_unlock(_a) (void)(_a)
-#define lws_context_lock(_a, _b) (void)(_a)
+#define lws_context_lock(_a) (void)(_a)
#define lws_context_unlock(_a) (void)(_a)
#define lws_vhost_lock(_a) (void)(_a)
#define lws_vhost_unlock(_a) (void)(_a)
@@ -1356,7 +1566,7 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len);
LWS_EXTERN int
lws_access_log(struct lws *wsi);
LWS_EXTERN void
-lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int len, int meth);
+lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int meth);
#else
#define lws_access_log(_a)
#endif
@@ -1371,8 +1581,7 @@ int
lws_protocol_init(struct lws_context *context);
int
-lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p,
- const char *reason);
+lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p);
const struct lws_http_mount *
lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len);
@@ -1396,6 +1605,9 @@ void lws_free(void *p);
#define lws_free_set_NULL(P) do { lws_realloc(P, 0, "free"); (P) = NULL; } while(0)
#endif
+char *
+lws_strdup(const char *s);
+
int
lws_plat_pipe_create(struct lws *wsi);
int
@@ -1405,8 +1617,8 @@ lws_plat_pipe_close(struct lws *wsi);
int
lws_create_event_pipes(struct lws_context *context);
-int
-lws_plat_apply_FD_CLOEXEC(int n);
+int lws_open(const char *__file, int __oflag, ...);
+void lws_plat_apply_FD_CLOEXEC(int n);
const struct lws_plat_file_ops *
lws_vfs_select_fops(const struct lws_plat_file_ops *fops, const char *vfs_path,
@@ -1441,33 +1653,27 @@ LWS_EXTERN int
lws_plat_service(struct lws_context *context, int timeout_ms);
LWS_EXTERN LWS_VISIBLE int
_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
-
-LWS_EXTERN int
-lws_pthread_self_to_tsi(struct lws_context *context);
-
LWS_EXTERN int
lws_plat_init(struct lws_context *context,
const struct lws_context_creation_info *info);
LWS_EXTERN void
lws_plat_drop_app_privileges(const struct lws_context_creation_info *info);
+LWS_EXTERN unsigned long long
+time_in_microseconds(void);
LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt);
LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_plat_inet_pton(int af, const char *src, void *dst);
-LWS_EXTERN int
-lws_check_byte_utf8(unsigned char state, unsigned char c);
LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_check_utf8(unsigned char *state, unsigned char *buf, size_t len);
-LWS_EXTERN int alloc_file(struct lws_context *context, const char *filename,
- uint8_t **buf, lws_filepos_t *amount);
+LWS_EXTERN int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
+ lws_filepos_t *amount);
LWS_EXTERN void
lws_same_vh_protocol_remove(struct lws *wsi);
LWS_EXTERN void
-__lws_same_vh_protocol_remove(struct lws *wsi);
-LWS_EXTERN void
lws_same_vh_protocol_insert(struct lws *wsi, int n);
LWS_EXTERN int
@@ -1497,8 +1703,7 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
void
lws_peer_track_wsi_close(struct lws_context *context, struct lws_peer *peer);
int
-lws_peer_confirm_ah_attach_ok(struct lws_context *context,
- struct lws_peer *peer);
+lws_peer_confirm_ah_attach_ok(struct lws_context *context, struct lws_peer *peer);
void
lws_peer_track_ah_detach(struct lws_context *context, struct lws_peer *peer);
void
@@ -1512,13 +1717,11 @@ void
lws_peer_dump_from_wsi(struct lws *wsi);
#endif
-#ifdef LWS_WITH_HUBBUB
+#ifdef LWS_WITH_HTTP_PROXY
hubbub_error
html_parser_cb(const hubbub_token *token, void *pw);
#endif
-int
-lws_threadpool_tsi_context(struct lws_context *context, int tsi);
void
__lws_remove_from_timeout_list(struct lws *wsi);
@@ -1543,12 +1746,11 @@ lws_buflist_aware_consume(struct lws *wsi, struct lws_tokens *ebuf, int used,
char *
-lws_generate_client_ws_handshake(struct lws *wsi, char *p, const char *conn1);
+lws_generate_client_ws_handshake(struct lws *wsi, char *p);
int
lws_client_ws_upgrade(struct lws *wsi, const char **cce);
int
-lws_create_client_ws_object(const struct lws_client_connect_info *i,
- struct lws *wsi);
+lws_create_client_ws_object(struct lws_client_connect_info *i, struct lws *wsi);
int
lws_alpn_comma_to_openssl(const char *comma, uint8_t *os, int len);
int
@@ -1562,11 +1764,6 @@ void
lws_destroy_event_pipe(struct lws *wsi);
void
lws_context_destroy2(struct lws_context *context);
-int
-lws_role_call_client_bind(struct lws *wsi,
- const struct lws_client_connect_info *i);
-void
-lws_remove_child_from_any_parent(struct lws *wsi);
#ifdef __cplusplus
};
diff --git a/thirdparty/libwebsockets/lib/core/service.c b/thirdparty/libwebsockets/core/service.c
index ef251409cb..6523058814 100644
--- a/thirdparty/libwebsockets/lib/core/service.c
+++ b/thirdparty/libwebsockets/core/service.c
@@ -30,7 +30,7 @@ lws_callback_as_writeable(struct lws *wsi)
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB, 1);
#if defined(LWS_WITH_STATS)
if (wsi->active_writable_req_us) {
- uint64_t ul = lws_time_in_microseconds() -
+ uint64_t ul = time_in_microseconds() -
wsi->active_writable_req_us;
lws_stats_atomic_bump(wsi->context, pt,
@@ -74,13 +74,12 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
* Priority 1: pending truncated sends are incomplete ws fragments
* If anything else sent first the protocol would be
* corrupted.
- *
- * These are post- any compression transform
*/
- if (lws_has_buffered_out(wsi)) {
+ if (wsi->trunc_len) {
//lwsl_notice("%s: completing partial\n", __func__);
- if (lws_issue_raw(wsi, NULL, 0) < 0) {
+ if (lws_issue_raw(wsi, wsi->trunc_alloc + wsi->trunc_offset,
+ wsi->trunc_len) < 0) {
lwsl_info("%s signalling to close\n", __func__);
goto bail_die;
}
@@ -92,28 +91,6 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
goto bail_die; /* retry closing now */
}
- /* Priority 2: pre- compression transform */
-
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more) {
- enum lws_write_protocol wp = LWS_WRITE_HTTP;
-
- lwsl_info("%s: completing comp partial (buflist_comp %p, may %d)\n",
- __func__, wsi->http.comp_ctx.buflist_comp,
- wsi->http.comp_ctx.may_have_more
- );
-
- if (wsi->role_ops->write_role_protocol(wsi, NULL, 0, &wp) < 0) {
- lwsl_info("%s signalling to close\n", __func__);
- goto bail_die;
- }
- lws_callback_on_writable(wsi);
-
- goto bail_ok;
- }
-#endif
-
#ifdef LWS_WITH_CGI
/*
* A cgi master's wire protocol remains h1 or h2. He is just getting
@@ -149,6 +126,13 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
/* one shot */
+ if (wsi->parent_carries_io) {
+ vwsi->handling_pollout = 0;
+ vwsi->leave_pollout_active = 0;
+
+ return lws_callback_as_writeable(wsi);
+ }
+
if (pollfd) {
int eff = vwsi->leave_pollout_active;
@@ -232,9 +216,7 @@ static int
__lws_service_timeout_check(struct lws *wsi, time_t sec)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
int n = 0;
-#endif
(void)n;
@@ -246,11 +228,9 @@ __lws_service_timeout_check(struct lws *wsi, time_t sec)
lws_compare_time_t(wsi->context, sec, wsi->pending_timeout_set) >
wsi->pending_timeout_limit) {
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
if (wsi->desc.sockfd != LWS_SOCK_INVALID &&
wsi->position_in_fds_table >= 0)
n = pt->fds[wsi->position_in_fds_table].events;
-#endif
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_TIMEOUTS, 1);
@@ -338,10 +318,9 @@ lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
{
struct lws_context_per_thread *pt = &context->pt[tsi];
- /*
- * Figure out if we really want to wait in poll()... we only need to
- * wait if really nothing already to do and we have to wait for
- * something from network
+ /* Figure out if we really want to wait in poll()
+ * We only need to wait if really nothing already to do and we have
+ * to wait for something from network
*/
#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
/* 1) if we know we are draining rx ext, do not wait in poll */
@@ -349,31 +328,23 @@ lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
return 0;
#endif
- /* 2) if we know we have non-network pending data,
- * do not wait in poll */
+ /* 2) if we know we have non-network pending data, do not wait in poll */
if (pt->context->tls_ops &&
- pt->context->tls_ops->fake_POLLIN_for_buffered &&
- pt->context->tls_ops->fake_POLLIN_for_buffered(pt))
+ pt->context->tls_ops->fake_POLLIN_for_buffered)
+ if (pt->context->tls_ops->fake_POLLIN_for_buffered(pt))
return 0;
- /*
- * 3) If there is any wsi with rxflow buffered and in a state to process
+ /* 3) If there is any wsi with rxflow buffered and in a state to process
* it, we should not wait in poll
*/
- lws_start_foreach_dll(struct lws_dll_lws *, d,
- pt->dll_head_buflist.next) {
+ lws_start_foreach_dll(struct lws_dll_lws *, d, pt->dll_head_buflist.next) {
struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
if (lwsi_state(wsi) != LRS_DEFERRING_ACTION)
return 0;
- /*
- * 4) If any guys with http compression to spill, we shouldn't wait in
- * poll but hurry along and service them
- */
-
} lws_end_foreach_dll(d);
return timeout_ms;
@@ -460,10 +431,8 @@ lws_buflist_aware_consume(struct lws *wsi, struct lws_tokens *ebuf, int used,
if (m < 0)
return 1; /* OOM */
if (m) {
- lwsl_debug("%s: added %p to rxflow list\n",
- __func__, wsi);
- lws_dll_lws_add_front(&wsi->dll_buflist,
- &pt->dll_head_buflist);
+ lwsl_debug("%s: added %p to rxflow list\n", __func__, wsi);
+ lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
}
}
@@ -518,6 +487,10 @@ int
lws_service_flag_pending(struct lws_context *context, int tsi)
{
struct lws_context_per_thread *pt = &context->pt[tsi];
+
+#if defined(LWS_WITH_TLS)
+ struct lws *wsi, *wsi_next;
+#endif
int forced = 0;
lws_pt_lock(pt, __func__);
@@ -547,11 +520,9 @@ lws_service_flag_pending(struct lws_context *context, int tsi)
* service to use up the buffered incoming data, even though their
* network socket may have nothing
*/
- lws_start_foreach_dll_safe(struct lws_dll_lws *, p, p1,
- pt->tls.pending_tls_head.next) {
- struct lws *wsi = lws_container_of(p, struct lws,
- tls.pending_tls_list);
-
+ wsi = pt->tls.pending_read_list;
+ while (wsi) {
+ wsi_next = wsi->tls.pending_read_list_next;
pt->fds[wsi->position_in_fds_table].revents |=
pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN) {
@@ -565,7 +536,8 @@ lws_service_flag_pending(struct lws_context *context, int tsi)
__lws_ssl_remove_wsi_from_buffered_list(wsi);
}
- } lws_end_foreach_dll_safe(p, p1);
+ wsi = wsi_next;
+ }
#endif
lws_pt_unlock(pt);
@@ -578,21 +550,18 @@ lws_service_periodic_checks(struct lws_context *context,
struct lws_pollfd *pollfd, int tsi)
{
struct lws_context_per_thread *pt = &context->pt[tsi];
- struct lws_timed_vh_protocol *tmr;
lws_sockfd_type our_fd = 0, tmp_fd;
struct lws *wsi;
int timed_out = 0;
time_t now;
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
struct allocated_headers *ah;
- int n, m;
+ int m;
#endif
if (!context->protocol_init_done)
- if (lws_protocol_init(context)) {
- lwsl_err("%s: lws_protocol_init failed\n", __func__);
+ if (lws_protocol_init(context))
return -1;
- }
time(&now);
@@ -640,7 +609,7 @@ lws_service_periodic_checks(struct lws_context *context,
#endif
lws_plat_service_periodic(context);
- lws_check_deferred_free(context, tsi, 0);
+ lws_check_deferred_free(context, 0);
#if defined(LWS_WITH_PEER_LIMITS)
lws_peer_cull_peer_wait_list(context);
@@ -662,7 +631,7 @@ lws_service_periodic_checks(struct lws_context *context,
our_fd = pollfd->fd;
/*
- * Phase 1: check every wsi on our pt's timeout check list
+ * Phase 1: check every wsi on the timeout check list
*/
lws_pt_lock(pt, __func__);
@@ -732,7 +701,8 @@ lws_service_periodic_checks(struct lws_context *context,
continue;
}
- if (lws_hdr_copy(wsi, buf, sizeof buf, m) > 0) {
+ if (lws_hdr_copy(wsi, buf,
+ sizeof buf, m) > 0) {
buf[sizeof(buf) - 1] = '\0';
lwsl_notice(" %s = %s\n",
@@ -779,126 +749,37 @@ lws_service_periodic_checks(struct lws_context *context,
* Phase 3: vhost / protocol timer callbacks
*/
- /* 3a: lock, collect, and remove vh timers that are pending */
-
- lws_context_lock(context, "expired vh timers"); /* context ---------- */
-
- n = 0;
-
- /*
- * first, under the context lock, get a count of the number of
- * expired timers so we can allocate for them (or not, cleanly)
- */
-
- lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
-
- if (v->timed_vh_protocol_list) {
-
- lws_start_foreach_ll_safe(struct lws_timed_vh_protocol *,
- q, v->timed_vh_protocol_list, next) {
- if (now >= q->time && q->tsi_req == tsi)
- n++;
- } lws_end_foreach_ll_safe(q);
- }
-
- } lws_end_foreach_ll(v, vhost_next);
-
- /* if nothing to do, unlock and move on to the next vhost */
-
- if (!n) {
- lws_context_unlock(context); /* ----------- context */
- goto vh_timers_done;
- }
-
- /*
- * attempt to do the wsi and timer info allocation
- * first en bloc. If it fails, we can just skip the rest and
- * the timers will still be pending next time.
- */
-
- wsi = lws_zalloc(sizeof(*wsi), "cbwsi");
- if (!wsi) {
- /*
- * at this point, we haven't cleared any vhost
- * timers. We can fail out and retry cleanly
- * next periodic check
- */
- lws_context_unlock(context); /* ----------- context */
- goto vh_timers_done;
- }
- wsi->context = context;
-
- tmr = lws_zalloc(sizeof(*tmr) * n, "cbtmr");
- if (!tmr) {
- /* again OOM here can be handled cleanly */
- lws_free(wsi);
- lws_context_unlock(context); /* ----------- context */
- goto vh_timers_done;
- }
-
- /* so we have the allocation for n pending timers... */
-
- m = 0;
+ wsi = NULL;
lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
-
+ struct lws_timed_vh_protocol *nx;
if (v->timed_vh_protocol_list) {
-
- lws_vhost_lock(v); /* vhost ------------------------- */
-
- lws_start_foreach_ll_safe(struct lws_timed_vh_protocol *,
- q, v->timed_vh_protocol_list, next) {
-
- /* only do n */
- if (m == n)
- break;
-
- if (now >= q->time && q->tsi_req == tsi) {
-
- /*
- * tmr is an allocated array.
- * Ignore the linked-list.
- */
- tmr[m].vhost = v;
- tmr[m].protocol = q->protocol;
- tmr[m++].reason = q->reason;
-
- /* take the timer out now we took
- * responsibility */
- __lws_timed_callback_remove(v, q);
+ lws_start_foreach_ll(struct lws_timed_vh_protocol *,
+ q, v->timed_vh_protocol_list) {
+ if (now >= q->time) {
+ if (!wsi)
+ wsi = lws_zalloc(sizeof(*wsi), "cbwsi");
+ wsi->context = context;
+ wsi->vhost = v;
+ wsi->protocol = q->protocol;
+ lwsl_debug("timed cb: vh %s, protocol %s, reason %d\n", v->name, q->protocol->name, q->reason);
+ q->protocol->callback(wsi, q->reason, NULL, NULL, 0);
+ nx = q->next;
+ lws_timed_callback_remove(v, q);
+ q = nx;
+ continue; /* we pointed ourselves to the next from the now-deleted guy */
}
-
- } lws_end_foreach_ll_safe(q);
-
- lws_vhost_unlock(v); /* ----------------------- vhost */
+ } lws_end_foreach_ll(q, next);
}
-
} lws_end_foreach_ll(v, vhost_next);
- lws_context_unlock(context); /* ---------------------------- context */
-
- /* 3b: call the vh timer callbacks outside any lock */
-
- for (m = 0; m < n; m++) {
-
- wsi->vhost = tmr[m].vhost; /* not a real bound wsi */
- wsi->protocol = tmr[m].protocol;
-
- lwsl_debug("%s: timed cb: vh %s, protocol %s, reason %d\n",
- __func__, tmr[m].vhost->name, tmr[m].protocol->name,
- tmr[m].reason);
- tmr[m].protocol->callback(wsi, tmr[m].reason, NULL, NULL, 0);
- }
-
- lws_free(tmr);
- lws_free(wsi);
-
-vh_timers_done:
+ if (wsi)
+ lws_free(wsi);
/*
* Phase 4: check for unconfigured vhosts due to required
* interface missing before
*/
- lws_context_lock(context, "periodic checks");
+ lws_context_lock(context);
lws_start_foreach_llp(struct lws_vhost **, pv,
context->no_listener_vhost_list) {
struct lws_vhost *v = *pv;
@@ -931,7 +812,7 @@ vh_timers_done:
context->tls_ops->periodic_housekeeping)
context->tls_ops->periodic_housekeeping(context, now);
- return 0;
+ return timed_out;
}
LWS_VISIBLE int
@@ -944,11 +825,9 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
if (!context || context->being_destroyed1)
return -1;
- /* the case there's no pollfd to service, we just want to do periodic */
- if (!pollfd) {
- lws_service_periodic_checks(context, pollfd, tsi);
- return -2;
- }
+ /* the socket we came to service timed out, nothing to do */
+ if (lws_service_periodic_checks(context, pollfd, tsi) || !pollfd)
+ return 0;
/* no, here to service a socket descriptor */
wsi = wsi_from_fd(context, pollfd->fd);
@@ -1044,9 +923,6 @@ handled:
#endif
pollfd->revents = 0;
- /* check the timeout situation if we didn't in the last second */
- lws_service_periodic_checks(context, pollfd, tsi);
-
lws_pt_lock(pt, __func__);
__lws_hrtimer_service(pt);
lws_pt_unlock(pt);
@@ -1093,9 +969,6 @@ lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
int n;
pt->inside_service = 1;
-#if LWS_MAX_SMP > 1
- pt->self = pthread_self();
-#endif
if (context->event_loop_ops->run_pt) {
/* we are configured for an event loop */
diff --git a/thirdparty/libwebsockets/lib/event-libs/poll/poll.c b/thirdparty/libwebsockets/event-libs/poll/poll.c
index 09af5b15d8..09af5b15d8 100644
--- a/thirdparty/libwebsockets/lib/event-libs/poll/poll.c
+++ b/thirdparty/libwebsockets/event-libs/poll/poll.c
diff --git a/thirdparty/libwebsockets/lib/event-libs/poll/private.h b/thirdparty/libwebsockets/event-libs/poll/private.h
index ca313ebfb0..ca313ebfb0 100644
--- a/thirdparty/libwebsockets/lib/event-libs/poll/private.h
+++ b/thirdparty/libwebsockets/event-libs/poll/private.h
diff --git a/thirdparty/libwebsockets/lib/event-libs/private.h b/thirdparty/libwebsockets/event-libs/private.h
index 58bca946b5..c36d39c8c2 100644
--- a/thirdparty/libwebsockets/lib/event-libs/private.h
+++ b/thirdparty/libwebsockets/event-libs/private.h
@@ -41,7 +41,7 @@ struct lws_event_loop_ops {
/* close handle manually */
void (*close_handle_manually)(struct lws *wsi);
/* event loop accept processing */
- int (*accept)(struct lws *wsi);
+ void (*accept)(struct lws *wsi);
/* control wsi active events */
void (*io)(struct lws *wsi, int flags);
/* run the event loop for a pt */
diff --git a/thirdparty/libwebsockets/include/libwebsockets.h b/thirdparty/libwebsockets/include/libwebsockets.h
deleted file mode 100644
index 7cc5c28b78..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets.h
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-/** @file */
-
-#ifndef LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
-#define LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
-
-#ifdef __cplusplus
-#include <cstddef>
-#include <cstdarg>
-
-extern "C" {
-#else
-#include <stdarg.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "lws_config.h"
-
-/*
- * CARE: everything using cmake defines needs to be below here
- */
-
-#if defined(LWS_HAS_INTPTR_T)
-#include <stdint.h>
-#define lws_intptr_t intptr_t
-#else
-typedef unsigned long long lws_intptr_t;
-#endif
-
-#if defined(WIN32) || defined(_WIN32)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <stddef.h>
-#include <basetsd.h>
-#include <io.h>
-#ifndef _WIN32_WCE
-#include <fcntl.h>
-#else
-#define _O_RDONLY 0x0000
-#define O_RDONLY _O_RDONLY
-#endif
-
-#define LWS_INLINE __inline
-#define LWS_VISIBLE
-#define LWS_WARN_UNUSED_RESULT
-#define LWS_WARN_DEPRECATED
-#define LWS_FORMAT(string_index)
-
-#if !defined(LWS_EXTERN)
-#ifdef LWS_DLL
-#ifdef LWS_INTERNAL
-#define LWS_EXTERN extern __declspec(dllexport)
-#else
-#define LWS_EXTERN extern __declspec(dllimport)
-#endif
-#else
-#define LWS_EXTERN
-#endif
-#endif
-
-#define LWS_INVALID_FILE INVALID_HANDLE_VALUE
-#define LWS_O_RDONLY _O_RDONLY
-#define LWS_O_WRONLY _O_WRONLY
-#define LWS_O_CREAT _O_CREAT
-#define LWS_O_TRUNC _O_TRUNC
-
-#ifndef __func__
-#define __func__ __FUNCTION__
-#endif
-
-#else /* NOT WIN32 */
-#include <unistd.h>
-#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
-#include <sys/capability.h>
-#endif
-
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__QNX__) || defined(__OpenBSD__)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#endif
-
-#define LWS_INLINE inline
-#define LWS_O_RDONLY O_RDONLY
-#define LWS_O_WRONLY O_WRONLY
-#define LWS_O_CREAT O_CREAT
-#define LWS_O_TRUNC O_TRUNC
-
-#if !defined(LWS_PLAT_OPTEE) && !defined(OPTEE_TA) && !defined(LWS_WITH_ESP32)
-#include <poll.h>
-#include <netdb.h>
-#define LWS_INVALID_FILE -1
-#else
-#define getdtablesize() (30)
-#if defined(LWS_WITH_ESP32)
-#define LWS_INVALID_FILE NULL
-#else
-#define LWS_INVALID_FILE NULL
-#endif
-#endif
-
-#if defined(__GNUC__)
-
-/* warn_unused_result attribute only supported by GCC 3.4 or later */
-#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#define LWS_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#else
-#define LWS_WARN_UNUSED_RESULT
-#endif
-
-#define LWS_VISIBLE __attribute__((visibility("default")))
-#define LWS_WARN_DEPRECATED __attribute__ ((deprecated))
-#define LWS_FORMAT(string_index) __attribute__ ((format(printf, string_index, string_index+1)))
-#else
-#define LWS_VISIBLE
-#define LWS_WARN_UNUSED_RESULT
-#define LWS_WARN_DEPRECATED
-#define LWS_FORMAT(string_index)
-#endif
-
-#if defined(__ANDROID__)
-#include <netinet/in.h>
-#include <unistd.h>
-#define getdtablesize() sysconf(_SC_OPEN_MAX)
-#endif
-
-#endif
-
-#if defined(LWS_WITH_LIBEV)
-#include <ev.h>
-#endif /* LWS_WITH_LIBEV */
-#ifdef LWS_WITH_LIBUV
-#include <uv.h>
-#ifdef LWS_HAVE_UV_VERSION_H
-#include <uv-version.h>
-#endif
-#ifdef LWS_HAVE_NEW_UV_VERSION_H
-#include <uv/version.h>
-#endif
-#endif /* LWS_WITH_LIBUV */
-#if defined(LWS_WITH_LIBEVENT)
-#include <event2/event.h>
-#endif /* LWS_WITH_LIBEVENT */
-
-#ifndef LWS_EXTERN
-#define LWS_EXTERN extern
-#endif
-
-#ifdef _WIN32
-#define random rand
-#else
-#if !defined(OPTEE_TA)
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-#endif
-
-#if defined(LWS_WITH_TLS)
-
-#ifdef USE_WOLFSSL
-#ifdef USE_OLD_CYASSL
-#ifdef _WIN32
-/*
- * Include user-controlled settings for windows from
- * <wolfssl-root>/IDE/WIN/user_settings.h
- */
-#include <IDE/WIN/user_settings.h>
-#include <cyassl/ctaocrypt/settings.h>
-#else
-#include <cyassl/options.h>
-#endif
-#include <cyassl/openssl/ssl.h>
-#include <cyassl/error-ssl.h>
-
-#else
-#ifdef _WIN32
-/*
- * Include user-controlled settings for windows from
- * <wolfssl-root>/IDE/WIN/user_settings.h
- */
-#include <IDE/WIN/user_settings.h>
-#include <wolfssl/wolfcrypt/settings.h>
-#else
-#include <wolfssl/options.h>
-#endif
-#include <wolfssl/openssl/ssl.h>
-#include <wolfssl/error-ssl.h>
-#endif /* not USE_OLD_CYASSL */
-#else
-#if defined(LWS_WITH_MBEDTLS)
-#if defined(LWS_WITH_ESP32)
-/* this filepath is passed to us but without quotes or <> */
-#undef MBEDTLS_CONFIG_FILE
-#define MBEDTLS_CONFIG_FILE <mbedtls/esp_config.h>
-#endif
-#include <mbedtls/ssl.h>
-#else
-#include <openssl/ssl.h>
-#if !defined(LWS_WITH_MBEDTLS)
-#include <openssl/err.h>
-#endif
-#endif
-#endif /* not USE_WOLFSSL */
-#endif
-
-/*
- * Helpers for pthread mutex in user code... if lws is built for
- * multiple service threads, these resolve to pthread mutex
- * operations. In the case LWS_MAX_SMP is 1 (the default), they
- * are all NOPs and no pthread type or api is referenced.
- */
-
-#if LWS_MAX_SMP > 1
-
-#include <pthread.h>
-
-#define lws_pthread_mutex(name) pthread_mutex_t name;
-
-static LWS_INLINE void
-lws_pthread_mutex_init(pthread_mutex_t *lock)
-{
- pthread_mutex_init(lock, NULL);
-}
-
-static LWS_INLINE void
-lws_pthread_mutex_destroy(pthread_mutex_t *lock)
-{
- pthread_mutex_destroy(lock);
-}
-
-static LWS_INLINE void
-lws_pthread_mutex_lock(pthread_mutex_t *lock)
-{
- pthread_mutex_lock(lock);
-}
-
-static LWS_INLINE void
-lws_pthread_mutex_unlock(pthread_mutex_t *lock)
-{
- pthread_mutex_unlock(lock);
-}
-
-#else
-#define lws_pthread_mutex(name)
-#define lws_pthread_mutex_init(_a)
-#define lws_pthread_mutex_destroy(_a)
-#define lws_pthread_mutex_lock(_a)
-#define lws_pthread_mutex_unlock(_a)
-#endif
-
-
-#define CONTEXT_PORT_NO_LISTEN -1
-#define CONTEXT_PORT_NO_LISTEN_SERVER -2
-
-#include <libwebsockets/lws-logs.h>
-
-
-#include <stddef.h>
-
-#ifndef lws_container_of
-#define lws_container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
-#endif
-
-struct lws;
-
-typedef int64_t lws_usec_t;
-
-/* api change list for user code to test against */
-
-#define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
-
-/* the struct lws_protocols has the id field present */
-#define LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD
-
-/* you can call lws_get_peer_write_allowance */
-#define LWS_FEATURE_PROTOCOLS_HAS_PEER_WRITE_ALLOWANCE
-
-/* extra parameter introduced in 917f43ab821 */
-#define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_LEN
-
-/* File operations stuff exists */
-#define LWS_FEATURE_FOPS
-
-
-#if defined(_WIN32)
-#if !defined(LWS_WIN32_HANDLE_TYPES)
-typedef SOCKET lws_sockfd_type;
-typedef HANDLE lws_filefd_type;
-#endif
-
-struct lws_pollfd {
- lws_sockfd_type fd; /**< file descriptor */
- SHORT events; /**< which events to respond to */
- SHORT revents; /**< which events happened */
-};
-#define LWS_POLLHUP (FD_CLOSE)
-#define LWS_POLLIN (FD_READ | FD_ACCEPT)
-#define LWS_POLLOUT (FD_WRITE)
-#else
-
-
-#if defined(LWS_WITH_ESP32)
-#include <libwebsockets/lws-esp32.h>
-#else
-typedef int lws_sockfd_type;
-typedef int lws_filefd_type;
-#endif
-
-#define lws_pollfd pollfd
-#define LWS_POLLHUP (POLLHUP|POLLERR)
-#define LWS_POLLIN (POLLIN)
-#define LWS_POLLOUT (POLLOUT)
-#endif
-
-
-#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
-/* ... */
-#define ssize_t SSIZE_T
-#endif
-
-#if defined(WIN32) && defined(LWS_HAVE__STAT32I64)
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif
-
-#if defined(LWS_HAVE_STDINT_H)
-#include <stdint.h>
-#else
-#if defined(WIN32) || defined(_WIN32)
-/* !!! >:-[ */
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int8 uint8_t;
-#else
-typedef unsigned int uint32_t;
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;
-#endif
-#endif
-
-typedef unsigned long long lws_filepos_t;
-typedef long long lws_fileofs_t;
-typedef uint32_t lws_fop_flags_t;
-
-/** struct lws_pollargs - argument structure for all external poll related calls
- * passed in via 'in' */
-struct lws_pollargs {
- lws_sockfd_type fd; /**< applicable socket descriptor */
- int events; /**< the new event mask */
- int prev_events; /**< the previous event mask */
-};
-
-struct lws_extension; /* needed even with ws exts disabled for create context */
-struct lws_token_limits;
-struct lws_context;
-struct lws_tokens;
-struct lws_vhost;
-struct lws;
-
-#include <libwebsockets/lws-ws-close.h>
-#include <libwebsockets/lws-callbacks.h>
-#include <libwebsockets/lws-ws-state.h>
-#include <libwebsockets/lws-ws-ext.h>
-#include <libwebsockets/lws-protocols-plugins.h>
-#include <libwebsockets/lws-plugin-generic-sessions.h>
-#include <libwebsockets/lws-context-vhost.h>
-#include <libwebsockets/lws-client.h>
-#include <libwebsockets/lws-http.h>
-#include <libwebsockets/lws-spa.h>
-#include <libwebsockets/lws-purify.h>
-#include <libwebsockets/lws-timeout-timer.h>
-#include <libwebsockets/lws-service.h>
-#include <libwebsockets/lws-write.h>
-#include <libwebsockets/lws-writeable.h>
-#include <libwebsockets/lws-adopt.h>
-#include <libwebsockets/lws-network-helper.h>
-#include <libwebsockets/lws-misc.h>
-#include <libwebsockets/lws-ring.h>
-#include <libwebsockets/lws-sha1-base64.h>
-#include <libwebsockets/lws-x509.h>
-#include <libwebsockets/lws-cgi.h>
-#include <libwebsockets/lws-vfs.h>
-#include <libwebsockets/lws-lejp.h>
-#include <libwebsockets/lws-stats.h>
-#include <libwebsockets/lws-threadpool.h>
-#include <libwebsockets/lws-tokenize.h>
-#include <libwebsockets/lws-lwsac.h>
-#include <libwebsockets/lws-fts.h>
-#include <libwebsockets/lws-diskcache.h>
-
-#if defined(LWS_WITH_TLS)
-
-#if defined(LWS_WITH_MBEDTLS)
-#include <mbedtls/sha1.h>
-#include <mbedtls/sha256.h>
-#include <mbedtls/sha512.h>
-#endif
-
-#include <libwebsockets/lws-genhash.h>
-#include <libwebsockets/lws-genrsa.h>
-#include <libwebsockets/lws-jwk.h>
-#include <libwebsockets/lws-jws.h>
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-adopt.h b/thirdparty/libwebsockets/include/libwebsockets/lws-adopt.h
deleted file mode 100644
index 256e3f9fdf..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-adopt.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup sock-adopt Socket adoption helpers
- * ##Socket adoption helpers
- *
- * When integrating with an external app with its own event loop, these can
- * be used to accept connections from someone else's listening socket.
- *
- * When using lws own event loop, these are not needed.
- */
-///@{
-
-/**
- * lws_adopt_socket() - adopt foreign socket as if listen socket accepted it
- * for the default vhost of context.
- *
- * \param context: lws context
- * \param accept_fd: fd of already-accepted socket to adopt
- *
- * Either returns new wsi bound to accept_fd, or closes accept_fd and
- * returns NULL, having cleaned up any new wsi pieces.
- *
- * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
- * to ws or just serve http.
- */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd);
-/**
- * lws_adopt_socket_vhost() - adopt foreign socket as if listen socket accepted
- * it for vhost
- *
- * \param vh: lws vhost
- * \param accept_fd: fd of already-accepted socket to adopt
- *
- * Either returns new wsi bound to accept_fd, or closes accept_fd and
- * returns NULL, having cleaned up any new wsi pieces.
- *
- * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
- * to ws or just serve http.
- */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd);
-
-typedef enum {
- LWS_ADOPT_RAW_FILE_DESC = 0, /* convenience constant */
- LWS_ADOPT_HTTP = 1, /* flag: absent implies RAW */
- LWS_ADOPT_SOCKET = 2, /* flag: absent implies file descr */
- LWS_ADOPT_ALLOW_SSL = 4, /* flag: if set requires LWS_ADOPT_SOCKET */
- LWS_ADOPT_FLAG_UDP = 16, /* flag: socket is UDP */
-
- LWS_ADOPT_RAW_SOCKET_UDP = LWS_ADOPT_SOCKET | LWS_ADOPT_FLAG_UDP,
-} lws_adoption_type;
-
-typedef union {
- lws_sockfd_type sockfd;
- lws_filefd_type filefd;
-} lws_sock_file_fd_type;
-
-#if !defined(LWS_WITH_ESP32)
-struct lws_udp {
- struct sockaddr sa;
- socklen_t salen;
-
- struct sockaddr sa_pending;
- socklen_t salen_pending;
-};
-#endif
-
-/*
-* lws_adopt_descriptor_vhost() - adopt foreign socket or file descriptor
-* if socket descriptor, should already have been accepted from listen socket
-*
-* \param vhost: lws vhost
-* \param type: OR-ed combinations of lws_adoption_type flags
-* \param fd: union with either .sockfd or .filefd set
-* \param vh_prot_name: NULL or vh protocol name to bind raw connection to
-* \param parent: NULL or struct lws to attach new_wsi to as a child
-*
-* Either returns new wsi bound to accept_fd, or closes accept_fd and
-* returns NULL, having cleaned up any new wsi pieces.
-*
-* If LWS_ADOPT_SOCKET is set, LWS adopts the socket in http serving mode, it's
-* ready to accept an upgrade to ws or just serve http.
-*
-* parent may be NULL, if given it should be an existing wsi that will become the
-* parent of the new wsi created by this call.
-*/
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
- lws_sock_file_fd_type fd, const char *vh_prot_name,
- struct lws *parent);
-
-/**
- * lws_adopt_socket_readbuf() - adopt foreign socket and first rx as if listen socket accepted it
- * for the default vhost of context.
- * \param context: lws context
- * \param accept_fd: fd of already-accepted socket to adopt
- * \param readbuf: NULL or pointer to data that must be drained before reading from
- * accept_fd
- * \param len: The length of the data held at \param readbuf
- *
- * Either returns new wsi bound to accept_fd, or closes accept_fd and
- * returns NULL, having cleaned up any new wsi pieces.
- *
- * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
- * to ws or just serve http.
- *
- * If your external code did not already read from the socket, you can use
- * lws_adopt_socket() instead.
- *
- * This api is guaranteed to use the data at \param readbuf first, before reading from
- * the socket.
- *
- * readbuf is limited to the size of the ah rx buf, currently 2048 bytes.
- */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
- const char *readbuf, size_t len);
-/**
- * lws_adopt_socket_vhost_readbuf() - adopt foreign socket and first rx as if listen socket
- * accepted it for vhost.
- * \param vhost: lws vhost
- * \param accept_fd: fd of already-accepted socket to adopt
- * \param readbuf: NULL or pointer to data that must be drained before
- * reading from accept_fd
- * \param len: The length of the data held at \param readbuf
- *
- * Either returns new wsi bound to accept_fd, or closes accept_fd and
- * returns NULL, having cleaned up any new wsi pieces.
- *
- * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
- * to ws or just serve http.
- *
- * If your external code did not already read from the socket, you can use
- * lws_adopt_socket() instead.
- *
- * This api is guaranteed to use the data at \param readbuf first, before reading from
- * the socket.
- *
- * readbuf is limited to the size of the ah rx buf, currently 2048 bytes.
- */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost,
- lws_sockfd_type accept_fd, const char *readbuf,
- size_t len);
-
-#define LWS_CAUDP_BIND 1
-
-/**
- * lws_create_adopt_udp() - create, bind and adopt a UDP socket
- *
- * \param vhost: lws vhost
- * \param port: UDP port to bind to, -1 means unbound
- * \param flags: 0 or LWS_CAUDP_NO_BIND
- * \param protocol_name: Name of protocol on vhost to bind wsi to
- * \param parent_wsi: NULL or parent wsi new wsi will be a child of
- *
- * Either returns new wsi bound to accept_fd, or closes accept_fd and
- * returns NULL, having cleaned up any new wsi pieces.
- * */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_create_adopt_udp(struct lws_vhost *vhost, int port, int flags,
- const char *protocol_name, struct lws *parent_wsi);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-callbacks.h b/thirdparty/libwebsockets/include/libwebsockets/lws-callbacks.h
deleted file mode 100644
index 8b49218e9c..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-callbacks.h
+++ /dev/null
@@ -1,807 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup usercb User Callback
- *
- * ##User protocol callback
- *
- * The protocol callback is the primary way lws interacts with
- * user code. For one of a list of a few dozen reasons the callback gets
- * called at some event to be handled.
- *
- * All of the events can be ignored, returning 0 is taken as "OK" and returning
- * nonzero in most cases indicates that the connection should be closed.
- */
-///@{
-
-struct lws_ssl_info {
- int where;
- int ret;
-};
-
-enum lws_cert_update_state {
- LWS_CUS_IDLE,
- LWS_CUS_STARTING,
- LWS_CUS_SUCCESS,
- LWS_CUS_FAILED,
-
- LWS_CUS_CREATE_KEYS,
- LWS_CUS_REG,
- LWS_CUS_AUTH,
- LWS_CUS_CHALLENGE,
- LWS_CUS_CREATE_REQ,
- LWS_CUS_REQ,
- LWS_CUS_CONFIRM,
- LWS_CUS_ISSUE,
-};
-
-enum {
- LWS_TLS_REQ_ELEMENT_COUNTRY,
- LWS_TLS_REQ_ELEMENT_STATE,
- LWS_TLS_REQ_ELEMENT_LOCALITY,
- LWS_TLS_REQ_ELEMENT_ORGANIZATION,
- LWS_TLS_REQ_ELEMENT_COMMON_NAME,
- LWS_TLS_REQ_ELEMENT_EMAIL,
-
- LWS_TLS_REQ_ELEMENT_COUNT,
-
- LWS_TLS_SET_DIR_URL = LWS_TLS_REQ_ELEMENT_COUNT,
- LWS_TLS_SET_AUTH_PATH,
- LWS_TLS_SET_CERT_PATH,
- LWS_TLS_SET_KEY_PATH,
-
- LWS_TLS_TOTAL_COUNT
-};
-
-struct lws_acme_cert_aging_args {
- struct lws_vhost *vh;
- const char *element_overrides[LWS_TLS_TOTAL_COUNT]; /* NULL = use pvo */
-};
-
-/*
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-/** enum lws_callback_reasons - reason you're getting a protocol callback */
-enum lws_callback_reasons {
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to wsi and protocol binding lifecycle -----
- */
-
- LWS_CALLBACK_PROTOCOL_INIT = 27,
- /**< One-time call per protocol, per-vhost using it, so it can
- * do initial setup / allocations etc */
-
- LWS_CALLBACK_PROTOCOL_DESTROY = 28,
- /**< One-time call per protocol, per-vhost using it, indicating
- * this protocol won't get used at all after this callback, the
- * vhost is getting destroyed. Take the opportunity to
- * deallocate everything that was allocated by the protocol. */
-
- LWS_CALLBACK_WSI_CREATE = 29,
- /**< outermost (earliest) wsi create notification to protocols[0] */
-
- LWS_CALLBACK_WSI_DESTROY = 30,
- /**< outermost (latest) wsi destroy notification to protocols[0] */
-
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to Server TLS -----
- */
-
- LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS = 21,
- /**< if configured for
- * including OpenSSL support, this callback allows your user code
- * to perform extra SSL_CTX_load_verify_locations() or similar
- * calls to direct OpenSSL where to find certificates the client
- * can use to confirm the remote server identity. user is the
- * OpenSSL SSL_CTX* */
-
- LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS = 22,
- /**< if configured for
- * including OpenSSL support, this callback allows your user code
- * to load extra certificates into the server which allow it to
- * verify the validity of certificates returned by clients. user
- * is the server's OpenSSL SSL_CTX* and in is the lws_vhost */
-
- LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION = 23,
- /**< if the libwebsockets vhost was created with the option
- * LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT, then this
- * callback is generated during OpenSSL verification of the cert
- * sent from the client. It is sent to protocol[0] callback as
- * no protocol has been negotiated on the connection yet.
- * Notice that the libwebsockets context and wsi are both NULL
- * during this callback. See
- * http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
- * to understand more detail about the OpenSSL callback that
- * generates this libwebsockets callback and the meanings of the
- * arguments passed. In this callback, user is the x509_ctx,
- * in is the ssl pointer and len is preverify_ok
- * Notice that this callback maintains libwebsocket return
- * conventions, return 0 to mean the cert is OK or 1 to fail it.
- * This also means that if you don't handle this callback then
- * the default callback action of returning 0 allows the client
- * certificates. */
-
- LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY = 37,
- /**< if configured for including OpenSSL support but no private key
- * file has been specified (ssl_private_key_filepath is NULL), this is
- * called to allow the user to set the private key directly via
- * libopenssl and perform further operations if required; this might be
- * useful in situations where the private key is not directly accessible
- * by the OS, for example if it is stored on a smartcard.
- * user is the server's OpenSSL SSL_CTX* */
-
- LWS_CALLBACK_SSL_INFO = 67,
- /**< SSL connections only. An event you registered an
- * interest in at the vhost has occurred on a connection
- * using the vhost. in is a pointer to a
- * struct lws_ssl_info containing information about the
- * event*/
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to Client TLS -----
- */
-
- LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION = 58,
- /**< Similar to LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION
- * this callback is called during OpenSSL verification of the cert
- * sent from the server to the client. It is sent to protocol[0]
- * callback as no protocol has been negotiated on the connection yet.
- * Notice that the wsi is set because lws_client_connect_via_info was
- * successful.
- *
- * See http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
- * to understand more detail about the OpenSSL callback that
- * generates this libwebsockets callback and the meanings of the
- * arguments passed. In this callback, user is the x509_ctx,
- * in is the ssl pointer and len is preverify_ok.
- *
- * THIS IS NOT RECOMMENDED BUT if a cert validation error shall be
- * overruled and cert shall be accepted as ok,
- * X509_STORE_CTX_set_error((X509_STORE_CTX*)user, X509_V_OK); must be
- * called and return value must be 0 to mean the cert is OK;
- * returning 1 will fail the cert in any case.
- *
- * This also means that if you don't handle this callback then
- * the default callback action of returning 0 will not accept the
- * certificate in case of a validation error decided by the SSL lib.
- *
- * This is expected and secure behaviour when validating certificates.
- *
- * Note: LCCSCF_ALLOW_SELFSIGNED and
- * LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK still work without this
- * callback being implemented.
- */
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to HTTP Server -----
- */
-
- LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED = 19,
- /**< A new client has been accepted by the ws server. This
- * callback allows setting any relevant property to it. Because this
- * happens immediately after the instantiation of a new client,
- * there's no websocket protocol selected yet so this callback is
- * issued only to protocol 0. Only wsi is defined, pointing to the
- * new client, and the return value is ignored. */
-
- LWS_CALLBACK_HTTP = 12,
- /**< an http request has come from a client that is not
- * asking to upgrade the connection to a websocket
- * one. This is a chance to serve http content,
- * for example, to send a script to the client
- * which will then open the websockets connection.
- * in points to the URI path requested and
- * lws_serve_http_file() makes it very
- * simple to send back a file to the client.
- * Normally after sending the file you are done
- * with the http connection, since the rest of the
- * activity will come by websockets from the script
- * that was delivered by http, so you will want to
- * return 1; to close and free up the connection. */
-
- LWS_CALLBACK_HTTP_BODY = 13,
- /**< the next len bytes data from the http
- * request body HTTP connection is now available in in. */
-
- LWS_CALLBACK_HTTP_BODY_COMPLETION = 14,
- /**< the expected amount of http request body has been delivered */
-
- LWS_CALLBACK_HTTP_FILE_COMPLETION = 15,
- /**< a file requested to be sent down http link has completed. */
-
- LWS_CALLBACK_HTTP_WRITEABLE = 16,
- /**< you can write more down the http protocol link now. */
-
- LWS_CALLBACK_CLOSED_HTTP = 5,
- /**< when a HTTP (non-websocket) session ends */
-
- LWS_CALLBACK_FILTER_HTTP_CONNECTION = 18,
- /**< called when the request has
- * been received and parsed from the client, but the response is
- * not sent yet. Return non-zero to disallow the connection.
- * user is a pointer to the connection user space allocation,
- * in is the URI, eg, "/"
- * In your handler you can use the public APIs
- * lws_hdr_total_length() / lws_hdr_copy() to access all of the
- * headers using the header enums lws_token_indexes from
- * libwebsockets.h to check for and read the supported header
- * presence and content before deciding to allow the http
- * connection to proceed or to kill the connection. */
-
- LWS_CALLBACK_ADD_HEADERS = 53,
- /**< This gives your user code a chance to add headers to a server
- * transaction bound to your protocol. `in` points to a
- * `struct lws_process_html_args` describing a buffer and length
- * you can add headers into using the normal lws apis.
- *
- * (see LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to add headers to
- * a client transaction)
- *
- * Only `args->p` and `args->len` are valid, and `args->p` should
- * be moved on by the amount of bytes written, if any. Eg
- *
- * case LWS_CALLBACK_ADD_HEADERS:
- *
- * struct lws_process_html_args *args =
- * (struct lws_process_html_args *)in;
- *
- * if (lws_add_http_header_by_name(wsi,
- * (unsigned char *)"set-cookie:",
- * (unsigned char *)cookie, cookie_len,
- * (unsigned char **)&args->p,
- * (unsigned char *)args->p + args->max_len))
- * return 1;
- *
- * break;
- */
-
- LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
- /**< This gives the user code a chance to forbid an http access.
- * `in` points to a `struct lws_process_html_args`, which
- * describes the URL, and a bit mask describing the type of
- * authentication required. If the callback returns nonzero,
- * the transaction ends with HTTP_STATUS_UNAUTHORIZED. */
-
- LWS_CALLBACK_PROCESS_HTML = 52,
- /**< This gives your user code a chance to mangle outgoing
- * HTML. `in` points to a `struct lws_process_html_args`
- * which describes the buffer containing outgoing HTML.
- * The buffer may grow up to `.max_len` (currently +128
- * bytes per buffer).
- */
-
- LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
- /**< By default, all HTTP handling is done in protocols[0].
- * However you can bind different protocols (by name) to
- * different parts of the URL space using callback mounts. This
- * callback occurs in the new protocol when a wsi is bound
- * to that protocol. Any protocol allocation related to the
- * http transaction processing should be created then.
- * These specific callbacks are necessary because with HTTP/1.1,
- * a single connection may perform at series of different
- * transactions at different URLs, thus the lifetime of the
- * protocol bind is just for one transaction, not connection. */
-
- LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
- /**< This is called when a transaction is unbound from a protocol.
- * It indicates the connection completed its transaction and may
- * do something different now. Any protocol allocation related
- * to the http transaction processing should be destroyed. */
-
- LWS_CALLBACK_HTTP_CONFIRM_UPGRADE = 86,
- /**< This is your chance to reject an HTTP upgrade action. The
- * name of the protocol being upgraded to is in 'in', and the ah
- * is still bound to the wsi, so you can look at the headers.
- *
- * The default of returning 0 (ie, also if not handled) means the
- * upgrade may proceed. Return <0 to just hang up the connection,
- * or >0 if you have rejected the connection by returning http headers
- * and response code yourself.
- *
- * There is no need for you to call transaction_completed() as the
- * caller will take care of it when it sees you returned >0.
- */
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to HTTP Client -----
- */
-
- LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
- /**< The HTTP client connection has succeeded, and is now
- * connected to the server */
-
- LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
- /**< The HTTP client connection is closing */
-
- LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
- /**< This is generated by lws_http_client_read() used to drain
- * incoming data. In the case the incoming data was chunked, it will
- * be split into multiple smaller callbacks for each chunk block,
- * removing the chunk headers. If not chunked, it will appear all in
- * one callback. */
-
- LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
- /**< This simply indicates data was received on the HTTP client
- * connection. It does NOT drain or provide the data.
- * This exists to neatly allow a proxying type situation,
- * where this incoming data will go out on another connection.
- * If the outgoing connection stalls, we should stall processing
- * the incoming data. So a handler for this in that case should
- * simply set a flag to indicate there is incoming data ready
- * and ask for a writeable callback on the outgoing connection.
- * In the writable callback he can check the flag and then get
- * and drain the waiting incoming data using lws_http_client_read().
- * This will use callbacks to LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ
- * to get and drain the incoming data, where it should be sent
- * back out on the outgoing connection. */
- LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
- /**< The client transaction completed... at the moment this
- * is the same as closing since transaction pipelining on
- * client side is not yet supported. */
-
- LWS_CALLBACK_CLIENT_HTTP_WRITEABLE = 57,
- /**< when doing an HTTP type client connection, you can call
- * lws_client_http_body_pending(wsi, 1) from
- * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to get these callbacks
- * sending the HTTP headers.
- *
- * From this callback, when you have sent everything, you should let
- * lws know by calling lws_client_http_body_pending(wsi, 0)
- */
-
- LWS_CALLBACK_CLIENT_HTTP_BIND_PROTOCOL = 85,
- LWS_CALLBACK_CLIENT_HTTP_DROP_PROTOCOL = 76,
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to Websocket Server -----
- */
-
- LWS_CALLBACK_ESTABLISHED = 0,
- /**< (VH) after the server completes a handshake with an incoming
- * client. If you built the library with ssl support, in is a
- * pointer to the ssl struct associated with the connection or NULL.
- *
- * b0 of len is set if the connection was made using ws-over-h2
- */
-
- LWS_CALLBACK_CLOSED = 4,
- /**< when the websocket session ends */
-
- LWS_CALLBACK_SERVER_WRITEABLE = 11,
- /**< See LWS_CALLBACK_CLIENT_WRITEABLE */
-
- LWS_CALLBACK_RECEIVE = 6,
- /**< data has appeared for this server endpoint from a
- * remote client, it can be found at *in and is
- * len bytes long */
-
- LWS_CALLBACK_RECEIVE_PONG = 7,
- /**< servers receive PONG packets with this callback reason */
-
- LWS_CALLBACK_WS_PEER_INITIATED_CLOSE = 38,
- /**< The peer has sent an unsolicited Close WS packet. in and
- * len are the optional close code (first 2 bytes, network
- * order) and the optional additional information which is not
- * defined in the standard, and may be a string or non human-readable
- * data.
- * If you return 0 lws will echo the close and then close the
- * connection. If you return nonzero lws will just close the
- * connection. */
-
- LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION = 20,
- /**< called when the handshake has
- * been received and parsed from the client, but the response is
- * not sent yet. Return non-zero to disallow the connection.
- * user is a pointer to the connection user space allocation,
- * in is the requested protocol name
- * In your handler you can use the public APIs
- * lws_hdr_total_length() / lws_hdr_copy() to access all of the
- * headers using the header enums lws_token_indexes from
- * libwebsockets.h to check for and read the supported header
- * presence and content before deciding to allow the handshake
- * to proceed or to kill the connection. */
-
- LWS_CALLBACK_CONFIRM_EXTENSION_OKAY = 25,
- /**< When the server handshake code
- * sees that it does support a requested extension, before
- * accepting the extension by additing to the list sent back to
- * the client it gives this callback just to check that it's okay
- * to use that extension. It calls back to the requested protocol
- * and with in being the extension name, len is 0 and user is
- * valid. Note though at this time the ESTABLISHED callback hasn't
- * happened yet so if you initialize user content there, user
- * content during this callback might not be useful for anything. */
-
- LWS_CALLBACK_WS_SERVER_BIND_PROTOCOL = 77,
- LWS_CALLBACK_WS_SERVER_DROP_PROTOCOL = 78,
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to Websocket Client -----
- */
-
- LWS_CALLBACK_CLIENT_CONNECTION_ERROR = 1,
- /**< the request client connection has been unable to complete a
- * handshake with the remote server. If in is non-NULL, you can
- * find an error string of length len where it points to
- *
- * Diagnostic strings that may be returned include
- *
- * "getaddrinfo (ipv6) failed"
- * "unknown address family"
- * "getaddrinfo (ipv4) failed"
- * "set socket opts failed"
- * "insert wsi failed"
- * "lws_ssl_client_connect1 failed"
- * "lws_ssl_client_connect2 failed"
- * "Peer hung up"
- * "read failed"
- * "HS: URI missing"
- * "HS: Redirect code but no Location"
- * "HS: URI did not parse"
- * "HS: Redirect failed"
- * "HS: Server did not return 200"
- * "HS: OOM"
- * "HS: disallowed by client filter"
- * "HS: disallowed at ESTABLISHED"
- * "HS: ACCEPT missing"
- * "HS: ws upgrade response not 101"
- * "HS: UPGRADE missing"
- * "HS: Upgrade to something other than websocket"
- * "HS: CONNECTION missing"
- * "HS: UPGRADE malformed"
- * "HS: PROTOCOL malformed"
- * "HS: Cannot match protocol"
- * "HS: EXT: list too big"
- * "HS: EXT: failed setting defaults"
- * "HS: EXT: failed parsing defaults"
- * "HS: EXT: failed parsing options"
- * "HS: EXT: Rejects server options"
- * "HS: EXT: unknown ext"
- * "HS: Accept hash wrong"
- * "HS: Rejected by filter cb"
- * "HS: OOM"
- * "HS: SO_SNDBUF failed"
- * "HS: Rejected at CLIENT_ESTABLISHED"
- */
-
- LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH = 2,
- /**< this is the last chance for the client user code to examine the
- * http headers and decide to reject the connection. If the
- * content in the headers is interesting to the
- * client (url, etc) it needs to copy it out at
- * this point since it will be destroyed before
- * the CLIENT_ESTABLISHED call */
-
- LWS_CALLBACK_CLIENT_ESTABLISHED = 3,
- /**< after your client connection completed the websocket upgrade
- * handshake with the remote server */
-
- LWS_CALLBACK_CLIENT_CLOSED = 75,
- /**< when a client websocket session ends */
-
- LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER = 24,
- /**< this callback happens
- * when a client handshake is being compiled. user is NULL,
- * in is a char **, it's pointing to a char * which holds the
- * next location in the header buffer where you can add
- * headers, and len is the remaining space in the header buffer,
- * which is typically some hundreds of bytes. So, to add a canned
- * cookie, your handler code might look similar to:
- *
- * char **p = (char **)in, *end = (*p) + len;
- *
- * if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_COOKIE,
- * (unsigned char)"a=b", 3, p, end))
- * return -1;
- *
- * See LWS_CALLBACK_ADD_HEADERS for adding headers to server
- * transactions.
- */
-
- LWS_CALLBACK_CLIENT_RECEIVE = 8,
- /**< data has appeared from the server for the client connection, it
- * can be found at *in and is len bytes long */
-
- LWS_CALLBACK_CLIENT_RECEIVE_PONG = 9,
- /**< clients receive PONG packets with this callback reason */
-
- LWS_CALLBACK_CLIENT_WRITEABLE = 10,
- /**< If you call lws_callback_on_writable() on a connection, you will
- * get one of these callbacks coming when the connection socket
- * is able to accept another write packet without blocking.
- * If it already was able to take another packet without blocking,
- * you'll get this callback at the next call to the service loop
- * function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE
- * and servers get LWS_CALLBACK_SERVER_WRITEABLE. */
-
- LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED = 26,
- /**< When a ws client
- * connection is being prepared to start a handshake to a server,
- * each supported extension is checked with protocols[0] callback
- * with this reason, giving the user code a chance to suppress the
- * claim to support that extension by returning non-zero. If
- * unhandled, by default 0 will be returned and the extension
- * support included in the header to the server. Notice this
- * callback comes to protocols[0]. */
-
- LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
- /**< Gives client connections an opportunity to adjust negotiated
- * extension defaults. `user` is the extension name that was
- * negotiated (eg, "permessage-deflate"). `in` points to a
- * buffer and `len` is the buffer size. The user callback can
- * set the buffer to a string describing options the extension
- * should parse. Or just ignore for defaults. */
-
-
- LWS_CALLBACK_FILTER_NETWORK_CONNECTION = 17,
- /**< called when a client connects to
- * the server at network level; the connection is accepted but then
- * passed to this callback to decide whether to hang up immediately
- * or not, based on the client IP. in contains the connection
- * socket's descriptor. Since the client connection information is
- * not available yet, wsi still pointing to the main server socket.
- * Return non-zero to terminate the connection before sending or
- * receiving anything. Because this happens immediately after the
- * network connection from the client, there's no websocket protocol
- * selected yet so this callback is issued only to protocol 0. */
-
- LWS_CALLBACK_WS_CLIENT_BIND_PROTOCOL = 79,
- LWS_CALLBACK_WS_CLIENT_DROP_PROTOCOL = 80,
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to external poll loop integration -----
- */
-
- LWS_CALLBACK_GET_THREAD_ID = 31,
- /**< lws can accept callback when writable requests from other
- * threads, if you implement this callback and return an opaque
- * current thread ID integer. */
-
- /* external poll() management support */
- LWS_CALLBACK_ADD_POLL_FD = 32,
- /**< lws normally deals with its poll() or other event loop
- * internally, but in the case you are integrating with another
- * server you will need to have lws sockets share a
- * polling array with the other server. This and the other
- * POLL_FD related callbacks let you put your specialized
- * poll array interface code in the callback for protocol 0, the
- * first protocol you support, usually the HTTP protocol in the
- * serving case.
- * This callback happens when a socket needs to be
- * added to the polling loop: in points to a struct
- * lws_pollargs; the fd member of the struct is the file
- * descriptor, and events contains the active events
- *
- * If you are using the internal lws polling / event loop
- * you can just ignore these callbacks. */
-
- LWS_CALLBACK_DEL_POLL_FD = 33,
- /**< This callback happens when a socket descriptor
- * needs to be removed from an external polling array. in is
- * again the struct lws_pollargs containing the fd member
- * to be removed. If you are using the internal polling
- * loop, you can just ignore it. */
-
- LWS_CALLBACK_CHANGE_MODE_POLL_FD = 34,
- /**< This callback happens when lws wants to modify the events for
- * a connection.
- * in is the struct lws_pollargs with the fd to change.
- * The new event mask is in events member and the old mask is in
- * the prev_events member.
- * If you are using the internal polling loop, you can just ignore
- * it. */
-
- LWS_CALLBACK_LOCK_POLL = 35,
- /**< These allow the external poll changes driven
- * by lws to participate in an external thread locking
- * scheme around the changes, so the whole thing is threadsafe.
- * These are called around three activities in the library,
- * - inserting a new wsi in the wsi / fd table (len=1)
- * - deleting a wsi from the wsi / fd table (len=1)
- * - changing a wsi's POLLIN/OUT state (len=0)
- * Locking and unlocking external synchronization objects when
- * len == 1 allows external threads to be synchronized against
- * wsi lifecycle changes if it acquires the same lock for the
- * duration of wsi dereference from the other thread context. */
-
- LWS_CALLBACK_UNLOCK_POLL = 36,
- /**< See LWS_CALLBACK_LOCK_POLL, ignore if using lws internal poll */
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to CGI serving -----
- */
-
- LWS_CALLBACK_CGI = 40,
- /**< CGI: CGI IO events on stdin / out / err are sent here on
- * protocols[0]. The provided `lws_callback_http_dummy()`
- * handles this and the callback should be directed there if
- * you use CGI. */
-
- LWS_CALLBACK_CGI_TERMINATED = 41,
- /**< CGI: The related CGI process ended, this is called before
- * the wsi is closed. Used to, eg, terminate chunking.
- * The provided `lws_callback_http_dummy()`
- * handles this and the callback should be directed there if
- * you use CGI. The child PID that terminated is in len. */
-
- LWS_CALLBACK_CGI_STDIN_DATA = 42,
- /**< CGI: Data is, to be sent to the CGI process stdin, eg from
- * a POST body. The provided `lws_callback_http_dummy()`
- * handles this and the callback should be directed there if
- * you use CGI. */
-
- LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
- /**< CGI: no more stdin is coming. The provided
- * `lws_callback_http_dummy()` handles this and the callback
- * should be directed there if you use CGI. */
-
- LWS_CALLBACK_CGI_PROCESS_ATTACH = 70,
- /**< CGI: Sent when the CGI process is spawned for the wsi. The
- * len parameter is the PID of the child process */
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to Generic Sessions -----
- */
-
- LWS_CALLBACK_SESSION_INFO = 54,
- /**< This is only generated by user code using generic sessions.
- * It's used to get a `struct lws_session_info` filled in by
- * generic sessions with information about the logged-in user.
- * See the messageboard sample for an example of how to use. */
-
- LWS_CALLBACK_GS_EVENT = 55,
- /**< Indicates an event happened to the Generic Sessions session.
- * `in` contains a `struct lws_gs_event_args` describing the event. */
-
- LWS_CALLBACK_HTTP_PMO = 56,
- /**< per-mount options for this connection, called before
- * the normal LWS_CALLBACK_HTTP when the mount has per-mount
- * options.
- */
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to RAW sockets -----
- */
-
- LWS_CALLBACK_RAW_RX = 59,
- /**< RAW mode connection RX */
-
- LWS_CALLBACK_RAW_CLOSE = 60,
- /**< RAW mode connection is closing */
-
- LWS_CALLBACK_RAW_WRITEABLE = 61,
- /**< RAW mode connection may be written */
-
- LWS_CALLBACK_RAW_ADOPT = 62,
- /**< RAW mode connection was adopted (equivalent to 'wsi created') */
-
- LWS_CALLBACK_RAW_SKT_BIND_PROTOCOL = 81,
- LWS_CALLBACK_RAW_SKT_DROP_PROTOCOL = 82,
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to RAW file handles -----
- */
-
- LWS_CALLBACK_RAW_ADOPT_FILE = 63,
- /**< RAW mode file was adopted (equivalent to 'wsi created') */
-
- LWS_CALLBACK_RAW_RX_FILE = 64,
- /**< This is the indication the RAW mode file has something to read.
- * This doesn't actually do the read of the file and len is always
- * 0... your code should do the read having been informed there is
- * something to read now. */
-
- LWS_CALLBACK_RAW_WRITEABLE_FILE = 65,
- /**< RAW mode file is writeable */
-
- LWS_CALLBACK_RAW_CLOSE_FILE = 66,
- /**< RAW mode wsi that adopted a file is closing */
-
- LWS_CALLBACK_RAW_FILE_BIND_PROTOCOL = 83,
- LWS_CALLBACK_RAW_FILE_DROP_PROTOCOL = 84,
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to generic wsi events -----
- */
-
- LWS_CALLBACK_TIMER = 73,
- /**< When the time elapsed after a call to
- * lws_set_timer_usecs(wsi, usecs) is up, the wsi will get one of
- * these callbacks. The deadline can be continuously extended into the
- * future by later calls to lws_set_timer_usecs() before the deadline
- * expires, or cancelled by lws_set_timer_usecs(wsi, -1);
- */
-
- LWS_CALLBACK_EVENT_WAIT_CANCELLED = 71,
- /**< This is sent to every protocol of every vhost in response
- * to lws_cancel_service() or lws_cancel_service_pt(). This
- * callback is serialized in the lws event loop normally, even
- * if the lws_cancel_service[_pt]() call was from a different
- * thread. */
-
- LWS_CALLBACK_CHILD_CLOSING = 69,
- /**< Sent to parent to notify them a child is closing / being
- * destroyed. in is the child wsi.
- */
-
- /* ---------------------------------------------------------------------
- * ----- Callbacks related to TLS certificate management -----
- */
-
- LWS_CALLBACK_VHOST_CERT_AGING = 72,
- /**< When a vhost TLS cert has its expiry checked, this callback
- * is broadcast to every protocol of every vhost in case the
- * protocol wants to take some action with this information.
- * \p in is a pointer to a struct lws_acme_cert_aging_args,
- * and \p len is the number of days left before it expires, as
- * a (ssize_t). In the struct lws_acme_cert_aging_args, vh
- * points to the vhost the cert aging information applies to,
- * and element_overrides[] is an optional way to update information
- * from the pvos... NULL in an index means use the information from
- * from the pvo for the cert renewal, non-NULL in the array index
- * means use that pointer instead for the index. */
-
- LWS_CALLBACK_VHOST_CERT_UPDATE = 74,
- /**< When a vhost TLS cert is being updated, progress is
- * reported to the vhost in question here, including completion
- * and failure. in points to optional JSON, and len represents the
- * connection state using enum lws_cert_update_state */
-
-
- /****** add new things just above ---^ ******/
-
- LWS_CALLBACK_USER = 1000,
- /**< user code can use any including above without fear of clashes */
-};
-
-
-
-/**
- * typedef lws_callback_function() - User server actions
- * \param wsi: Opaque websocket instance pointer
- * \param reason: The reason for the call
- * \param user: Pointer to per-session user data allocated by library
- * \param in: Pointer used for some callback reasons
- * \param len: Length set for some callback reasons
- *
- * This callback is the way the user controls what is served. All the
- * protocol detail is hidden and handled by the library.
- *
- * For each connection / session there is user data allocated that is
- * pointed to by "user". You set the size of this user data area when
- * the library is initialized with lws_create_server.
- */
-typedef int
-lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
- void *user, void *in, size_t len);
-
-#define LWS_CB_REASON_AUX_BF__CGI 1
-#define LWS_CB_REASON_AUX_BF__PROXY 2
-#define LWS_CB_REASON_AUX_BF__CGI_CHUNK_END 4
-#define LWS_CB_REASON_AUX_BF__CGI_HEADERS 8
-#define LWS_CB_REASON_AUX_BF__PROXY_TRANS_END 16
-#define LWS_CB_REASON_AUX_BF__PROXY_HEADERS 32
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-cgi.h b/thirdparty/libwebsockets/include/libwebsockets/lws-cgi.h
deleted file mode 100644
index 7a5eca2855..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-cgi.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup cgi cgi handling
- *
- * ##CGI handling
- *
- * These functions allow low-level control over stdin/out/err of the cgi.
- *
- * However for most cases, binding the cgi to http in and out, the default
- * lws implementation already does the right thing.
- */
-
-enum lws_enum_stdinouterr {
- LWS_STDIN = 0,
- LWS_STDOUT = 1,
- LWS_STDERR = 2,
-};
-
-enum lws_cgi_hdr_state {
- LCHS_HEADER,
- LCHS_CR1,
- LCHS_LF1,
- LCHS_CR2,
- LCHS_LF2,
- LHCS_RESPONSE,
- LHCS_DUMP_HEADERS,
- LHCS_PAYLOAD,
- LCHS_SINGLE_0A,
-};
-
-struct lws_cgi_args {
- struct lws **stdwsi; /**< get fd with lws_get_socket_fd() */
- enum lws_enum_stdinouterr ch; /**< channel index */
- unsigned char *data; /**< for messages with payload */
- enum lws_cgi_hdr_state hdr_state; /**< track where we are in cgi headers */
- int len; /**< length */
-};
-
-#ifdef LWS_WITH_CGI
-/**
- * lws_cgi: spawn network-connected cgi process
- *
- * \param wsi: connection to own the process
- * \param exec_array: array of "exec-name" "arg1" ... "argn" NULL
- * \param script_uri_path_len: how many chars on the left of the uri are the
- * path to the cgi, or -1 to spawn without URL-related env vars
- * \param timeout_secs: seconds script should be allowed to run
- * \param mp_cgienv: pvo list with per-vhost cgi options to put in env
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_cgi(struct lws *wsi, const char * const *exec_array,
- int script_uri_path_len, int timeout_secs,
- const struct lws_protocol_vhost_options *mp_cgienv);
-
-/**
- * lws_cgi_write_split_stdout_headers: write cgi output accounting for header part
- *
- * \param wsi: connection to own the process
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_cgi_write_split_stdout_headers(struct lws *wsi);
-
-/**
- * lws_cgi_kill: terminate cgi process associated with wsi
- *
- * \param wsi: connection to own the process
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_cgi_kill(struct lws *wsi);
-
-/**
- * lws_cgi_get_stdwsi: get wsi for stdin, stdout, or stderr
- *
- * \param wsi: parent wsi that has cgi
- * \param ch: which of LWS_STDIN, LWS_STDOUT or LWS_STDERR
- */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_cgi_get_stdwsi(struct lws *wsi, enum lws_enum_stdinouterr ch);
-
-#endif
-///@}
-
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-client.h b/thirdparty/libwebsockets/include/libwebsockets/lws-client.h
deleted file mode 100644
index a1661b0a9f..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-client.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup client Client related functions
- * ##Client releated functions
- * \ingroup lwsapi
- *
- * */
-///@{
-
-/** enum lws_client_connect_ssl_connection_flags - flags that may be used
- * with struct lws_client_connect_info ssl_connection member to control if
- * and how SSL checks apply to the client connection being created
- */
-
-enum lws_client_connect_ssl_connection_flags {
- LCCSCF_USE_SSL = (1 << 0),
- LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
- LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
- LCCSCF_ALLOW_EXPIRED = (1 << 3),
-
- LCCSCF_PIPELINE = (1 << 16),
- /**< Serialize / pipeline multiple client connections
- * on a single connection where possible.
- *
- * HTTP/1.0: possible if Keep-Alive: yes sent by server
- * HTTP/1.1: always possible... uses pipelining
- * HTTP/2: always possible... uses parallel streams
- * */
-};
-
-/** struct lws_client_connect_info - parameters to connect with when using
- * lws_client_connect_via_info() */
-
-struct lws_client_connect_info {
- struct lws_context *context;
- /**< lws context to create connection in */
- const char *address;
- /**< remote address to connect to */
- int port;
- /**< remote port to connect to */
- int ssl_connection;
- /**< 0, or a combination of LCCSCF_ flags */
- const char *path;
- /**< uri path */
- const char *host;
- /**< content of host header */
- const char *origin;
- /**< content of origin header */
- const char *protocol;
- /**< list of ws protocols we could accept */
- int ietf_version_or_minus_one;
- /**< deprecated: currently leave at 0 or -1 */
- void *userdata;
- /**< if non-NULL, use this as wsi user_data instead of malloc it */
- const void *client_exts;
- /**< UNUSED... provide in info.extensions at context creation time */
- const char *method;
- /**< if non-NULL, do this http method instead of ws[s] upgrade.
- * use "GET" to be a simple http client connection. "RAW" gets
- * you a connected socket that lws itself will leave alone once
- * connected. */
- struct lws *parent_wsi;
- /**< if another wsi is responsible for this connection, give it here.
- * this is used to make sure if the parent closes so do any
- * child connections first. */
- const char *uri_replace_from;
- /**< if non-NULL, when this string is found in URIs in
- * text/html content-encoding, it's replaced with uri_replace_to */
- const char *uri_replace_to;
- /**< see uri_replace_from */
- struct lws_vhost *vhost;
- /**< vhost to bind to (used to determine related SSL_CTX) */
- struct lws **pwsi;
- /**< if not NULL, store the new wsi here early in the connection
- * process. Although we return the new wsi, the call to create the
- * client connection does progress the connection somewhat and may
- * meet an error that will result in the connection being scrubbed and
- * NULL returned. While the wsi exists though, he may process a
- * callback like CLIENT_CONNECTION_ERROR with his wsi: this gives the
- * user callback a way to identify which wsi it is that faced the error
- * even before the new wsi is returned and even if ultimately no wsi
- * is returned.
- */
- const char *iface;
- /**< NULL to allow routing on any interface, or interface name or IP
- * to bind the socket to */
- const char *local_protocol_name;
- /**< NULL: .protocol is used both to select the local protocol handler
- * to bind to and as the list of remote ws protocols we could
- * accept.
- * non-NULL: this protocol name is used to bind the connection to
- * the local protocol handler. .protocol is used for the
- * list of remote ws protocols we could accept */
- const char *alpn;
- /**< NULL: allow lws default ALPN list, from vhost if present or from
- * list of roles built into lws
- * non-NULL: require one from provided comma-separated list of alpn
- * tokens
- */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility
- *
- * The below is to ensure later library versions with new
- * members added above will see 0 (default) even if the app
- * was not built against the newer headers.
- */
-
- void *_unused[4]; /**< dummy */
-};
-
-/**
- * lws_client_connect_via_info() - Connect to another websocket server
- * \param ccinfo: pointer to lws_client_connect_info struct
- *
- * This function creates a connection to a remote server using the
- * information provided in ccinfo.
- */
-LWS_VISIBLE LWS_EXTERN struct lws *
-lws_client_connect_via_info(const struct lws_client_connect_info *ccinfo);
-
-/**
- * lws_init_vhost_client_ssl() - also enable client SSL on an existing vhost
- *
- * \param info: client ssl related info
- * \param vhost: which vhost to initialize client ssl operations on
- *
- * You only need to call this if you plan on using SSL client connections on
- * the vhost. For non-SSL client connections, it's not necessary to call this.
- *
- * The following members of info are used during the call
- *
- * - options must have LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT set,
- * otherwise the call does nothing
- * - provided_client_ssl_ctx must be NULL to get a generated client
- * ssl context, otherwise you can pass a prepared one in by setting it
- * - ssl_cipher_list may be NULL or set to the client valid cipher list
- * - ssl_ca_filepath may be NULL or client cert filepath
- * - ssl_cert_filepath may be NULL or client cert filepath
- * - ssl_private_key_filepath may be NULL or client cert private key
- *
- * You must create your vhost explicitly if you want to use this, so you have
- * a pointer to the vhost. Create the context first with the option flag
- * LWS_SERVER_OPTION_EXPLICIT_VHOSTS and then call lws_create_vhost() with
- * the same info struct.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_init_vhost_client_ssl(const struct lws_context_creation_info *info,
- struct lws_vhost *vhost);
-/**
- * lws_http_client_read() - consume waiting received http client data
- *
- * \param wsi: client connection
- * \param buf: pointer to buffer pointer - fill with pointer to your buffer
- * \param len: pointer to chunk length - fill with max length of buffer
- *
- * This is called when the user code is notified client http data has arrived.
- * The user code may choose to delay calling it to consume the data, for example
- * waiting until an onward connection is writeable.
- *
- * For non-chunked connections, up to len bytes of buf are filled with the
- * received content. len is set to the actual amount filled before return.
- *
- * For chunked connections, the linear buffer content contains the chunking
- * headers and it cannot be passed in one lump. Instead, this function will
- * call back LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ with in pointing to the
- * chunk start and len set to the chunk length. There will be as many calls
- * as there are chunks or partial chunks in the buffer.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_http_client_read(struct lws *wsi, char **buf, int *len);
-
-/**
- * lws_http_client_http_response() - get last HTTP response code
- *
- * \param wsi: client connection
- *
- * Returns the last server response code, eg, 200 for client http connections.
- *
- * You should capture this during the LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP
- * callback, because after that the memory reserved for storing the related
- * headers is freed and this value is lost.
- */
-LWS_VISIBLE LWS_EXTERN unsigned int
-lws_http_client_http_response(struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_client_http_body_pending(struct lws *wsi, int something_left_to_send);
-
-/**
- * lws_client_http_body_pending() - control if client connection neeeds to send body
- *
- * \param wsi: client connection
- * \param something_left_to_send: nonzero if need to send more body, 0 (default)
- * if nothing more to send
- *
- * If you will send payload data with your HTTP client connection, eg, for POST,
- * when you set the related http headers in
- * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER callback you should also call
- * this API with something_left_to_send nonzero, and call
- * lws_callback_on_writable(wsi);
- *
- * After sending the headers, lws will call your callback with
- * LWS_CALLBACK_CLIENT_HTTP_WRITEABLE reason when writable. You can send the
- * next part of the http body payload, calling lws_callback_on_writable(wsi);
- * if there is more to come, or lws_client_http_body_pending(wsi, 0); to
- * let lws know the last part is sent and the connection can move on.
- */
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-context-vhost.h b/thirdparty/libwebsockets/include/libwebsockets/lws-context-vhost.h
deleted file mode 100644
index a63d708629..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-context-vhost.h
+++ /dev/null
@@ -1,927 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup context-and-vhost context and vhost related functions
- * ##Context and Vhost releated functions
- * \ingroup lwsapi
- *
- *
- * LWS requires that there is one context, in which you may define multiple
- * vhosts. Each vhost is a virtual host, with either its own listen port
- * or sharing an existing one. Each vhost has its own SSL context that can
- * be set up individually or left disabled.
- *
- * If you don't care about multiple "site" support, you can ignore it and
- * lws will create a single default vhost at context creation time.
- */
-///@{
-
-/*
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-
-/** enum lws_context_options - context and vhost options */
-enum lws_context_options {
- LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT = (1 << 1) |
- (1 << 12),
- /**< (VH) Don't allow the connection unless the client has a
- * client cert that we recognize; provides
- * LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT */
- LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME = (1 << 2),
- /**< (CTX) Don't try to get the server's hostname */
- LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT = (1 << 3) |
- (1 << 12),
- /**< (VH) Allow non-SSL (plaintext) connections on the same
- * port as SSL is listening... undermines the security of SSL;
- * provides LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT */
- LWS_SERVER_OPTION_LIBEV = (1 << 4),
- /**< (CTX) Use libev event loop */
- LWS_SERVER_OPTION_DISABLE_IPV6 = (1 << 5),
- /**< (VH) Disable IPV6 support */
- LWS_SERVER_OPTION_DISABLE_OS_CA_CERTS = (1 << 6),
- /**< (VH) Don't load OS CA certs, you will need to load your
- * own CA cert(s) */
- LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED = (1 << 7),
- /**< (VH) Accept connections with no valid Cert (eg, selfsigned) */
- LWS_SERVER_OPTION_VALIDATE_UTF8 = (1 << 8),
- /**< (VH) Check UT-8 correctness */
- LWS_SERVER_OPTION_SSL_ECDH = (1 << 9) |
- (1 << 12),
- /**< (VH) initialize ECDH ciphers */
- LWS_SERVER_OPTION_LIBUV = (1 << 10),
- /**< (CTX) Use libuv event loop */
- LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS = (1 << 11) |
- (1 << 12),
- /**< (VH) Use http redirect to force http to https
- * (deprecated: use mount redirection) */
- LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT = (1 << 12),
- /**< (CTX) Initialize the SSL library at all */
- LWS_SERVER_OPTION_EXPLICIT_VHOSTS = (1 << 13),
- /**< (CTX) Only create the context when calling context
- * create api, implies user code will create its own vhosts */
- LWS_SERVER_OPTION_UNIX_SOCK = (1 << 14),
- /**< (VH) Use Unix socket */
- LWS_SERVER_OPTION_STS = (1 << 15),
- /**< (VH) Send Strict Transport Security header, making
- * clients subsequently go to https even if user asked for http */
- LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY = (1 << 16),
- /**< (VH) Enable LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE to take effect */
- LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE = (1 << 17),
- /**< (VH) if set, only ipv6 allowed on the vhost */
- LWS_SERVER_OPTION_UV_NO_SIGSEGV_SIGFPE_SPIN = (1 << 18),
- /**< (CTX) Libuv only: Do not spin on SIGSEGV / SIGFPE. A segfault
- * normally makes the lib spin so you can attach a debugger to it
- * even if it happened without a debugger in place. You can disable
- * that by giving this option.
- */
- LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN = (1 << 19),
- /**< For backwards-compatibility reasons, by default
- * lws prepends "http://" to the origin you give in the client
- * connection info struct. If you give this flag when you create
- * the context, only the string you give in the client connect
- * info for .origin (if any) will be used directly.
- */
- LWS_SERVER_OPTION_FALLBACK_TO_RAW = (1 << 20),
- /**< (VH) if invalid http is coming in the first line, */
- LWS_SERVER_OPTION_LIBEVENT = (1 << 21),
- /**< (CTX) Use libevent event loop */
- LWS_SERVER_OPTION_ONLY_RAW = (1 << 22),
- /**< (VH) All connections to this vhost / port are RAW as soon as
- * the connection is accepted, no HTTP is going to be coming.
- */
- LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE = (1 << 23),
- /**< (VH) Set to allow multiple listen sockets on one interface +
- * address + port. The default is to strictly allow only one
- * listen socket at a time. This is automatically selected if you
- * have multiple service threads.
- */
- LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX = (1 << 24),
- /**< (VH) Force setting up the vhost SSL_CTX, even though the user
- * code doesn't explicitly provide a cert in the info struct. It
- * implies the user code is going to provide a cert at the
- * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS callback, which
- * provides the vhost SSL_CTX * in the user parameter.
- */
- LWS_SERVER_OPTION_SKIP_PROTOCOL_INIT = (1 << 25),
- /**< (VH) You probably don't want this. It forces this vhost to not
- * call LWS_CALLBACK_PROTOCOL_INIT on its protocols. It's used in the
- * special case of a temporary vhost bound to a single protocol.
- */
- LWS_SERVER_OPTION_IGNORE_MISSING_CERT = (1 << 26),
- /**< (VH) Don't fail if the vhost TLS cert or key are missing, just
- * continue. The vhost won't be able to serve anything, but if for
- * example the ACME plugin was configured to fetch a cert, this lets
- * you bootstrap your vhost from having no cert to start with.
- */
- LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK = (1 << 27),
- /**< (VH) On this vhost, if the connection is being upgraded, insist
- * that there's a Host: header and that the contents match the vhost
- * name + port (443 / 80 are assumed if no :port given based on if the
- * connection is using TLS).
- *
- * By default, without this flag, on upgrade lws just checks that the
- * Host: header was given without checking the contents... this is to
- * allow lax hostname mappings like localhost / 127.0.0.1, and CNAME
- * mappings like www.mysite.com / mysite.com
- */
- LWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE = (1 << 28),
- /**< (VH) Send lws default HTTP headers recommended by Mozilla
- * Observatory for security. This is a helper option that sends canned
- * headers on each http response enabling a VERY strict Content Security
- * Policy. The policy is so strict, for example it won't let the page
- * run its own inline JS nor show images or take CSS from a different
- * server. In many cases your JS only comes from your server as do the
- * image sources and CSS, so that is what you want... attackers hoping
- * to inject JS into your DOM are completely out of luck since even if
- * they succeed, it will be rejected for execution by the browser
- * according to the strict CSP. In other cases you have to deviate from
- * the complete strictness, in which case don't use this flag: use the
- * .headers member in the vhost init described in struct
- * lws_context_creation_info instead to send the adapted headers
- * yourself.
- */
-
- /****** add new things just above ---^ ******/
-};
-
-#define lws_check_opt(c, f) (((c) & (f)) == (f))
-
-struct lws_plat_file_ops;
-
-/** struct lws_context_creation_info - parameters to create context and /or vhost with
- *
- * This is also used to create vhosts.... if LWS_SERVER_OPTION_EXPLICIT_VHOSTS
- * is not given, then for backwards compatibility one vhost is created at
- * context-creation time using the info from this struct.
- *
- * If LWS_SERVER_OPTION_EXPLICIT_VHOSTS is given, then no vhosts are created
- * at the same time as the context, they are expected to be created afterwards.
- */
-struct lws_context_creation_info {
- int port;
- /**< VHOST: Port to listen on. Use CONTEXT_PORT_NO_LISTEN to suppress
- * listening for a client. Use CONTEXT_PORT_NO_LISTEN_SERVER if you are
- * writing a server but you are using \ref sock-adopt instead of the
- * built-in listener.
- *
- * You can also set port to 0, in which case the kernel will pick
- * a random port that is not already in use. You can find out what
- * port the vhost is listening on using lws_get_vhost_listen_port() */
- const char *iface;
- /**< VHOST: NULL to bind the listen socket to all interfaces, or the
- * interface name, eg, "eth2"
- * If options specifies LWS_SERVER_OPTION_UNIX_SOCK, this member is
- * the pathname of a UNIX domain socket. you can use the UNIX domain
- * sockets in abstract namespace, by prepending an at symbol to the
- * socket name. */
- const struct lws_protocols *protocols;
- /**< VHOST: Array of structures listing supported protocols and a
- * protocol-specific callback for each one. The list is ended with an
- * entry that has a NULL callback pointer. */
- const struct lws_extension *extensions;
- /**< VHOST: NULL or array of lws_extension structs listing the
- * extensions this context supports. */
- const struct lws_token_limits *token_limits;
- /**< CONTEXT: NULL or struct lws_token_limits pointer which is
- * initialized with a token length limit for each possible WSI_TOKEN_ */
- const char *ssl_private_key_password;
- /**< VHOST: NULL or the passphrase needed for the private key. (For
- * backwards compatibility, this can also be used to pass the client
- * cert passphrase when setting up a vhost client SSL context, but it is
- * preferred to use .client_ssl_private_key_password for that.) */
- const char *ssl_cert_filepath;
- /**< VHOST: If libwebsockets was compiled to use ssl, and you want
- * to listen using SSL, set to the filepath to fetch the
- * server cert from, otherwise NULL for unencrypted. (For backwards
- * compatibility, this can also be used to pass the client certificate
- * when setting up a vhost client SSL context, but it is preferred to
- * use .client_ssl_cert_filepath for that.) */
- const char *ssl_private_key_filepath;
- /**< VHOST: filepath to private key if wanting SSL mode;
- * if this is set to NULL but ssl_cert_filepath is set, the
- * OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY callback is called
- * to allow setting of the private key directly via openSSL
- * library calls. (For backwards compatibility, this can also be used
- * to pass the client cert private key filepath when setting up a
- * vhost client SSL context, but it is preferred to use
- * .client_ssl_private_key_filepath for that.) */
- const char *ssl_ca_filepath;
- /**< VHOST: CA certificate filepath or NULL. (For backwards
- * compatibility, this can also be used to pass the client CA
- * filepath when setting up a vhost client SSL context,
- * but it is preferred to use .client_ssl_ca_filepath for that.) */
- const char *ssl_cipher_list;
- /**< VHOST: List of valid ciphers to use ON TLS1.2 AND LOWER ONLY (eg,
- * "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL"
- * or you can leave it as NULL to get "DEFAULT" (For backwards
- * compatibility, this can also be used to pass the client cipher
- * list when setting up a vhost client SSL context,
- * but it is preferred to use .client_ssl_cipher_list for that.)
- * SEE .tls1_3_plus_cipher_list and .client_tls_1_3_plus_cipher_list
- * for the equivalent for tls1.3.
- */
- const char *http_proxy_address;
- /**< VHOST: If non-NULL, attempts to proxy via the given address.
- * If proxy auth is required, use format
- * "username:password\@server:port" */
- unsigned int http_proxy_port;
- /**< VHOST: If http_proxy_address was non-NULL, uses this port */
- int gid;
- /**< CONTEXT: group id to change to after setting listen socket,
- * or -1. */
- int uid;
- /**< CONTEXT: user id to change to after setting listen socket,
- * or -1. */
- unsigned int options;
- /**< VHOST + CONTEXT: 0, or LWS_SERVER_OPTION_... bitfields */
- void *user;
- /**< VHOST + CONTEXT: optional user pointer that will be associated
- * with the context when creating the context (and can be retrieved by
- * lws_context_user(context), or with the vhost when creating the vhost
- * (and can be retrieved by lws_vhost_user(vhost)). You will need to
- * use LWS_SERVER_OPTION_EXPLICIT_VHOSTS and create the vhost separately
- * if you care about giving the context and vhost different user pointer
- * values.
- */
- int ka_time;
- /**< CONTEXT: 0 for no TCP keepalive, otherwise apply this keepalive
- * timeout to all libwebsocket sockets, client or server */
- int ka_probes;
- /**< CONTEXT: if ka_time was nonzero, after the timeout expires how many
- * times to try to get a response from the peer before giving up
- * and killing the connection */
- int ka_interval;
- /**< CONTEXT: if ka_time was nonzero, how long to wait before each ka_probes
- * attempt */
-#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
- SSL_CTX *provided_client_ssl_ctx;
- /**< CONTEXT: If non-null, swap out libwebsockets ssl
- * implementation for the one provided by provided_ssl_ctx.
- * Libwebsockets no longer is responsible for freeing the context
- * if this option is selected. */
-#else /* maintain structure layout either way */
- void *provided_client_ssl_ctx; /**< dummy if ssl disabled */
-#endif
-
- unsigned short max_http_header_data;
- /**< CONTEXT: The max amount of header payload that can be handled
- * in an http request (unrecognized header payload is dropped) */
- unsigned short max_http_header_pool;
- /**< CONTEXT: The max number of connections with http headers that
- * can be processed simultaneously (the corresponding memory is
- * allocated and deallocated dynamically as needed). If the pool is
- * fully busy new incoming connections must wait for accept until one
- * becomes free. 0 = allow as many ah as number of availble fds for
- * the process */
-
- unsigned int count_threads;
- /**< CONTEXT: how many contexts to create in an array, 0 = 1 */
- unsigned int fd_limit_per_thread;
- /**< CONTEXT: nonzero means restrict each service thread to this
- * many fds, 0 means the default which is divide the process fd
- * limit by the number of threads. */
- unsigned int timeout_secs;
- /**< VHOST: various processes involving network roundtrips in the
- * library are protected from hanging forever by timeouts. If
- * nonzero, this member lets you set the timeout used in seconds.
- * Otherwise a default timeout is used. */
- const char *ecdh_curve;
- /**< VHOST: if NULL, defaults to initializing server with
- * "prime256v1" */
- const char *vhost_name;
- /**< VHOST: name of vhost, must match external DNS name used to
- * access the site, like "warmcat.com" as it's used to match
- * Host: header and / or SNI name for SSL. */
- const char * const *plugin_dirs;
- /**< CONTEXT: NULL, or NULL-terminated array of directories to
- * scan for lws protocol plugins at context creation time */
- const struct lws_protocol_vhost_options *pvo;
- /**< VHOST: pointer to optional linked list of per-vhost
- * options made accessible to protocols */
- int keepalive_timeout;
- /**< VHOST: (default = 0 = 5s) seconds to allow remote
- * client to hold on to an idle HTTP/1.1 connection */
- const char *log_filepath;
- /**< VHOST: filepath to append logs to... this is opened before
- * any dropping of initial privileges */
- const struct lws_http_mount *mounts;
- /**< VHOST: optional linked list of mounts for this vhost */
- const char *server_string;
- /**< CONTEXT: string used in HTTP headers to identify server
- * software, if NULL, "libwebsockets". */
- unsigned int pt_serv_buf_size;
- /**< CONTEXT: 0 = default of 4096. This buffer is used by
- * various service related features including file serving, it
- * defines the max chunk of file that can be sent at once.
- * At the risk of lws having to buffer failed large sends, it
- * can be increased to, eg, 128KiB to improve throughput. */
- unsigned int max_http_header_data2;
- /**< CONTEXT: if max_http_header_data is 0 and this
- * is nonzero, this will be used in place of the default. It's
- * like this for compatibility with the original short version,
- * this is unsigned int length. */
- long ssl_options_set;
- /**< VHOST: Any bits set here will be set as server SSL options */
- long ssl_options_clear;
- /**< VHOST: Any bits set here will be cleared as server SSL options */
- unsigned short ws_ping_pong_interval;
- /**< CONTEXT: 0 for none, else interval in seconds between sending
- * PINGs on idle websocket connections. When the PING is sent,
- * the PONG must come within the normal timeout_secs timeout period
- * or the connection will be dropped.
- * Any RX or TX traffic on the connection restarts the interval timer,
- * so a connection which always sends or receives something at intervals
- * less than the interval given here will never send PINGs / expect
- * PONGs. Conversely as soon as the ws connection is established, an
- * idle connection will do the PING / PONG roundtrip as soon as
- * ws_ping_pong_interval seconds has passed without traffic
- */
- const struct lws_protocol_vhost_options *headers;
- /**< VHOST: pointer to optional linked list of per-vhost
- * canned headers that are added to server responses */
-
- const struct lws_protocol_vhost_options *reject_service_keywords;
- /**< CONTEXT: Optional list of keywords and rejection codes + text.
- *
- * The keywords are checked for existing in the user agent string.
- *
- * Eg, "badrobot" "404 Not Found"
- */
- void *external_baggage_free_on_destroy;
- /**< CONTEXT: NULL, or pointer to something externally malloc'd, that
- * should be freed when the context is destroyed. This allows you to
- * automatically sync the freeing action to the context destruction
- * action, so there is no need for an external free() if the context
- * succeeded to create.
- */
-
- const char *client_ssl_private_key_password;
- /**< VHOST: Client SSL context init: NULL or the passphrase needed
- * for the private key */
- const char *client_ssl_cert_filepath;
- /**< VHOST: Client SSL context init:T he certificate the client
- * should present to the peer on connection */
- const char *client_ssl_private_key_filepath;
- /**< VHOST: Client SSL context init: filepath to client private key
- * if this is set to NULL but client_ssl_cert_filepath is set, you
- * can handle the LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS
- * callback of protocols[0] to allow setting of the private key directly
- * via openSSL library calls */
- const char *client_ssl_ca_filepath;
- /**< VHOST: Client SSL context init: CA certificate filepath or NULL */
- const void *client_ssl_ca_mem;
- /**< VHOST: Client SSL context init: CA certificate memory buffer or
- * NULL... use this to load CA cert from memory instead of file */
- unsigned int client_ssl_ca_mem_len;
- /**< VHOST: Client SSL context init: length of client_ssl_ca_mem in
- * bytes */
-
- const char *client_ssl_cipher_list;
- /**< VHOST: Client SSL context init: List of valid ciphers to use (eg,
- * "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL"
- * or you can leave it as NULL to get "DEFAULT" */
-
- const struct lws_plat_file_ops *fops;
- /**< CONTEXT: NULL, or pointer to an array of fops structs, terminated
- * by a sentinel with NULL .open.
- *
- * If NULL, lws provides just the platform file operations struct for
- * backwards compatibility.
- */
- int simultaneous_ssl_restriction;
- /**< CONTEXT: 0 (no limit) or limit of simultaneous SSL sessions
- * possible.*/
- const char *socks_proxy_address;
- /**< VHOST: If non-NULL, attempts to proxy via the given address.
- * If proxy auth is required, use format
- * "username:password\@server:port" */
- unsigned int socks_proxy_port;
- /**< VHOST: If socks_proxy_address was non-NULL, uses this port */
-#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
- cap_value_t caps[4];
- /**< CONTEXT: array holding Linux capabilities you want to
- * continue to be available to the server after it transitions
- * to a noprivileged user. Usually none are needed but for, eg,
- * .bind_iface, CAP_NET_RAW is required. This gives you a way
- * to still have the capability but drop root.
- */
- char count_caps;
- /**< CONTEXT: count of Linux capabilities in .caps[]. 0 means
- * no capabilities will be inherited from root (the default) */
-#endif
- int bind_iface;
- /**< VHOST: nonzero to strictly bind sockets to the interface name in
- * .iface (eg, "eth2"), using SO_BIND_TO_DEVICE.
- *
- * Requires SO_BINDTODEVICE support from your OS and CAP_NET_RAW
- * capability.
- *
- * Notice that common things like access network interface IP from
- * your local machine use your lo / loopback interface and will be
- * disallowed by this.
- */
- int ssl_info_event_mask;
- /**< VHOST: mask of ssl events to be reported on LWS_CALLBACK_SSL_INFO
- * callback for connections on this vhost. The mask values are of
- * the form SSL_CB_ALERT, defined in openssl/ssl.h. The default of
- * 0 means no info events will be reported.
- */
- unsigned int timeout_secs_ah_idle;
- /**< VHOST: seconds to allow a client to hold an ah without using it.
- * 0 defaults to 10s. */
- unsigned short ip_limit_ah;
- /**< CONTEXT: max number of ah a single IP may use simultaneously
- * 0 is no limit. This is a soft limit: if the limit is
- * reached, connections from that IP will wait in the ah
- * waiting list and not be able to acquire an ah until
- * a connection belonging to the IP relinquishes one it
- * already has.
- */
- unsigned short ip_limit_wsi;
- /**< CONTEXT: max number of wsi a single IP may use simultaneously.
- * 0 is no limit. This is a hard limit, connections from
- * the same IP will simply be dropped once it acquires the
- * amount of simultaneous wsi / accepted connections
- * given here.
- */
- uint32_t http2_settings[7];
- /**< VHOST: if http2_settings[0] is nonzero, the values given in
- * http2_settings[1]..[6] are used instead of the lws
- * platform default values.
- * Just leave all at 0 if you don't care.
- */
- const char *error_document_404;
- /**< VHOST: If non-NULL, when asked to serve a non-existent file,
- * lws attempts to server this url path instead. Eg,
- * "/404.html" */
- const char *alpn;
- /**< CONTEXT: If non-NULL, default list of advertised alpn, comma-
- * separated
- *
- * VHOST: If non-NULL, per-vhost list of advertised alpn, comma-
- * separated
- */
- void **foreign_loops;
- /**< CONTEXT: This is ignored if the context is not being started with
- * an event loop, ie, .options has a flag like
- * LWS_SERVER_OPTION_LIBUV.
- *
- * NULL indicates lws should start its own even loop for
- * each service thread, and deal with closing the loops
- * when the context is destroyed.
- *
- * Non-NULL means it points to an array of external
- * ("foreign") event loops that are to be used in turn for
- * each service thread. In the default case of 1 service
- * thread, it can just point to one foreign event loop.
- */
- void (*signal_cb)(void *event_lib_handle, int signum);
- /**< CONTEXT: NULL: default signal handling. Otherwise this receives
- * the signal handler callback. event_lib_handle is the
- * native event library signal handle, eg uv_signal_t *
- * for libuv.
- */
- struct lws_context **pcontext;
- /**< CONTEXT: if non-NULL, at the end of context destroy processing,
- * the pointer pointed to by pcontext is written with NULL. You can
- * use this to let foreign event loops know that lws context destruction
- * is fully completed.
- */
- void (*finalize)(struct lws_vhost *vh, void *arg);
- /**< VHOST: NULL, or pointer to function that will be called back
- * when the vhost is just about to be freed. The arg parameter
- * will be set to whatever finalize_arg is below.
- */
- void *finalize_arg;
- /**< VHOST: opaque pointer lws ignores but passes to the finalize
- * callback. If you don't care, leave it NULL.
- */
- unsigned int max_http_header_pool2;
- /**< CONTEXT: if max_http_header_pool is 0 and this
- * is nonzero, this will be used in place of the default. It's
- * like this for compatibility with the original short version:
- * this is unsigned int length. */
-
- long ssl_client_options_set;
- /**< VHOST: Any bits set here will be set as CLIENT SSL options */
- long ssl_client_options_clear;
- /**< VHOST: Any bits set here will be cleared as CLIENT SSL options */
-
- const char *tls1_3_plus_cipher_list;
- /**< VHOST: List of valid ciphers to use for incoming server connections
- * ON TLS1.3 AND ABOVE (eg, "TLS_CHACHA20_POLY1305_SHA256" on this vhost
- * or you can leave it as NULL to get "DEFAULT".
- * SEE .client_tls_1_3_plus_cipher_list to do the same on the vhost
- * client SSL_CTX.
- */
- const char *client_tls_1_3_plus_cipher_list;
- /**< VHOST: List of valid ciphers to use for outgoing client connections
- * ON TLS1.3 AND ABOVE on this vhost (eg,
- * "TLS_CHACHA20_POLY1305_SHA256") or you can leave it as NULL to get
- * "DEFAULT".
- */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility
- *
- * The below is to ensure later library versions with new
- * members added above will see 0 (default) even if the app
- * was not built against the newer headers.
- */
-
- void *_unused[4]; /**< dummy */
-};
-
-/**
- * lws_create_context() - Create the websocket handler
- * \param info: pointer to struct with parameters
- *
- * This function creates the listening socket (if serving) and takes care
- * of all initialization in one step.
- *
- * If option LWS_SERVER_OPTION_EXPLICIT_VHOSTS is given, no vhost is
- * created; you're expected to create your own vhosts afterwards using
- * lws_create_vhost(). Otherwise a vhost named "default" is also created
- * using the information in the vhost-related members, for compatibility.
- *
- * After initialization, it returns a struct lws_context * that
- * represents this server. After calling, user code needs to take care
- * of calling lws_service() with the context pointer to get the
- * server's sockets serviced. This must be done in the same process
- * context as the initialization call.
- *
- * The protocol callback functions are called for a handful of events
- * including http requests coming in, websocket connections becoming
- * established, and data arriving; it's also called periodically to allow
- * async transmission.
- *
- * HTTP requests are sent always to the FIRST protocol in protocol, since
- * at that time websocket protocol has not been negotiated. Other
- * protocols after the first one never see any HTTP callback activity.
- *
- * The server created is a simple http server by default; part of the
- * websocket standard is upgrading this http connection to a websocket one.
- *
- * This allows the same server to provide files like scripts and favicon /
- * images or whatever over http and dynamic data over websockets all in
- * one place; they're all handled in the user callback.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_context *
-lws_create_context(const struct lws_context_creation_info *info);
-
-
-/**
- * lws_context_destroy() - Destroy the websocket context
- * \param context: Websocket context
- *
- * This function closes any active connections and then frees the
- * context. After calling this, any further use of the context is
- * undefined.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_context_destroy(struct lws_context *context);
-
-typedef int (*lws_reload_func)(void);
-
-/**
- * lws_context_deprecate() - Deprecate the websocket context
- *
- * \param context: Websocket context
- * \param cb: Callback notified when old context listen sockets are closed
- *
- * This function is used on an existing context before superceding it
- * with a new context.
- *
- * It closes any listen sockets in the context, so new connections are
- * not possible.
- *
- * And it marks the context to be deleted when the number of active
- * connections into it falls to zero.
- *
- * This is aimed at allowing seamless configuration reloads.
- *
- * The callback cb will be called after the listen sockets are actually
- * closed and may be reopened. In the callback the new context should be
- * configured and created. (With libuv, socket close happens async after
- * more loop events).
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_context_deprecate(struct lws_context *context, lws_reload_func cb);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_context_is_deprecated(struct lws_context *context);
-
-/**
- * lws_set_proxy() - Setups proxy to lws_context.
- * \param vhost: pointer to struct lws_vhost you want set proxy for
- * \param proxy: pointer to c string containing proxy in format address:port
- *
- * Returns 0 if proxy string was parsed and proxy was setup.
- * Returns -1 if proxy is NULL or has incorrect format.
- *
- * This is only required if your OS does not provide the http_proxy
- * environment variable (eg, OSX)
- *
- * IMPORTANT! You should call this function right after creation of the
- * lws_context and before call to connect. If you call this
- * function after connect behavior is undefined.
- * This function will override proxy settings made on lws_context
- * creation with genenv() call.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_set_proxy(struct lws_vhost *vhost, const char *proxy);
-
-/**
- * lws_set_socks() - Setup socks to lws_context.
- * \param vhost: pointer to struct lws_vhost you want set socks for
- * \param socks: pointer to c string containing socks in format address:port
- *
- * Returns 0 if socks string was parsed and socks was setup.
- * Returns -1 if socks is NULL or has incorrect format.
- *
- * This is only required if your OS does not provide the socks_proxy
- * environment variable (eg, OSX)
- *
- * IMPORTANT! You should call this function right after creation of the
- * lws_context and before call to connect. If you call this
- * function after connect behavior is undefined.
- * This function will override proxy settings made on lws_context
- * creation with genenv() call.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_set_socks(struct lws_vhost *vhost, const char *socks);
-
-struct lws_vhost;
-
-/**
- * lws_create_vhost() - Create a vhost (virtual server context)
- * \param context: pointer to result of lws_create_context()
- * \param info: pointer to struct with parameters
- *
- * This function creates a virtual server (vhost) using the vhost-related
- * members of the info struct. You can create many vhosts inside one context
- * if you created the context with the option LWS_SERVER_OPTION_EXPLICIT_VHOSTS
- */
-LWS_VISIBLE LWS_EXTERN struct lws_vhost *
-lws_create_vhost(struct lws_context *context,
- const struct lws_context_creation_info *info);
-
-/**
- * lws_vhost_destroy() - Destroy a vhost (virtual server context)
- *
- * \param vh: pointer to result of lws_create_vhost()
- *
- * This function destroys a vhost. Normally, if you just want to exit,
- * then lws_destroy_context() will take care of everything. If you want
- * to destroy an individual vhost and all connections and allocations, you
- * can do it with this.
- *
- * If the vhost has a listen sockets shared by other vhosts, it will be given
- * to one of the vhosts sharing it rather than closed.
- *
- * The vhost close is staged according to the needs of the event loop, and if
- * there are multiple service threads. At the point the vhost itself if
- * about to be freed, if you provided a finalize callback and optional arg at
- * vhost creation time, it will be called just before the vhost is freed.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_vhost_destroy(struct lws_vhost *vh);
-
-/**
- * lwsws_get_config_globals() - Parse a JSON server config file
- * \param info: pointer to struct with parameters
- * \param d: filepath of the config file
- * \param config_strings: storage for the config strings extracted from JSON,
- * the pointer is incremented as strings are stored
- * \param len: pointer to the remaining length left in config_strings
- * the value is decremented as strings are stored
- *
- * This function prepares a n lws_context_creation_info struct with global
- * settings from a file d.
- *
- * Requires CMake option LWS_WITH_LEJP_CONF to have been enabled
- */
-LWS_VISIBLE LWS_EXTERN int
-lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d,
- char **config_strings, int *len);
-
-/**
- * lwsws_get_config_vhosts() - Create vhosts from a JSON server config file
- * \param context: pointer to result of lws_create_context()
- * \param info: pointer to struct with parameters
- * \param d: filepath of the config file
- * \param config_strings: storage for the config strings extracted from JSON,
- * the pointer is incremented as strings are stored
- * \param len: pointer to the remaining length left in config_strings
- * the value is decremented as strings are stored
- *
- * This function creates vhosts into a context according to the settings in
- *JSON files found in directory d.
- *
- * Requires CMake option LWS_WITH_LEJP_CONF to have been enabled
- */
-LWS_VISIBLE LWS_EXTERN int
-lwsws_get_config_vhosts(struct lws_context *context,
- struct lws_context_creation_info *info, const char *d,
- char **config_strings, int *len);
-
-/** lws_vhost_get() - \deprecated deprecated: use lws_get_vhost() */
-LWS_VISIBLE LWS_EXTERN struct lws_vhost *
-lws_vhost_get(struct lws *wsi) LWS_WARN_DEPRECATED;
-
-/**
- * lws_get_vhost() - return the vhost a wsi belongs to
- *
- * \param wsi: which connection
- */
-LWS_VISIBLE LWS_EXTERN struct lws_vhost *
-lws_get_vhost(struct lws *wsi);
-
-/**
- * lws_get_vhost_name() - returns the name of a vhost
- *
- * \param vhost: which vhost
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_get_vhost_name(struct lws_vhost *vhost);
-
-/**
- * lws_get_vhost_port() - returns the port a vhost listens on, or -1
- *
- * \param vhost: which vhost
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_get_vhost_port(struct lws_vhost *vhost);
-
-/**
- * lws_get_vhost_user() - returns the user pointer for the vhost
- *
- * \param vhost: which vhost
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_get_vhost_user(struct lws_vhost *vhost);
-
-/**
- * lws_get_vhost_iface() - returns the binding for the vhost listen socket
- *
- * \param vhost: which vhost
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_get_vhost_iface(struct lws_vhost *vhost);
-
-/**
- * lws_json_dump_vhost() - describe vhost state and stats in JSON
- *
- * \param vh: the vhost
- * \param buf: buffer to fill with JSON
- * \param len: max length of buf
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len);
-
-/**
- * lws_json_dump_context() - describe context state and stats in JSON
- *
- * \param context: the context
- * \param buf: buffer to fill with JSON
- * \param len: max length of buf
- * \param hide_vhosts: nonzero to not provide per-vhost mount etc information
- *
- * Generates a JSON description of vhost state into buf
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_json_dump_context(const struct lws_context *context, char *buf, int len,
- int hide_vhosts);
-
-/**
- * lws_vhost_user() - get the user data associated with the vhost
- * \param vhost: Websocket vhost
- *
- * This returns the optional user pointer that can be attached to
- * a vhost when it was created. Lws never dereferences this pointer, it only
- * sets it when the vhost is created, and returns it using this api.
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_vhost_user(struct lws_vhost *vhost);
-
-/**
- * lws_context_user() - get the user data associated with the context
- * \param context: Websocket context
- *
- * This returns the optional user allocation that can be attached to
- * the context the sockets live in at context_create time. It's a way
- * to let all sockets serviced in the same context share data without
- * using globals statics in the user code.
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_context_user(struct lws_context *context);
-
-/*! \defgroup vhost-mounts Vhost mounts and options
- * \ingroup context-and-vhost-creation
- *
- * ##Vhost mounts and options
- */
-///@{
-/** struct lws_protocol_vhost_options - linked list of per-vhost protocol
- * name=value options
- *
- * This provides a general way to attach a linked-list of name=value pairs,
- * which can also have an optional child link-list using the options member.
- */
-struct lws_protocol_vhost_options {
- const struct lws_protocol_vhost_options *next; /**< linked list */
- const struct lws_protocol_vhost_options *options; /**< child linked-list of more options for this node */
- const char *name; /**< name of name=value pair */
- const char *value; /**< value of name=value pair */
-};
-
-/** enum lws_mount_protocols
- * This specifies the mount protocol for a mountpoint, whether it is to be
- * served from a filesystem, or it is a cgi etc.
- */
-enum lws_mount_protocols {
- LWSMPRO_HTTP = 0, /**< http reverse proxy */
- LWSMPRO_HTTPS = 1, /**< https reverse proxy */
- LWSMPRO_FILE = 2, /**< serve from filesystem directory */
- LWSMPRO_CGI = 3, /**< pass to CGI to handle */
- LWSMPRO_REDIR_HTTP = 4, /**< redirect to http:// url */
- LWSMPRO_REDIR_HTTPS = 5, /**< redirect to https:// url */
- LWSMPRO_CALLBACK = 6, /**< hand by named protocol's callback */
-};
-
-/** struct lws_http_mount
- *
- * arguments for mounting something in a vhost's url namespace
- */
-struct lws_http_mount {
- const struct lws_http_mount *mount_next;
- /**< pointer to next struct lws_http_mount */
- const char *mountpoint;
- /**< mountpoint in http pathspace, eg, "/" */
- const char *origin;
- /**< path to be mounted, eg, "/var/www/warmcat.com" */
- const char *def;
- /**< default target, eg, "index.html" */
- const char *protocol;
- /**<"protocol-name" to handle mount */
-
- const struct lws_protocol_vhost_options *cgienv;
- /**< optional linked-list of cgi options. These are created
- * as environment variables for the cgi process
- */
- const struct lws_protocol_vhost_options *extra_mimetypes;
- /**< optional linked-list of mimetype mappings */
- const struct lws_protocol_vhost_options *interpret;
- /**< optional linked-list of files to be interpreted */
-
- int cgi_timeout;
- /**< seconds cgi is allowed to live, if cgi://mount type */
- int cache_max_age;
- /**< max-age for reuse of client cache of files, seconds */
- unsigned int auth_mask;
- /**< bits set here must be set for authorized client session */
-
- unsigned int cache_reusable:1; /**< set if client cache may reuse this */
- unsigned int cache_revalidate:1; /**< set if client cache should revalidate on use */
- unsigned int cache_intermediaries:1; /**< set if intermediaries are allowed to cache */
-
- unsigned char origin_protocol; /**< one of enum lws_mount_protocols */
- unsigned char mountpoint_len; /**< length of mountpoint string */
-
- const char *basic_auth_login_file;
- /**<NULL, or filepath to use to check basic auth logins against */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility
- *
- * The below is to ensure later library versions with new
- * members added above will see 0 (default) even if the app
- * was not built against the newer headers.
- */
-
- void *_unused[2]; /**< dummy */
-};
-
-///@}
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-dbus.h b/thirdparty/libwebsockets/include/libwebsockets/lws-dbus.h
deleted file mode 100644
index 63cfd15f18..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-dbus.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * must be included manually as
- *
- * #include <libwebsockets/lws-dbus.h>
- *
- * if dbus apis needed
- */
-
-#if !defined(__LWS_DBUS_H__)
-#define __LWS_DBUS_H__
-
-#include <dbus/dbus.h>
-
-/* helper type to simplify implementing methods as individual functions */
-typedef DBusHandlerResult (*lws_dbus_message_handler)(DBusConnection *conn,
- DBusMessage *message, DBusMessage **reply, void *d);
-
-struct lws_dbus_ctx;
-typedef void (*lws_dbus_closing_t)(struct lws_dbus_ctx *ctx);
-
-struct lws_dbus_ctx {
- struct lws_dll next; /* dbusserver ctx: HEAD of accepted list */
- struct lws_vhost *vh; /* the vhost we logically bind to in lws */
- int tsi; /* the lws thread service index (0 if only one service
- thread as is the default */
- DBusConnection *conn;
- DBusServer *dbs;
- DBusWatch *w[4];
- DBusPendingCall *pc;
-
- char hup;
- char timeouts;
-
- /* cb_closing callback will be called after the connection and this
- * related ctx struct have effectively gone out of scope.
- *
- * The callback should close and clean up the connection and free the
- * ctx.
- */
- lws_dbus_closing_t cb_closing;
-};
-
-/**
- * lws_dbus_connection_setup() - bind dbus connection object to lws event loop
- *
- * \param ctx: additional information about the connection
- * \param conn: the DBusConnection object to bind
- *
- * This configures a DBusConnection object to use lws for watchers and timeout
- * operations.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_dbus_connection_setup(struct lws_dbus_ctx *ctx, DBusConnection *conn,
- lws_dbus_closing_t cb_closing);
-
-/**
- * lws_dbus_server_listen() - bind dbus connection object to lws event loop
- *
- * \param ctx: additional information about the connection
- * \param ads: the DBUS address to listen on, eg, "unix:abstract=mysocket"
- * \param err: a DBusError object to take any extra error information
- * \param new_conn: a callback function to prepare new accepted connections
- *
- * This creates a DBusServer and binds it to the lws event loop, and your
- * callback to accept new connections.
- */
-LWS_VISIBLE LWS_EXTERN DBusServer *
-lws_dbus_server_listen(struct lws_dbus_ctx *ctx, const char *ads,
- DBusError *err, DBusNewConnectionFunction new_conn);
-
-#endif
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-diskcache.h b/thirdparty/libwebsockets/include/libwebsockets/lws-diskcache.h
deleted file mode 100644
index eb63fdd855..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-diskcache.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * libwebsockets - disk cache helpers
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup diskcache LWS disk cache
- * ## Disk cache API
- *
- * Lws provides helper apis useful if you need a disk cache containing hashed
- * files and need to delete files from it on an LRU basis to keep it below some
- * size limit.
- *
- * The API `lws_diskcache_prepare()` deals with creating the cache dir and
- * 256 subdirs, which are used according to the first two chars of the hex
- * hash of the cache file.
- *
- * `lws_diskcache_create()` and `lws_diskcache_destroy()` allocate and free
- * an opaque struct that represents the disk cache.
- *
- * `lws_diskcache_trim()` should be called at eg, 1s intervals to perform the
- * cache dir monitoring and LRU autodelete in the background lazily. It can
- * be done in its own thread or on a timer... it monitors the directories in a
- * stateful way that stats one or more file in the cache per call, and keeps
- * a list of the oldest files as it goes. When it completes a scan, if the
- * aggregate size is over the limit, it will delete oldest files first to try
- * to keep it under the limit.
- *
- * The cache size monitoring is extremely efficient in time and memory even when
- * the cache directory becomes huge.
- *
- * `lws_diskcache_query()` is used to determine if the file already exists in
- * the cache, or if it must be created. If it must be created, then the file
- * is opened using a temp name that must be converted to a findable name with
- * `lws_diskcache_finalize_name()` when the generation of the file contents are
- * complete. Aborted cached files that did not complete generation will be
- * flushed by the LRU eventually. If the file already exists, it is 'touched'
- * to make it new again and the fd returned.
- *
- */
-///@{
-
-struct lws_diskcache_scan;
-
-/**
- * lws_diskcache_create() - creates an opaque struct representing the disk cache
- *
- * \param cache_dir_base: The cache dir path, eg `/var/cache/mycache`
- * \param cache_size_limit: maximum size on disk the cache is allowed to use
- *
- * This returns an opaque `struct lws_diskcache_scan *` which represents the
- * disk cache, the trim scanning state and so on. You should use
- * `lws_diskcache_destroy()` to free it to destroy it.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_diskcache_scan *
-lws_diskcache_create(const char *cache_dir_base, uint64_t cache_size_limit);
-
-/**
- * lws_diskcache_destroy() - destroys the pointer returned by ...create()
- *
- * \param lds: pointer to the pointer returned by lws_diskcache_create()
- *
- * Frees *lds and any allocations it did, and then sets *lds to NULL and
- * returns.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_diskcache_destroy(struct lws_diskcache_scan **lds);
-
-/**
- * lws_diskcache_prepare() - ensures the cache dir structure exists on disk
- *
- * \param cache_base_dir: The cache dir path, eg `/var/cache/mycache`
- * \param mode: octal dir mode to enforce, like 0700
- * \param uid: uid the cache dir should belong to
- *
- * This should be called while your app is still privileged. It will create
- * the cache directory structure on disk as necessary, enforce the given access
- * mode on it and set the given uid as the owner. It won't make any trouble
- * if the cache already exists.
- *
- * Typically the mode is 0700 and the owner is the user that your application
- * will transition to use when it drops root privileges.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_diskcache_prepare(const char *cache_base_dir, int mode, int uid);
-
-#define LWS_DISKCACHE_QUERY_NO_CACHE 0
-#define LWS_DISKCACHE_QUERY_EXISTS 1
-#define LWS_DISKCACHE_QUERY_CREATING 2
-#define LWS_DISKCACHE_QUERY_ONGOING 3 /* something else is creating it */
-
-/**
- * lws_diskcache_query() - ensures the cache dir structure exists on disk
- *
- * \param lds: The opaque struct representing the disk cache
- * \param is_bot: nonzero means the request is from a bot. Don't create new cache contents if so.
- * \param hash_hex: hex string representation of the cache object hash
- * \param _fd: pointer to the fd to be set
- * \param cache: destination string to take the cache filepath
- * \param cache_len: length of the buffer at `cache`
- * \param extant_cache_len: pointer to a size_t to take any extant cached file size
- *
- * This function is called when you want to find if the hashed name already
- * exists in the cache. The possibilities for the return value are
- *
- * - LWS_DISKCACHE_QUERY_NO_CACHE: It's not in the cache and you can't create
- * it in the cache for whatever reason.
- * - LWS_DISKCACHE_QUERY_EXISTS: It exists in the cache. It's open RDONLY and
- * *_fd has been set to the file descriptor. *extant_cache_len has been set
- * to the size of the cached file in bytes. cache has been set to the
- * full filepath of the cached file. Closing _fd is your responsibility.
- * - LWS_DISKCACHE_QUERY_CREATING: It didn't exist, but a temp file has been
- * created in the cache and *_fd set to a file descriptor opened on it RDWR.
- * You should create the contents, and call `lws_diskcache_finalize_name()`
- * when it is done. Closing _fd is your responsibility.
- * - LWS_DISKCACHE_QUERY_ONGOING: not returned by this api, but you may find it
- * desirable to make a wrapper function which can handle another asynchronous
- * process that is already creating the cached file. This can be used to
- * indicate that situation externally... how to determine the same thing is
- * already being generated is out of scope of this api.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_diskcache_query(struct lws_diskcache_scan *lds, int is_bot,
- const char *hash_hex, int *_fd, char *cache, int cache_len,
- size_t *extant_cache_len);
-
-/**
- * lws_diskcache_query() - ensures the cache dir structure exists on disk
- *
- * \param cache: The cache file temp name returned with LWS_DISKCACHE_QUERY_CREATING
- *
- * This renames the cache file you are creating to its final name. It should
- * be called on the temp name returned by `lws_diskcache_query()` if it gave a
- * LWS_DISKCACHE_QUERY_CREATING return, after you have filled the cache file and
- * closed it.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_diskcache_finalize_name(char *cache);
-
-/**
- * lws_diskcache_trim() - performs one or more file checks in the cache for size management
- *
- * \param lds: The opaque object representing the cache
- *
- * This should be called periodically to statefully walk the cache on disk
- * collecting the oldest files. When it has visited every file, if the cache
- * is oversize it will delete the oldest files until it's back under size again.
- *
- * Each time it's called, it will look at one or more dir in the cache. If
- * called when the cache is oversize, it increases the amount of work done each
- * call until it is reduced again. Typically it will take 256 calls before it
- * deletes anything, so if called once per second, it will delete files once
- * every 4 minutes. Each call is very inexpensive both in memory and time.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_diskcache_trim(struct lws_diskcache_scan *lds);
-
-
-/**
- * lws_diskcache_secs_to_idle() - see how long to idle before calling trim
- *
- * \param lds: The opaque object representing the cache
- *
- * If the cache is undersize, there's no need to monitor it immediately. This
- * suggests how long to "sleep" before calling `lws_diskcache_trim()` again.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_diskcache_secs_to_idle(struct lws_diskcache_scan *lds);
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-esp32.h b/thirdparty/libwebsockets/include/libwebsockets/lws-esp32.h
deleted file mode 100644
index 2d1c0f42bb..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-esp32.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-typedef int lws_sockfd_type;
-typedef int lws_filefd_type;
-
-struct pollfd {
- lws_sockfd_type fd; /**< fd related to */
- short events; /**< which POLL... events to respond to */
- short revents; /**< which POLL... events occurred */
-};
-#define POLLIN 0x0001
-#define POLLPRI 0x0002
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-#define POLLHUP 0x0010
-#define POLLNVAL 0x0020
-
-#include <freertos/FreeRTOS.h>
-#include <freertos/event_groups.h>
-#include <string.h>
-#include "esp_wifi.h"
-#include "esp_system.h"
-#include "esp_event.h"
-#include "esp_event_loop.h"
-#include "nvs.h"
-#include "driver/gpio.h"
-#include "esp_spi_flash.h"
-#include "freertos/timers.h"
-
-#if !defined(CONFIG_FREERTOS_HZ)
-#define CONFIG_FREERTOS_HZ 100
-#endif
-
-typedef TimerHandle_t uv_timer_t;
-typedef void uv_cb_t(uv_timer_t *);
-typedef void * uv_handle_t;
-
-struct timer_mapping {
- uv_cb_t *cb;
- uv_timer_t *t;
-};
-
-#define UV_VERSION_MAJOR 1
-
-#define lws_uv_getloop(a, b) (NULL)
-
-static LWS_INLINE void uv_timer_init(void *l, uv_timer_t *t)
-{
- (void)l;
- *t = NULL;
-}
-
-extern void esp32_uvtimer_cb(TimerHandle_t t);
-
-static LWS_INLINE void uv_timer_start(uv_timer_t *t, uv_cb_t *cb, int first, int rep)
-{
- struct timer_mapping *tm = (struct timer_mapping *)malloc(sizeof(*tm));
-
- if (!tm)
- return;
-
- tm->t = t;
- tm->cb = cb;
-
- *t = xTimerCreate("x", pdMS_TO_TICKS(first), !!rep, tm,
- (TimerCallbackFunction_t)esp32_uvtimer_cb);
- xTimerStart(*t, 0);
-}
-
-static LWS_INLINE void uv_timer_stop(uv_timer_t *t)
-{
- xTimerStop(*t, 0);
-}
-
-static LWS_INLINE void uv_close(uv_handle_t *h, void *v)
-{
- free(pvTimerGetTimerID((uv_timer_t)h));
- xTimerDelete(*(uv_timer_t *)h, 0);
-}
-
-/* ESP32 helper declarations */
-
-#include <mdns.h>
-#include <esp_partition.h>
-
-#define LWS_PLUGIN_STATIC
-#define LWS_MAGIC_REBOOT_TYPE_ADS 0x50001ffc
-#define LWS_MAGIC_REBOOT_TYPE_REQ_FACTORY 0xb00bcafe
-#define LWS_MAGIC_REBOOT_TYPE_FORCED_FACTORY 0xfaceb00b
-#define LWS_MAGIC_REBOOT_TYPE_FORCED_FACTORY_BUTTON 0xf0cedfac
-#define LWS_MAGIC_REBOOT_TYPE_REQ_FACTORY_ERASE_OTA 0xfac0eeee
-
-/* user code provides these */
-
-extern void
-lws_esp32_identify_physical_device(void);
-
-/* lws-plat-esp32 provides these */
-
-typedef void (*lws_cb_scan_done)(uint16_t count, wifi_ap_record_t *recs, void *arg);
-
-enum genled_state {
- LWSESP32_GENLED__INIT,
- LWSESP32_GENLED__LOST_NETWORK,
- LWSESP32_GENLED__NO_NETWORK,
- LWSESP32_GENLED__CONN_AP,
- LWSESP32_GENLED__GOT_IP,
- LWSESP32_GENLED__OK,
-};
-
-struct lws_group_member {
- struct lws_group_member *next;
- uint64_t last_seen;
- char model[16];
- char role[16];
- char host[32];
- char mac[20];
- int width, height;
- struct ip4_addr addr;
- struct ip6_addr addrv6;
- uint8_t flags;
-};
-
-#define LWS_SYSTEM_GROUP_MEMBER_ADD 1
-#define LWS_SYSTEM_GROUP_MEMBER_CHANGE 2
-#define LWS_SYSTEM_GROUP_MEMBER_REMOVE 3
-
-#define LWS_GROUP_FLAG_SELF 1
-
-struct lws_esp32 {
- char sta_ip[16];
- char sta_mask[16];
- char sta_gw[16];
- char serial[16];
- char opts[16];
- char model[16];
- char group[16];
- char role[16];
- char ssid[4][64];
- char password[4][64];
- char active_ssid[64];
- char access_pw[16];
- char hostname[32];
- char mac[20];
- char le_dns[64];
- char le_email[64];
- char region;
- char inet;
- char conn_ap;
-
- enum genled_state genled;
- uint64_t genled_t;
-
- lws_cb_scan_done scan_consumer;
- void *scan_consumer_arg;
- struct lws_group_member *first;
- int extant_group_members;
-
- char acme;
- char upload;
-
- volatile char button_is_down;
-};
-
-struct lws_esp32_image {
- uint32_t romfs;
- uint32_t romfs_len;
- uint32_t json;
- uint32_t json_len;
-};
-
-extern struct lws_esp32 lws_esp32;
-struct lws_vhost;
-
-extern esp_err_t
-lws_esp32_event_passthru(void *ctx, system_event_t *event);
-extern void
-lws_esp32_wlan_config(void);
-extern void
-lws_esp32_wlan_start_ap(void);
-extern void
-lws_esp32_wlan_start_station(void);
-struct lws_context_creation_info;
-extern void
-lws_esp32_set_creation_defaults(struct lws_context_creation_info *info);
-extern struct lws_context *
-lws_esp32_init(struct lws_context_creation_info *, struct lws_vhost **pvh);
-extern int
-lws_esp32_wlan_nvs_get(int retry);
-extern esp_err_t
-lws_nvs_set_str(nvs_handle handle, const char* key, const char* value);
-extern void
-lws_esp32_restart_guided(uint32_t type);
-extern const esp_partition_t *
-lws_esp_ota_get_boot_partition(void);
-extern int
-lws_esp32_get_image_info(const esp_partition_t *part, struct lws_esp32_image *i, char *json, int json_len);
-extern int
-lws_esp32_leds_network_indication(void);
-
-extern uint32_t lws_esp32_get_reboot_type(void);
-extern uint16_t lws_esp32_sine_interp(int n);
-
-/* required in external code by esp32 plat (may just return if no leds) */
-extern void lws_esp32_leds_timer_cb(TimerHandle_t th);
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-fts.h b/thirdparty/libwebsockets/include/libwebsockets/lws-fts.h
deleted file mode 100644
index 29405bd6fd..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-fts.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * libwebsockets - fulltext search
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup search Search
- *
- * ##Full-text search
- *
- * Lws provides superfast indexing and fulltext searching from index files on
- * storage.
- */
-///@{
-
-struct lws_fts;
-struct lws_fts_file;
-
-/*
- * Queries produce their results in an lwsac, using these public API types.
- * The first thing in the lwsac is always a struct lws_fts_result (see below)
- * containing heads for linked-lists of the other result types.
- */
-
-/* one filepath's results */
-
-struct lws_fts_result_filepath {
- struct lws_fts_result_filepath *next;
- int matches; /* logical number of matches */
- int matches_length; /* bytes in length table (may be zero) */
- int lines_in_file;
- int filepath_length;
-
- /* - uint32_t line table follows (first for alignment) */
- /* - filepath (of filepath_length) follows */
-};
-
-/* autocomplete result */
-
-struct lws_fts_result_autocomplete {
- struct lws_fts_result_autocomplete *next;
- int instances;
- int agg_instances;
- int ac_length;
- char elided; /* children skipped in interest of antecedent children */
- char has_children;
-
- /* - autocomplete suggestion (of length ac_length) follows */
-};
-
-/*
- * The results lwsac always starts with this. If no results and / or no
- * autocomplete the members may be NULL. This implies the symbol nor any
- * suffix on it exists in the trie file.
- */
-struct lws_fts_result {
- struct lws_fts_result_filepath *filepath_head;
- struct lws_fts_result_autocomplete *autocomplete_head;
- int duration_ms;
- int effective_flags; /* the search flags that were used */
-};
-
-/*
- * index creation functions
- */
-
-/**
- * lws_fts_create() - Create a new index file
- *
- * \param fd: The fd opened for write
- *
- * Inits a new index file, returning a struct lws_fts to represent it
- */
-LWS_VISIBLE LWS_EXTERN struct lws_fts *
-lws_fts_create(int fd);
-
-/**
- * lws_fts_destroy() - Finalize a new index file / destroy the trie lwsac
- *
- * \param trie: The previously opened index being finalized
- *
- * Finalizes an index file that was being created, and frees the memory involved
- * *trie is set to NULL afterwards.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_fts_destroy(struct lws_fts **trie);
-
-/**
- * lws_fts_file_index() - Create a new entry in the trie file for an input path
- *
- * \param t: The previously opened index being written
- * \param filepath: The filepath (which may be virtual) associated with this file
- * \param filepath_len: The number of chars in the filepath
- * \param priority: not used yet
- *
- * Returns an ordinal that represents this new filepath in the index file.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_fts_file_index(struct lws_fts *t, const char *filepath, int filepath_len,
- int priority);
-
-/**
- * lws_fts_fill() - Process all or a bufferload of input file
- *
- * \param t: The previously opened index being written
- * \param file_index: The ordinal representing this input filepath
- * \param buf: A bufferload of data from the input file
- * \param len: The number of bytes in buf
- *
- * Indexes a buffer of data from the input file.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_fts_fill(struct lws_fts *t, uint32_t file_index, const char *buf,
- size_t len);
-
-/**
- * lws_fts_serialize() - Store the in-memory trie into the index file
- *
- * \param t: The previously opened index being written
- *
- * The trie is held in memory where it can be added to... after all the input
- * filepaths and data have been processed, this is called to serialize /
- * write the trie data into the index file.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_fts_serialize(struct lws_fts *t);
-
-/*
- * index search functions
- */
-
-/**
- * lws_fts_open() - Open an existing index file to search it
- *
- * \param filepath: The filepath to the index file to open
- *
- * Opening the index file returns an opaque struct lws_fts_file * that is
- * used to perform other operations on it, or NULL if it can't be opened.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_fts_file *
-lws_fts_open(const char *filepath);
-
-#define LWSFTS_F_QUERY_AUTOCOMPLETE (1 << 0)
-#define LWSFTS_F_QUERY_FILES (1 << 1)
-#define LWSFTS_F_QUERY_FILE_LINES (1 << 2)
-#define LWSFTS_F_QUERY_QUOTE_LINE (1 << 3)
-
-struct lws_fts_search_params {
- /* the actual search term */
- const char *needle;
- /* if non-NULL, FILE results for this filepath only */
- const char *only_filepath;
- /* will be set to the results lwsac */
- struct lwsac *results_head;
- /* combination of LWSFTS_F_QUERY_* flags */
- int flags;
- /* maximum number of autocomplete suggestions to return */
- int max_autocomplete;
- /* maximum number of filepaths to return */
- int max_files;
- /* maximum number of line number results to return per filepath */
- int max_lines;
-};
-
-/**
- * lws_fts_search() - Perform a search operation on an index
- *
- * \param jtf: The index file struct returned by lws_fts_open
- * \param ftsp: The struct lws_fts_search_params filled in by the caller
- *
- * The caller should memset the ftsp struct to 0 to ensure members that may be
- * introduced in later versions contain known values, then set the related
- * members to describe the kind of search action required.
- *
- * ftsp->results_head is the results lwsac, or NULL. It should be freed with
- * lwsac_free() when the results are finished with.
- *
- * Returns a pointer into the results lwsac that is a struct lws_fts_result
- * containing the head pointers into linked-lists of results for autocomplete
- * and filepath data, along with some sundry information. This does not need
- * to be freed since freeing the lwsac will also remove this and everything it
- * points to.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_fts_result *
-lws_fts_search(struct lws_fts_file *jtf, struct lws_fts_search_params *ftsp);
-
-/**
- * lws_fts_close() - Close a previously-opened index file
- *
- * \param jtf: The pointer returned from the open
- *
- * Closes the file handle on the index and frees any allocations
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_fts_close(struct lws_fts_file *jtf);
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-genhash.h b/thirdparty/libwebsockets/include/libwebsockets/lws-genhash.h
deleted file mode 100644
index a2e4f8ab6a..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-genhash.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup generic hash
- * ## Generic Hash related functions
- *
- * Lws provides generic hash / digest accessors that abstract the ones
- * provided by whatever OpenSSL library you are linking against.
- *
- * It lets you use the same code if you build against mbedtls or OpenSSL
- * for example.
- */
-///@{
-
-enum lws_genhash_types {
- LWS_GENHASH_TYPE_SHA1,
- LWS_GENHASH_TYPE_SHA256,
- LWS_GENHASH_TYPE_SHA384,
- LWS_GENHASH_TYPE_SHA512,
-};
-
-enum lws_genhmac_types {
- LWS_GENHMAC_TYPE_SHA256,
- LWS_GENHMAC_TYPE_SHA384,
- LWS_GENHMAC_TYPE_SHA512,
-};
-
-#define LWS_GENHASH_LARGEST 64
-
-struct lws_genhash_ctx {
- uint8_t type;
-#if defined(LWS_WITH_MBEDTLS)
- union {
- mbedtls_sha1_context sha1;
- mbedtls_sha256_context sha256;
- mbedtls_sha512_context sha512; /* 384 also uses this */
- const mbedtls_md_info_t *hmac;
- } u;
-#else
- const EVP_MD *evp_type;
- EVP_MD_CTX *mdctx;
-#endif
-};
-
-struct lws_genhmac_ctx {
- uint8_t type;
-#if defined(LWS_WITH_MBEDTLS)
- const mbedtls_md_info_t *hmac;
- mbedtls_md_context_t ctx;
-#else
- const EVP_MD *evp_type;
- EVP_MD_CTX *ctx;
-#endif
-};
-
-/** lws_genhash_size() - get hash size in bytes
- *
- * \param type: one of LWS_GENHASH_TYPE_...
- *
- * Returns number of bytes in this type of hash
- */
-LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT
-lws_genhash_size(enum lws_genhash_types type);
-
-/** lws_genhmac_size() - get hash size in bytes
- *
- * \param type: one of LWS_GENHASH_TYPE_...
- *
- * Returns number of bytes in this type of hmac
- */
-LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT
-lws_genhmac_size(enum lws_genhmac_types type);
-
-/** lws_genhash_init() - prepare your struct lws_genhash_ctx for use
- *
- * \param ctx: your struct lws_genhash_ctx
- * \param type: one of LWS_GENHASH_TYPE_...
- *
- * Initializes the hash context for the type you requested
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_genhash_init(struct lws_genhash_ctx *ctx, enum lws_genhash_types type);
-
-/** lws_genhash_update() - digest len bytes of the buffer starting at in
- *
- * \param ctx: your struct lws_genhash_ctx
- * \param in: start of the bytes to digest
- * \param len: count of bytes to digest
- *
- * Updates the state of your hash context to reflect digesting len bytes from in
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_genhash_update(struct lws_genhash_ctx *ctx, const void *in, size_t len);
-
-/** lws_genhash_destroy() - copy out the result digest and destroy the ctx
- *
- * \param ctx: your struct lws_genhash_ctx
- * \param result: NULL, or where to copy the result hash
- *
- * Finalizes the hash and copies out the digest. Destroys any allocations such
- * that ctx can safely go out of scope after calling this.
- *
- * NULL result is supported so that you can destroy the ctx cleanly on error
- * conditions, where there is no valid result.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genhash_destroy(struct lws_genhash_ctx *ctx, void *result);
-
-/** lws_genhmac_init() - prepare your struct lws_genhmac_ctx for use
- *
- * \param ctx: your struct lws_genhmac_ctx
- * \param type: one of LWS_GENHMAC_TYPE_...
- * \param key: pointer to the start of the HMAC key
- * \param key_len: length of the HMAC key
- *
- * Initializes the hash context for the type you requested
- *
- * If the return is nonzero, it failed and there is nothing needing to be
- * destroyed.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_genhmac_init(struct lws_genhmac_ctx *ctx, enum lws_genhmac_types type,
- const uint8_t *key, size_t key_len);
-
-/** lws_genhmac_update() - digest len bytes of the buffer starting at in
- *
- * \param ctx: your struct lws_genhmac_ctx
- * \param in: start of the bytes to digest
- * \param len: count of bytes to digest
- *
- * Updates the state of your hash context to reflect digesting len bytes from in
- *
- * If the return is nonzero, it failed and needs destroying.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_genhmac_update(struct lws_genhmac_ctx *ctx, const void *in, size_t len);
-
-/** lws_genhmac_destroy() - copy out the result digest and destroy the ctx
- *
- * \param ctx: your struct lws_genhmac_ctx
- * \param result: NULL, or where to copy the result hash
- *
- * Finalizes the hash and copies out the digest. Destroys any allocations such
- * that ctx can safely go out of scope after calling this.
- *
- * NULL result is supported so that you can destroy the ctx cleanly on error
- * conditions, where there is no valid result.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genhmac_destroy(struct lws_genhmac_ctx *ctx, void *result);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-genrsa.h b/thirdparty/libwebsockets/include/libwebsockets/lws-genrsa.h
deleted file mode 100644
index 3e427e2927..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-genrsa.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup generic RSA
- * ## Generic RSA related functions
- *
- * Lws provides generic RSA functions that abstract the ones
- * provided by whatever OpenSSL library you are linking against.
- *
- * It lets you use the same code if you build against mbedtls or OpenSSL
- * for example.
- */
-///@{
-
-enum enum_jwk_tok {
- JWK_KEY_E,
- JWK_KEY_N,
- JWK_KEY_D,
- JWK_KEY_P,
- JWK_KEY_Q,
- JWK_KEY_DP,
- JWK_KEY_DQ,
- JWK_KEY_QI,
- JWK_KTY, /* also serves as count of real elements */
- JWK_KEY,
-};
-
-#define LWS_COUNT_RSA_ELEMENTS JWK_KTY
-
-struct lws_genrsa_ctx {
-#if defined(LWS_WITH_MBEDTLS)
- mbedtls_rsa_context *ctx;
-#else
- BIGNUM *bn[LWS_COUNT_RSA_ELEMENTS];
- RSA *rsa;
-#endif
-};
-
-struct lws_genrsa_element {
- uint8_t *buf;
- uint16_t len;
-};
-
-struct lws_genrsa_elements {
- struct lws_genrsa_element e[LWS_COUNT_RSA_ELEMENTS];
-};
-
-/** lws_jwk_destroy_genrsa_elements() - Free allocations in genrsa_elements
- *
- * \param el: your struct lws_genrsa_elements
- *
- * This is a helper for user code making use of struct lws_genrsa_elements
- * where the elements are allocated on the heap, it frees any non-NULL
- * buf element and sets the buf to NULL.
- *
- * NB: lws_genrsa_public_... apis do not need this as they take care of the key
- * creation and destruction themselves.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_jwk_destroy_genrsa_elements(struct lws_genrsa_elements *el);
-
-/** lws_genrsa_public_decrypt_create() - Create RSA public decrypt context
- *
- * \param ctx: your struct lws_genrsa_ctx
- * \param el: struct prepared with key element data
- *
- * Creates an RSA context with a public key associated with it, formed from
- * the key elements in \p el.
- *
- * Returns 0 for OK or nonzero for error.
- *
- * This and related APIs operate identically with OpenSSL or mbedTLS backends.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genrsa_create(struct lws_genrsa_ctx *ctx, struct lws_genrsa_elements *el);
-
-/** lws_genrsa_new_keypair() - Create new RSA keypair
- *
- * \param context: your struct lws_context (may be used for RNG)
- * \param ctx: your struct lws_genrsa_ctx
- * \param el: struct to get the new key element data allocated into it
- * \param bits: key size, eg, 4096
- *
- * Creates a new RSA context and generates a new keypair into it, with \p bits
- * bits.
- *
- * Returns 0 for OK or nonzero for error.
- *
- * This and related APIs operate identically with OpenSSL or mbedTLS backends.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genrsa_new_keypair(struct lws_context *context, struct lws_genrsa_ctx *ctx,
- struct lws_genrsa_elements *el, int bits);
-
-/** lws_genrsa_public_decrypt() - Perform RSA public decryption
- *
- * \param ctx: your struct lws_genrsa_ctx
- * \param in: encrypted input
- * \param in_len: length of encrypted input
- * \param out: decrypted output
- * \param out_max: size of output buffer
- *
- * Performs the decryption.
- *
- * Returns <0 for error, or length of decrypted data.
- *
- * This and related APIs operate identically with OpenSSL or mbedTLS backends.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genrsa_public_decrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
- size_t in_len, uint8_t *out, size_t out_max);
-
-/** lws_genrsa_public_verify() - Perform RSA public verification
- *
- * \param ctx: your struct lws_genrsa_ctx
- * \param in: unencrypted payload (usually a recomputed hash)
- * \param hash_type: one of LWS_GENHASH_TYPE_
- * \param sig: pointer to the signature we received with the payload
- * \param sig_len: length of the signature we are checking in bytes
- *
- * Returns <0 for error, or 0 if signature matches the payload + key.
- *
- * This and related APIs operate identically with OpenSSL or mbedTLS backends.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genrsa_public_verify(struct lws_genrsa_ctx *ctx, const uint8_t *in,
- enum lws_genhash_types hash_type,
- const uint8_t *sig, size_t sig_len);
-
-/** lws_genrsa_public_sign() - Create RSA signature
- *
- * \param ctx: your struct lws_genrsa_ctx
- * \param in: precomputed hash
- * \param hash_type: one of LWS_GENHASH_TYPE_
- * \param sig: pointer to buffer to take signature
- * \param sig_len: length of the buffer (must be >= length of key N)
- *
- * Returns <0 for error, or 0 for success.
- *
- * This and related APIs operate identically with OpenSSL or mbedTLS backends.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genrsa_public_sign(struct lws_genrsa_ctx *ctx, const uint8_t *in,
- enum lws_genhash_types hash_type, uint8_t *sig,
- size_t sig_len);
-
-/** lws_genrsa_public_decrypt_destroy() - Destroy RSA public decrypt context
- *
- * \param ctx: your struct lws_genrsa_ctx
- *
- * Destroys any allocations related to \p ctx.
- *
- * This and related APIs operate identically with OpenSSL or mbedTLS backends.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_genrsa_destroy(struct lws_genrsa_ctx *ctx);
-
-/** lws_genrsa_render_pkey_asn1() - Exports public or private key to ASN1/DER
- *
- * \param ctx: your struct lws_genrsa_ctx
- * \param _private: 0 = public part only, 1 = all parts of the key
- * \param pkey_asn1: pointer to buffer to take the ASN1
- * \param pkey_asn1_len: max size of the pkey_asn1_len
- *
- * Returns length of pkey_asn1 written, or -1 for error.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_genrsa_render_pkey_asn1(struct lws_genrsa_ctx *ctx, int _private,
- uint8_t *pkey_asn1, size_t pkey_asn1_len);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-http.h b/thirdparty/libwebsockets/include/libwebsockets/lws-http.h
deleted file mode 100644
index eb3d826ebd..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-http.h
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/* minimal space for typical headers and CSP stuff */
-
-#define LWS_RECOMMENDED_MIN_HEADER_SPACE 2048
-
-/*! \defgroup http HTTP
-
- Modules related to handling HTTP
-*/
-//@{
-
-/*! \defgroup httpft HTTP File transfer
- * \ingroup http
-
- APIs for sending local files in response to HTTP requests
-*/
-//@{
-
-/**
- * lws_get_mimetype() - Determine mimetype to use from filename
- *
- * \param file: filename
- * \param m: NULL, or mount context
- *
- * This uses a canned list of known filetypes first, if no match and m is
- * non-NULL, then tries a list of per-mount file suffix to mimtype mappings.
- *
- * Returns either NULL or a pointer to the mimetype matching the file.
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_get_mimetype(const char *file, const struct lws_http_mount *m);
-
-/**
- * lws_serve_http_file() - Send a file back to the client using http
- * \param wsi: Websocket instance (available from user callback)
- * \param file: The file to issue over http
- * \param content_type: The http content type, eg, text/html
- * \param other_headers: NULL or pointer to header string
- * \param other_headers_len: length of the other headers if non-NULL
- *
- * This function is intended to be called from the callback in response
- * to http requests from the client. It allows the callback to issue
- * local files down the http link in a single step.
- *
- * Returning <0 indicates error and the wsi should be closed. Returning
- * >0 indicates the file was completely sent and
- * lws_http_transaction_completed() called on the wsi (and close if != 0)
- * ==0 indicates the file transfer is started and needs more service later,
- * the wsi should be left alone.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
- const char *other_headers, int other_headers_len);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_serve_http_file_fragment(struct lws *wsi);
-//@}
-
-
-enum http_status {
- HTTP_STATUS_CONTINUE = 100,
-
- HTTP_STATUS_OK = 200,
- HTTP_STATUS_NO_CONTENT = 204,
- HTTP_STATUS_PARTIAL_CONTENT = 206,
-
- HTTP_STATUS_MOVED_PERMANENTLY = 301,
- HTTP_STATUS_FOUND = 302,
- HTTP_STATUS_SEE_OTHER = 303,
- HTTP_STATUS_NOT_MODIFIED = 304,
-
- HTTP_STATUS_BAD_REQUEST = 400,
- HTTP_STATUS_UNAUTHORIZED,
- HTTP_STATUS_PAYMENT_REQUIRED,
- HTTP_STATUS_FORBIDDEN,
- HTTP_STATUS_NOT_FOUND,
- HTTP_STATUS_METHOD_NOT_ALLOWED,
- HTTP_STATUS_NOT_ACCEPTABLE,
- HTTP_STATUS_PROXY_AUTH_REQUIRED,
- HTTP_STATUS_REQUEST_TIMEOUT,
- HTTP_STATUS_CONFLICT,
- HTTP_STATUS_GONE,
- HTTP_STATUS_LENGTH_REQUIRED,
- HTTP_STATUS_PRECONDITION_FAILED,
- HTTP_STATUS_REQ_ENTITY_TOO_LARGE,
- HTTP_STATUS_REQ_URI_TOO_LONG,
- HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE,
- HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE,
- HTTP_STATUS_EXPECTATION_FAILED,
-
- HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
- HTTP_STATUS_NOT_IMPLEMENTED,
- HTTP_STATUS_BAD_GATEWAY,
- HTTP_STATUS_SERVICE_UNAVAILABLE,
- HTTP_STATUS_GATEWAY_TIMEOUT,
- HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED,
-};
-/*! \defgroup html-chunked-substitution HTML Chunked Substitution
- * \ingroup http
- *
- * ##HTML chunked Substitution
- *
- * APIs for receiving chunks of text, replacing a set of variable names via
- * a callback, and then prepending and appending HTML chunked encoding
- * headers.
- */
-//@{
-
-struct lws_process_html_args {
- char *p; /**< pointer to the buffer containing the data */
- int len; /**< length of the original data at p */
- int max_len; /**< maximum length we can grow the data to */
- int final; /**< set if this is the last chunk of the file */
- int chunked; /**< 0 == unchunked, 1 == produce chunk headers
- (incompatible with HTTP/2) */
-};
-
-typedef const char *(*lws_process_html_state_cb)(void *data, int index);
-
-struct lws_process_html_state {
- char *start; /**< pointer to start of match */
- char swallow[16]; /**< matched character buffer */
- int pos; /**< position in match */
- void *data; /**< opaque pointer */
- const char * const *vars; /**< list of variable names */
- int count_vars; /**< count of variable names */
-
- lws_process_html_state_cb replace;
- /**< called on match to perform substitution */
-};
-
-/*! lws_chunked_html_process() - generic chunked substitution
- * \param args: buffer to process using chunked encoding
- * \param s: current processing state
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_chunked_html_process(struct lws_process_html_args *args,
- struct lws_process_html_state *s);
-//@}
-
-/** \defgroup HTTP-headers-read HTTP headers: read
- * \ingroup http
- *
- * ##HTTP header releated functions
- *
- * In lws the client http headers are temporarily stored in a pool, only for the
- * duration of the http part of the handshake. It's because in most cases,
- * the header content is ignored for the whole rest of the connection lifetime
- * and would then just be taking up space needlessly.
- *
- * During LWS_CALLBACK_HTTP when the URI path is delivered is the last time
- * the http headers are still allocated, you can use these apis then to
- * look at and copy out interesting header content (cookies, etc)
- *
- * Notice that the header total length reported does not include a terminating
- * '\0', however you must allocate for it when using the _copy apis. So the
- * length reported for a header containing "123" is 3, but you must provide
- * a buffer of length 4 so that "123\0" may be copied into it, or the copy
- * will fail with a nonzero return code.
- *
- * In the special case of URL arguments, like ?x=1&y=2, the arguments are
- * stored in a token named for the method, eg, WSI_TOKEN_GET_URI if it
- * was a GET or WSI_TOKEN_POST_URI if POST. You can check the total
- * length to confirm the method.
- *
- * For URL arguments, each argument is stored urldecoded in a "fragment", so
- * you can use the fragment-aware api lws_hdr_copy_fragment() to access each
- * argument in turn: the fragments contain urldecoded strings like x=1 or y=2.
- *
- * As a convenience, lws has an api that will find the fragment with a
- * given name= part, lws_get_urlarg_by_name().
- */
-///@{
-
-/** struct lws_tokens
- * you need these to look at headers that have been parsed if using the
- * LWS_CALLBACK_FILTER_CONNECTION callback. If a header from the enum
- * list below is absent, .token = NULL and len = 0. Otherwise .token
- * points to .len chars containing that header content.
- */
-struct lws_tokens {
- char *token; /**< pointer to start of the token */
- int len; /**< length of the token's value */
-};
-
-/* enum lws_token_indexes
- * these have to be kept in sync with lextable.h / minilex.c
- *
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-enum lws_token_indexes {
- WSI_TOKEN_GET_URI = 0,
- WSI_TOKEN_POST_URI = 1,
- WSI_TOKEN_OPTIONS_URI = 2,
- WSI_TOKEN_HOST = 3,
- WSI_TOKEN_CONNECTION = 4,
- WSI_TOKEN_UPGRADE = 5,
- WSI_TOKEN_ORIGIN = 6,
- WSI_TOKEN_DRAFT = 7,
- WSI_TOKEN_CHALLENGE = 8,
- WSI_TOKEN_EXTENSIONS = 9,
- WSI_TOKEN_KEY1 = 10,
- WSI_TOKEN_KEY2 = 11,
- WSI_TOKEN_PROTOCOL = 12,
- WSI_TOKEN_ACCEPT = 13,
- WSI_TOKEN_NONCE = 14,
- WSI_TOKEN_HTTP = 15,
- WSI_TOKEN_HTTP2_SETTINGS = 16,
- WSI_TOKEN_HTTP_ACCEPT = 17,
- WSI_TOKEN_HTTP_AC_REQUEST_HEADERS = 18,
- WSI_TOKEN_HTTP_IF_MODIFIED_SINCE = 19,
- WSI_TOKEN_HTTP_IF_NONE_MATCH = 20,
- WSI_TOKEN_HTTP_ACCEPT_ENCODING = 21,
- WSI_TOKEN_HTTP_ACCEPT_LANGUAGE = 22,
- WSI_TOKEN_HTTP_PRAGMA = 23,
- WSI_TOKEN_HTTP_CACHE_CONTROL = 24,
- WSI_TOKEN_HTTP_AUTHORIZATION = 25,
- WSI_TOKEN_HTTP_COOKIE = 26,
- WSI_TOKEN_HTTP_CONTENT_LENGTH = 27,
- WSI_TOKEN_HTTP_CONTENT_TYPE = 28,
- WSI_TOKEN_HTTP_DATE = 29,
- WSI_TOKEN_HTTP_RANGE = 30,
- WSI_TOKEN_HTTP_REFERER = 31,
- WSI_TOKEN_KEY = 32,
- WSI_TOKEN_VERSION = 33,
- WSI_TOKEN_SWORIGIN = 34,
-
- WSI_TOKEN_HTTP_COLON_AUTHORITY = 35,
- WSI_TOKEN_HTTP_COLON_METHOD = 36,
- WSI_TOKEN_HTTP_COLON_PATH = 37,
- WSI_TOKEN_HTTP_COLON_SCHEME = 38,
- WSI_TOKEN_HTTP_COLON_STATUS = 39,
-
- WSI_TOKEN_HTTP_ACCEPT_CHARSET = 40,
- WSI_TOKEN_HTTP_ACCEPT_RANGES = 41,
- WSI_TOKEN_HTTP_ACCESS_CONTROL_ALLOW_ORIGIN = 42,
- WSI_TOKEN_HTTP_AGE = 43,
- WSI_TOKEN_HTTP_ALLOW = 44,
- WSI_TOKEN_HTTP_CONTENT_DISPOSITION = 45,
- WSI_TOKEN_HTTP_CONTENT_ENCODING = 46,
- WSI_TOKEN_HTTP_CONTENT_LANGUAGE = 47,
- WSI_TOKEN_HTTP_CONTENT_LOCATION = 48,
- WSI_TOKEN_HTTP_CONTENT_RANGE = 49,
- WSI_TOKEN_HTTP_ETAG = 50,
- WSI_TOKEN_HTTP_EXPECT = 51,
- WSI_TOKEN_HTTP_EXPIRES = 52,
- WSI_TOKEN_HTTP_FROM = 53,
- WSI_TOKEN_HTTP_IF_MATCH = 54,
- WSI_TOKEN_HTTP_IF_RANGE = 55,
- WSI_TOKEN_HTTP_IF_UNMODIFIED_SINCE = 56,
- WSI_TOKEN_HTTP_LAST_MODIFIED = 57,
- WSI_TOKEN_HTTP_LINK = 58,
- WSI_TOKEN_HTTP_LOCATION = 59,
- WSI_TOKEN_HTTP_MAX_FORWARDS = 60,
- WSI_TOKEN_HTTP_PROXY_AUTHENTICATE = 61,
- WSI_TOKEN_HTTP_PROXY_AUTHORIZATION = 62,
- WSI_TOKEN_HTTP_REFRESH = 63,
- WSI_TOKEN_HTTP_RETRY_AFTER = 64,
- WSI_TOKEN_HTTP_SERVER = 65,
- WSI_TOKEN_HTTP_SET_COOKIE = 66,
- WSI_TOKEN_HTTP_STRICT_TRANSPORT_SECURITY = 67,
- WSI_TOKEN_HTTP_TRANSFER_ENCODING = 68,
- WSI_TOKEN_HTTP_USER_AGENT = 69,
- WSI_TOKEN_HTTP_VARY = 70,
- WSI_TOKEN_HTTP_VIA = 71,
- WSI_TOKEN_HTTP_WWW_AUTHENTICATE = 72,
-
- WSI_TOKEN_PATCH_URI = 73,
- WSI_TOKEN_PUT_URI = 74,
- WSI_TOKEN_DELETE_URI = 75,
-
- WSI_TOKEN_HTTP_URI_ARGS = 76,
- WSI_TOKEN_PROXY = 77,
- WSI_TOKEN_HTTP_X_REAL_IP = 78,
- WSI_TOKEN_HTTP1_0 = 79,
- WSI_TOKEN_X_FORWARDED_FOR = 80,
- WSI_TOKEN_CONNECT = 81,
- WSI_TOKEN_HEAD_URI = 82,
- WSI_TOKEN_TE = 83,
- WSI_TOKEN_REPLAY_NONCE = 84,
- WSI_TOKEN_COLON_PROTOCOL = 85,
- WSI_TOKEN_X_AUTH_TOKEN = 86,
-
- /****** add new things just above ---^ ******/
-
- /* use token storage to stash these internally, not for
- * user use */
-
- _WSI_TOKEN_CLIENT_SENT_PROTOCOLS,
- _WSI_TOKEN_CLIENT_PEER_ADDRESS,
- _WSI_TOKEN_CLIENT_URI,
- _WSI_TOKEN_CLIENT_HOST,
- _WSI_TOKEN_CLIENT_ORIGIN,
- _WSI_TOKEN_CLIENT_METHOD,
- _WSI_TOKEN_CLIENT_IFACE,
- _WSI_TOKEN_CLIENT_ALPN,
-
- /* always last real token index*/
- WSI_TOKEN_COUNT,
-
- /* parser state additions, no storage associated */
- WSI_TOKEN_NAME_PART,
- WSI_TOKEN_SKIPPING,
- WSI_TOKEN_SKIPPING_SAW_CR,
- WSI_PARSING_COMPLETE,
- WSI_INIT_TOKEN_MUXURL,
-};
-
-struct lws_token_limits {
- unsigned short token_limit[WSI_TOKEN_COUNT]; /**< max chars for this token */
-};
-
-/**
- * lws_token_to_string() - returns a textual representation of a hdr token index
- *
- * \param token: token index
- */
-LWS_VISIBLE LWS_EXTERN const unsigned char *
-lws_token_to_string(enum lws_token_indexes token);
-
-/**
- * lws_hdr_total_length: report length of all fragments of a header totalled up
- * The returned length does not include the space for a
- * terminating '\0'
- *
- * \param wsi: websocket connection
- * \param h: which header index we are interested in
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h);
-
-/**
- * lws_hdr_fragment_length: report length of a single fragment of a header
- * The returned length does not include the space for a
- * terminating '\0'
- *
- * \param wsi: websocket connection
- * \param h: which header index we are interested in
- * \param frag_idx: which fragment of h we want to get the length of
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h,
- int frag_idx);
-
-/**
- * lws_hdr_copy() - copy all fragments of the given header to a buffer
- * The buffer length len must include space for an additional
- * terminating '\0', or it will fail returning -1.
- *
- * \param wsi: websocket connection
- * \param dest: destination buffer
- * \param len: length of destination buffer
- * \param h: which header index we are interested in
- *
- * copies the whole, aggregated header, even if it was delivered in
- * several actual headers piece by piece. Returns -1 or length of the whole
- * header.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h);
-
-/**
- * lws_hdr_copy_fragment() - copy a single fragment of the given header to a buffer
- * The buffer length len must include space for an additional
- * terminating '\0', or it will fail returning -1.
- * If the requested fragment index is not present, it fails
- * returning -1.
- *
- * \param wsi: websocket connection
- * \param dest: destination buffer
- * \param len: length of destination buffer
- * \param h: which header index we are interested in
- * \param frag_idx: which fragment of h we want to copy
- *
- * Normally this is only useful
- * to parse URI arguments like ?x=1&y=2, token index WSI_TOKEN_HTTP_URI_ARGS
- * fragment 0 will contain "x=1" and fragment 1 "y=2"
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len,
- enum lws_token_indexes h, int frag_idx);
-
-/**
- * lws_get_urlarg_by_name() - return pointer to arg value if present
- * \param wsi: the connection to check
- * \param name: the arg name, like "token="
- * \param buf: the buffer to receive the urlarg (including the name= part)
- * \param len: the length of the buffer to receive the urlarg
- *
- * Returns NULL if not found or a pointer inside buf to just after the
- * name= part.
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len);
-///@}
-
-/*! \defgroup HTTP-headers-create HTTP headers: create
- *
- * ## HTTP headers: Create
- *
- * These apis allow you to create HTTP response headers in a way compatible with
- * both HTTP/1.x and HTTP/2.
- *
- * They each append to a buffer taking care about the buffer end, which is
- * passed in as a pointer. When data is written to the buffer, the current
- * position p is updated accordingly.
- *
- * All of these apis are LWS_WARN_UNUSED_RESULT as they can run out of space
- * and fail with nonzero return.
- */
-///@{
-
-#define LWSAHH_CODE_MASK ((1 << 16) - 1)
-#define LWSAHH_FLAG_NO_SERVER_NAME (1 << 30)
-
-/**
- * lws_add_http_header_status() - add the HTTP response status code
- *
- * \param wsi: the connection to check
- * \param code: an HTTP code like 200, 404 etc (see enum http_status)
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Adds the initial response code, so should be called first.
- *
- * Code may additionally take OR'd flags:
- *
- * LWSAHH_FLAG_NO_SERVER_NAME: don't apply server name header this time
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_add_http_header_status(struct lws *wsi,
- unsigned int code, unsigned char **p,
- unsigned char *end);
-/**
- * lws_add_http_header_by_name() - append named header and value
- *
- * \param wsi: the connection to check
- * \param name: the hdr name, like "my-header"
- * \param value: the value after the = for this header
- * \param length: the length of the value
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Appends name: value to the headers
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
- const unsigned char *value, int length,
- unsigned char **p, unsigned char *end);
-/**
- * lws_add_http_header_by_token() - append given header and value
- *
- * \param wsi: the connection to check
- * \param token: the token index for the hdr
- * \param value: the value after the = for this header
- * \param length: the length of the value
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Appends name=value to the headers, but is able to take advantage of better
- * HTTP/2 coding mechanisms where possible.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
- const unsigned char *value, int length,
- unsigned char **p, unsigned char *end);
-/**
- * lws_add_http_header_content_length() - append content-length helper
- *
- * \param wsi: the connection to check
- * \param content_length: the content length to use
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Appends content-length: content_length to the headers
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_add_http_header_content_length(struct lws *wsi,
- lws_filepos_t content_length,
- unsigned char **p, unsigned char *end);
-/**
- * lws_finalize_http_header() - terminate header block
- *
- * \param wsi: the connection to check
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Indicates no more headers will be added
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_finalize_http_header(struct lws *wsi, unsigned char **p,
- unsigned char *end);
-
-/**
- * lws_finalize_write_http_header() - Helper finializing and writing http headers
- *
- * \param wsi: the connection to check
- * \param start: pointer to the start of headers in the buffer, eg &buf[LWS_PRE]
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Terminates the headers correctly accoring to the protocol in use (h1 / h2)
- * and writes the headers. Returns nonzero for error.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_finalize_write_http_header(struct lws *wsi, unsigned char *start,
- unsigned char **p, unsigned char *end);
-
-#define LWS_ILLEGAL_HTTP_CONTENT_LEN ((lws_filepos_t)-1ll)
-
-/**
- * lws_add_http_common_headers() - Helper preparing common http headers
- *
- * \param wsi: the connection to check
- * \param code: an HTTP code like 200, 404 etc (see enum http_status)
- * \param content_type: the content type, like "text/html"
- * \param content_len: the content length, in bytes
- * \param p: pointer to current position in buffer pointer
- * \param end: pointer to end of buffer
- *
- * Adds the initial response code, so should be called first.
- *
- * Code may additionally take OR'd flags:
- *
- * LWSAHH_FLAG_NO_SERVER_NAME: don't apply server name header this time
- *
- * This helper just calls public apis to simplify adding headers that are
- * commonly needed. If it doesn't fit your case, or you want to add additional
- * headers just call the public apis directly yourself for what you want.
- *
- * You can miss out the content length header by providing the constant
- * LWS_ILLEGAL_HTTP_CONTENT_LEN for the content_len.
- *
- * It does not call lws_finalize_http_header(), to allow you to add further
- * headers after calling this. You will need to call that yourself at the end.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_add_http_common_headers(struct lws *wsi, unsigned int code,
- const char *content_type, lws_filepos_t content_len,
- unsigned char **p, unsigned char *end);
-
-///@}
-
-/*! \defgroup urlendec Urlencode and Urldecode
- * \ingroup http
- *
- * ##HTML chunked Substitution
- *
- * APIs for receiving chunks of text, replacing a set of variable names via
- * a callback, and then prepending and appending HTML chunked encoding
- * headers.
- */
-//@{
-
-/**
- * lws_urlencode() - like strncpy but with urlencoding
- *
- * \param escaped: output buffer
- * \param string: input buffer ('/0' terminated)
- * \param len: output buffer max length
- *
- * Because urlencoding expands the output string, it's not
- * possible to do it in-place, ie, with escaped == string
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_urlencode(char *escaped, const char *string, int len);
-
-/*
- * URLDECODE 1 / 2
- *
- * This simple urldecode only operates until the first '\0' and requires the
- * data to exist all at once
- */
-/**
- * lws_urldecode() - like strncpy but with urldecoding
- *
- * \param string: output buffer
- * \param escaped: input buffer ('\0' terminated)
- * \param len: output buffer max length
- *
- * This is only useful for '\0' terminated strings
- *
- * Since urldecoding only shrinks the output string, it is possible to
- * do it in-place, ie, string == escaped
- *
- * Returns 0 if completed OK or nonzero for urldecode violation (non-hex chars
- * where hex required, etc)
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_urldecode(char *string, const char *escaped, int len);
-///@}
-
-/**
- * lws_return_http_status() - Return simple http status
- * \param wsi: Websocket instance (available from user callback)
- * \param code: Status index, eg, 404
- * \param html_body: User-readable HTML description < 1KB, or NULL
- *
- * Helper to report HTTP errors back to the client cleanly and
- * consistently
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_return_http_status(struct lws *wsi, unsigned int code,
- const char *html_body);
-
-/**
- * lws_http_redirect() - write http redirect out on wsi
- *
- * \param wsi: websocket connection
- * \param code: HTTP response code (eg, 301)
- * \param loc: where to redirect to
- * \param len: length of loc
- * \param p: pointer current position in buffer (updated as we write)
- * \param end: pointer to end of buffer
- *
- * Returns amount written, or < 0 indicating fatal write failure.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
- unsigned char **p, unsigned char *end);
-
-/**
- * lws_http_transaction_completed() - wait for new http transaction or close
- * \param wsi: websocket connection
- *
- * Returns 1 if the HTTP connection must close now
- * Returns 0 and resets connection to wait for new HTTP header /
- * transaction if possible
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_http_transaction_completed(struct lws *wsi);
-
-/**
- * lws_http_compression_apply() - apply an http compression transform
- *
- * \param wsi: the wsi to apply the compression transform to
- * \param name: NULL, or the name of the compression transform, eg, "deflate"
- * \param p: pointer to pointer to headers buffer
- * \param end: pointer to end of headers buffer
- * \param decomp: 0 = add compressor to wsi, 1 = add decompressor
- *
- * This allows transparent compression of dynamically generated HTTP. The
- * requested compression (eg, "deflate") is only applied if the client headers
- * indicated it was supported (and it has support in lws), otherwise it's a NOP.
- *
- * If the requested compression method is NULL, then the supported compression
- * formats are tried, and for non-decompression (server) mode the first that's
- * found on the client's accept-encoding header is chosen.
- *
- * NOTE: the compression transform, same as h2 support, relies on the user
- * code using LWS_WRITE_HTTP and then LWS_WRITE_HTTP_FINAL on the last part
- * written. The internal lws fileserving code already does this.
- *
- * If the library was built without the cmake option
- * LWS_WITH_HTTP_STREAM_COMPRESSION set, then a NOP is provided for this api,
- * allowing user code to build either way and use compression if available.
- */
-LWS_VISIBLE int
-lws_http_compression_apply(struct lws *wsi, const char *name,
- unsigned char **p, unsigned char *end, char decomp);
-///@}
-
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-jwk.h b/thirdparty/libwebsockets/include/libwebsockets/lws-jwk.h
deleted file mode 100644
index 2e2eabd73e..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-jwk.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-
-/*! \defgroup jwk JSON Web Keys
- * ## JSON Web Keys API
- *
- * Lws provides an API to parse JSON Web Keys into a struct lws_genrsa_elements.
- *
- * "oct" and "RSA" type keys are supported. For "oct" keys, they are held in
- * the "e" member of the struct lws_genrsa_elements.
- *
- * Keys elements are allocated on the heap. You must destroy the allocations
- * in the struct lws_genrsa_elements by calling
- * lws_jwk_destroy_genrsa_elements() when you are finished with it.
- */
-///@{
-
-struct lws_jwk {
- char keytype[5]; /**< "oct" or "RSA" */
- struct lws_genrsa_elements el; /**< OCTet key is in el.e */
-};
-
-/** lws_jwk_import() - Create a JSON Web key from the textual representation
- *
- * \param s: the JWK object to create
- * \param in: a single JWK JSON stanza in utf-8
- * \param len: the length of the JWK JSON stanza in bytes
- *
- * Creates an lws_jwk struct filled with data from the JSON representation.
- * "oct" and "rsa" key types are supported.
- *
- * For "oct" type keys, it is loaded into el.e.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_jwk_import(struct lws_jwk *s, const char *in, size_t len);
-
-/** lws_jwk_destroy() - Destroy a JSON Web key
- *
- * \param s: the JWK object to destroy
- *
- * All allocations in the lws_jwk are destroyed
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_jwk_destroy(struct lws_jwk *s);
-
-/** lws_jwk_export() - Export a JSON Web key to a textual representation
- *
- * \param s: the JWK object to export
- * \param _private: 0 = just export public parts, 1 = export everything
- * \param p: the buffer to write the exported JWK to
- * \param len: the length of the buffer \p p in bytes
- *
- * Returns length of the used part of the buffer if OK, or -1 for error.
- *
- * Serializes the content of the JWK into a char buffer.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_jwk_export(struct lws_jwk *s, int _private, char *p, size_t len);
-
-/** lws_jwk_load() - Import a JSON Web key from a file
- *
- * \param s: the JWK object to load into
- * \param filename: filename to load from
- *
- * Returns 0 for OK or -1 for failure
- */
-LWS_VISIBLE int
-lws_jwk_load(struct lws_jwk *s, const char *filename);
-
-/** lws_jwk_save() - Export a JSON Web key to a file
- *
- * \param s: the JWK object to save from
- * \param filename: filename to save to
- *
- * Returns 0 for OK or -1 for failure
- */
-LWS_VISIBLE int
-lws_jwk_save(struct lws_jwk *s, const char *filename);
-
-/** lws_jwk_rfc7638_fingerprint() - jwk to RFC7638 compliant fingerprint
- *
- * \param s: the JWK object to fingerprint
- * \param digest32: buffer to take 32-byte digest
- *
- * Returns 0 for OK or -1 for failure
- */
-LWS_VISIBLE int
-lws_jwk_rfc7638_fingerprint(struct lws_jwk *s, char *digest32);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-jws.h b/thirdparty/libwebsockets/include/libwebsockets/lws-jws.h
deleted file mode 100644
index 7112fc3dba..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-jws.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup jws JSON Web Signature
- * ## JSON Web Signature API
- *
- * Lws provides an API to check and create RFC7515 JSON Web Signatures
- *
- * SHA256/384/512 HMAC, and RSA 256/384/512 are supported.
- *
- * The API uses your TLS library crypto, but works exactly the same no matter
- * what you TLS backend is.
- */
-///@{
-
-LWS_VISIBLE LWS_EXTERN int
-lws_jws_confirm_sig(const char *in, size_t len, struct lws_jwk *jwk);
-
-/**
- * lws_jws_sign_from_b64() - add b64 sig to b64 hdr + payload
- *
- * \param b64_hdr: protected header encoded in b64, may be NULL
- * \param hdr_len: bytes in b64 coding of protected header
- * \param b64_pay: payload encoded in b64
- * \param pay_len: bytes in b64 coding of payload
- * \param b64_sig: buffer to write the b64 encoded signature into
- * \param sig_len: max bytes we can write at b64_sig
- * \param hash_type: one of LWS_GENHASH_TYPE_SHA[256|384|512]
- * \param jwk: the struct lws_jwk containing the signing key
- *
- * This adds a b64-coded JWS signature of the b64-encoded protected header
- * and b64-encoded payload, at \p b64_sig. The signature will be as large
- * as the N element of the RSA key when the RSA key is used, eg, 512 bytes for
- * a 4096-bit key, and then b64-encoding on top.
- *
- * In some special cases, there is only payload to sign and no header, in that
- * case \p b64_hdr may be NULL, and only the payload will be hashed before
- * signing.
- *
- * Returns the length of the encoded signature written to \p b64_sig, or -1.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_jws_sign_from_b64(const char *b64_hdr, size_t hdr_len, const char *b64_pay,
- size_t pay_len, char *b64_sig, size_t sig_len,
- enum lws_genhash_types hash_type, struct lws_jwk *jwk);
-
-/**
- * lws_jws_create_packet() - add b64 sig to b64 hdr + payload
- *
- * \param jwk: the struct lws_jwk containing the signing key
- * \param payload: unencoded payload JSON
- * \param len: length of unencoded payload JSON
- * \param nonce: Nonse string to include in protected header
- * \param out: buffer to take signed packet
- * \param out_len: size of \p out buffer
- *
- * This creates a "flattened" JWS packet from the jwk and the plaintext
- * payload, and signs it. The packet is written into \p out.
- *
- * This does the whole packet assembly and signing, calling through to
- * lws_jws_sign_from_b64() as part of the process.
- *
- * Returns the length written to \p out, or -1.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_jws_create_packet(struct lws_jwk *jwk, const char *payload, size_t len,
- const char *nonce, char *out, size_t out_len);
-
-/**
- * lws_jws_base64_enc() - encode input data into b64url data
- *
- * \param in: the incoming plaintext
- * \param in_len: the length of the incoming plaintext in bytes
- * \param out: the buffer to store the b64url encoded data to
- * \param out_max: the length of \p out in bytes
- *
- * Returns either -1 if problems, or the number of bytes written to \p out.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_jws_base64_enc(const char *in, size_t in_len, char *out, size_t out_max);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-lejp.h b/thirdparty/libwebsockets/include/libwebsockets/lws-lejp.h
deleted file mode 100644
index f3f7e59a64..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-lejp.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup lejp JSON parser
- * ##JSON parsing related functions
- * \ingroup lwsapi
- *
- * LEJP is an extremely lightweight JSON stream parser included in lws.
- */
-//@{
-struct lejp_ctx;
-
-#if !defined(LWS_ARRAY_SIZE)
-#define LWS_ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
-#endif
-#define LEJP_FLAG_WS_KEEP 64
-#define LEJP_FLAG_WS_COMMENTLINE 32
-
-enum lejp_states {
- LEJP_IDLE = 0,
- LEJP_MEMBERS = 1,
- LEJP_M_P = 2,
- LEJP_MP_STRING = LEJP_FLAG_WS_KEEP | 3,
- LEJP_MP_STRING_ESC = LEJP_FLAG_WS_KEEP | 4,
- LEJP_MP_STRING_ESC_U1 = LEJP_FLAG_WS_KEEP | 5,
- LEJP_MP_STRING_ESC_U2 = LEJP_FLAG_WS_KEEP | 6,
- LEJP_MP_STRING_ESC_U3 = LEJP_FLAG_WS_KEEP | 7,
- LEJP_MP_STRING_ESC_U4 = LEJP_FLAG_WS_KEEP | 8,
- LEJP_MP_DELIM = 9,
- LEJP_MP_VALUE = 10,
- LEJP_MP_VALUE_NUM_INT = LEJP_FLAG_WS_KEEP | 11,
- LEJP_MP_VALUE_NUM_EXP = LEJP_FLAG_WS_KEEP | 12,
- LEJP_MP_VALUE_TOK = LEJP_FLAG_WS_KEEP | 13,
- LEJP_MP_COMMA_OR_END = 14,
- LEJP_MP_ARRAY_END = 15,
-};
-
-enum lejp_reasons {
- LEJP_CONTINUE = -1,
- LEJP_REJECT_IDLE_NO_BRACE = -2,
- LEJP_REJECT_MEMBERS_NO_CLOSE = -3,
- LEJP_REJECT_MP_NO_OPEN_QUOTE = -4,
- LEJP_REJECT_MP_STRING_UNDERRUN = -5,
- LEJP_REJECT_MP_ILLEGAL_CTRL = -6,
- LEJP_REJECT_MP_STRING_ESC_ILLEGAL_ESC = -7,
- LEJP_REJECT_ILLEGAL_HEX = -8,
- LEJP_REJECT_MP_DELIM_MISSING_COLON = -9,
- LEJP_REJECT_MP_DELIM_BAD_VALUE_START = -10,
- LEJP_REJECT_MP_VAL_NUM_INT_NO_FRAC = -11,
- LEJP_REJECT_MP_VAL_NUM_FORMAT = -12,
- LEJP_REJECT_MP_VAL_NUM_EXP_BAD_EXP = -13,
- LEJP_REJECT_MP_VAL_TOK_UNKNOWN = -14,
- LEJP_REJECT_MP_C_OR_E_UNDERF = -15,
- LEJP_REJECT_MP_C_OR_E_NOTARRAY = -16,
- LEJP_REJECT_MP_ARRAY_END_MISSING = -17,
- LEJP_REJECT_STACK_OVERFLOW = -18,
- LEJP_REJECT_MP_DELIM_ISTACK = -19,
- LEJP_REJECT_NUM_TOO_LONG = -20,
- LEJP_REJECT_MP_C_OR_E_NEITHER = -21,
- LEJP_REJECT_UNKNOWN = -22,
- LEJP_REJECT_CALLBACK = -23
-};
-
-#define LEJP_FLAG_CB_IS_VALUE 64
-
-enum lejp_callbacks {
- LEJPCB_CONSTRUCTED = 0,
- LEJPCB_DESTRUCTED = 1,
-
- LEJPCB_START = 2,
- LEJPCB_COMPLETE = 3,
- LEJPCB_FAILED = 4,
-
- LEJPCB_PAIR_NAME = 5,
-
- LEJPCB_VAL_TRUE = LEJP_FLAG_CB_IS_VALUE | 6,
- LEJPCB_VAL_FALSE = LEJP_FLAG_CB_IS_VALUE | 7,
- LEJPCB_VAL_NULL = LEJP_FLAG_CB_IS_VALUE | 8,
- LEJPCB_VAL_NUM_INT = LEJP_FLAG_CB_IS_VALUE | 9,
- LEJPCB_VAL_NUM_FLOAT = LEJP_FLAG_CB_IS_VALUE | 10,
- LEJPCB_VAL_STR_START = 11, /* notice handle separately */
- LEJPCB_VAL_STR_CHUNK = LEJP_FLAG_CB_IS_VALUE | 12,
- LEJPCB_VAL_STR_END = LEJP_FLAG_CB_IS_VALUE | 13,
-
- LEJPCB_ARRAY_START = 14,
- LEJPCB_ARRAY_END = 15,
-
- LEJPCB_OBJECT_START = 16,
- LEJPCB_OBJECT_END = 17
-};
-
-/**
- * _lejp_callback() - User parser actions
- * \param ctx: LEJP context
- * \param reason: Callback reason
- *
- * Your user callback is associated with the context at construction time,
- * and receives calls as the parsing progresses.
- *
- * All of the callbacks may be ignored and just return 0.
- *
- * The reasons it might get called, found in @reason, are:
- *
- * LEJPCB_CONSTRUCTED: The context was just constructed... you might want to
- * perform one-time allocation for the life of the context.
- *
- * LEJPCB_DESTRUCTED: The context is being destructed... if you made any
- * allocations at construction-time, you can free them now
- *
- * LEJPCB_START: Parsing is beginning at the first byte of input
- *
- * LEJPCB_COMPLETE: Parsing has completed successfully. You'll get a 0 or
- * positive return code from lejp_parse indicating the
- * amount of unused bytes left in the input buffer
- *
- * LEJPCB_FAILED: Parsing failed. You'll get a negative error code
- * returned from lejp_parse
- *
- * LEJPCB_PAIR_NAME: When a "name":"value" pair has had the name parsed,
- * this callback occurs. You can find the new name at
- * the end of ctx->path[]
- *
- * LEJPCB_VAL_TRUE: The "true" value appeared
- *
- * LEJPCB_VAL_FALSE: The "false" value appeared
- *
- * LEJPCB_VAL_NULL: The "null" value appeared
- *
- * LEJPCB_VAL_NUM_INT: A string representing an integer is in ctx->buf
- *
- * LEJPCB_VAL_NUM_FLOAT: A string representing a float is in ctx->buf
- *
- * LEJPCB_VAL_STR_START: We are starting to parse a string, no data yet
- *
- * LEJPCB_VAL_STR_CHUNK: We parsed LEJP_STRING_CHUNK -1 bytes of string data in
- * ctx->buf, which is as much as we can buffer, so we are
- * spilling it. If all your strings are less than
- * LEJP_STRING_CHUNK - 1 bytes, you will never see this
- * callback.
- *
- * LEJPCB_VAL_STR_END: String parsing has completed, the last chunk of the
- * string is in ctx->buf.
- *
- * LEJPCB_ARRAY_START: An array started
- *
- * LEJPCB_ARRAY_END: An array ended
- *
- * LEJPCB_OBJECT_START: An object started
- *
- * LEJPCB_OBJECT_END: An object ended
- */
-LWS_EXTERN signed char _lejp_callback(struct lejp_ctx *ctx, char reason);
-
-typedef signed char (*lejp_callback)(struct lejp_ctx *ctx, char reason);
-
-#ifndef LEJP_MAX_DEPTH
-#define LEJP_MAX_DEPTH 12
-#endif
-#ifndef LEJP_MAX_INDEX_DEPTH
-#define LEJP_MAX_INDEX_DEPTH 5
-#endif
-#ifndef LEJP_MAX_PATH
-#define LEJP_MAX_PATH 128
-#endif
-#ifndef LEJP_STRING_CHUNK
-/* must be >= 30 to assemble floats */
-#define LEJP_STRING_CHUNK 254
-#endif
-
-enum num_flags {
- LEJP_SEEN_MINUS = (1 << 0),
- LEJP_SEEN_POINT = (1 << 1),
- LEJP_SEEN_POST_POINT = (1 << 2),
- LEJP_SEEN_EXP = (1 << 3)
-};
-
-struct _lejp_stack {
- char s; /* lejp_state stack*/
- char p; /* path length */
- char i; /* index array length */
- char b; /* user bitfield */
-};
-
-struct lejp_ctx {
-
- /* sorted by type for most compact alignment
- *
- * pointers
- */
-
- signed char (*callback)(struct lejp_ctx *ctx, char reason);
- void *user;
- const char * const *paths;
-
- /* arrays */
-
- struct _lejp_stack st[LEJP_MAX_DEPTH];
- uint16_t i[LEJP_MAX_INDEX_DEPTH]; /* index array */
- uint16_t wild[LEJP_MAX_INDEX_DEPTH]; /* index array */
- char path[LEJP_MAX_PATH];
- char buf[LEJP_STRING_CHUNK + 1];
-
- /* int */
-
- uint32_t line;
-
- /* short */
-
- uint16_t uni;
-
- /* char */
-
- uint8_t npos;
- uint8_t dcount;
- uint8_t f;
- uint8_t sp; /* stack head */
- uint8_t ipos; /* index stack depth */
- uint8_t ppos;
- uint8_t count_paths;
- uint8_t path_match;
- uint8_t path_match_len;
- uint8_t wildcount;
-};
-
-LWS_VISIBLE LWS_EXTERN void
-lejp_construct(struct lejp_ctx *ctx,
- signed char (*callback)(struct lejp_ctx *ctx, char reason),
- void *user, const char * const *paths, unsigned char paths_count);
-
-LWS_VISIBLE LWS_EXTERN void
-lejp_destruct(struct lejp_ctx *ctx);
-
-LWS_VISIBLE LWS_EXTERN int
-lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len);
-
-LWS_VISIBLE LWS_EXTERN void
-lejp_change_callback(struct lejp_ctx *ctx,
- signed char (*callback)(struct lejp_ctx *ctx, char reason));
-
-LWS_VISIBLE LWS_EXTERN int
-lejp_get_wildcard(struct lejp_ctx *ctx, int wildcard, char *dest, int len);
-//@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-logs.h b/thirdparty/libwebsockets/include/libwebsockets/lws-logs.h
deleted file mode 100644
index 9317dcc70c..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-logs.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup log Logging
- *
- * ##Logging
- *
- * Lws provides flexible and filterable logging facilities, which can be
- * used inside lws and in user code.
- *
- * Log categories may be individually filtered bitwise, and directed to built-in
- * sinks for syslog-compatible logging, or a user-defined function.
- */
-///@{
-
-enum lws_log_levels {
- LLL_ERR = 1 << 0,
- LLL_WARN = 1 << 1,
- LLL_NOTICE = 1 << 2,
- LLL_INFO = 1 << 3,
- LLL_DEBUG = 1 << 4,
- LLL_PARSER = 1 << 5,
- LLL_HEADER = 1 << 6,
- LLL_EXT = 1 << 7,
- LLL_CLIENT = 1 << 8,
- LLL_LATENCY = 1 << 9,
- LLL_USER = 1 << 10,
- LLL_THREAD = 1 << 11,
-
- LLL_COUNT = 12 /* set to count of valid flags */
-};
-
-LWS_VISIBLE LWS_EXTERN void _lws_log(int filter, const char *format, ...) LWS_FORMAT(2);
-LWS_VISIBLE LWS_EXTERN void _lws_logv(int filter, const char *format, va_list vl);
-/**
- * lwsl_timestamp: generate logging timestamp string
- *
- * \param level: logging level
- * \param p: char * buffer to take timestamp
- * \param len: length of p
- *
- * returns length written in p
- */
-LWS_VISIBLE LWS_EXTERN int
-lwsl_timestamp(int level, char *p, int len);
-
-/* these guys are unconditionally included */
-
-#define lwsl_err(...) _lws_log(LLL_ERR, __VA_ARGS__)
-#define lwsl_user(...) _lws_log(LLL_USER, __VA_ARGS__)
-
-#if !defined(LWS_WITH_NO_LOGS)
-/* notice and warn are usually included by being compiled in */
-#define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
-#define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
-#endif
-/*
- * weaker logging can be deselected by telling CMake to build in RELEASE mode
- * that gets rid of the overhead of checking while keeping _warn and _err
- * active
- */
-
-#ifdef _DEBUG
-#if defined(LWS_WITH_NO_LOGS)
-/* notice, warn and log are always compiled in */
-#define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
-#define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
-#endif
-#define lwsl_info(...) _lws_log(LLL_INFO, __VA_ARGS__)
-#define lwsl_debug(...) _lws_log(LLL_DEBUG, __VA_ARGS__)
-#define lwsl_parser(...) _lws_log(LLL_PARSER, __VA_ARGS__)
-#define lwsl_header(...) _lws_log(LLL_HEADER, __VA_ARGS__)
-#define lwsl_ext(...) _lws_log(LLL_EXT, __VA_ARGS__)
-#define lwsl_client(...) _lws_log(LLL_CLIENT, __VA_ARGS__)
-#define lwsl_latency(...) _lws_log(LLL_LATENCY, __VA_ARGS__)
-#define lwsl_thread(...) _lws_log(LLL_THREAD, __VA_ARGS__)
-
-#else /* no debug */
-#if defined(LWS_WITH_NO_LOGS)
-#define lwsl_warn(...) do {} while(0)
-#define lwsl_notice(...) do {} while(0)
-#endif
-#define lwsl_info(...) do {} while(0)
-#define lwsl_debug(...) do {} while(0)
-#define lwsl_parser(...) do {} while(0)
-#define lwsl_header(...) do {} while(0)
-#define lwsl_ext(...) do {} while(0)
-#define lwsl_client(...) do {} while(0)
-#define lwsl_latency(...) do {} while(0)
-#define lwsl_thread(...) do {} while(0)
-
-#endif
-
-#define lwsl_hexdump_err(...) lwsl_hexdump_level(LLL_ERR, __VA_ARGS__)
-#define lwsl_hexdump_warn(...) lwsl_hexdump_level(LLL_WARN, __VA_ARGS__)
-#define lwsl_hexdump_notice(...) lwsl_hexdump_level(LLL_NOTICE, __VA_ARGS__)
-#define lwsl_hexdump_info(...) lwsl_hexdump_level(LLL_INFO, __VA_ARGS__)
-#define lwsl_hexdump_debug(...) lwsl_hexdump_level(LLL_DEBUG, __VA_ARGS__)
-
-/**
- * lwsl_hexdump_level() - helper to hexdump a buffer at a selected debug level
- *
- * \param level: one of LLL_ constants
- * \param vbuf: buffer start to dump
- * \param len: length of buffer to dump
- *
- * If \p level is visible, does a nice hexdump -C style dump of \p vbuf for
- * \p len bytes. This can be extremely convenient while debugging.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsl_hexdump_level(int level, const void *vbuf, size_t len);
-
-/**
- * lwsl_hexdump() - helper to hexdump a buffer (DEBUG builds only)
- *
- * \param buf: buffer start to dump
- * \param len: length of buffer to dump
- *
- * Calls through to lwsl_hexdump_level(LLL_DEBUG, ... for compatability.
- * It's better to use lwsl_hexdump_level(level, ... directly so you can control
- * the visibility.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsl_hexdump(const void *buf, size_t len);
-
-/**
- * lws_is_be() - returns nonzero if the platform is Big Endian
- */
-static LWS_INLINE int lws_is_be(void) {
- const int probe = ~0xff;
-
- return *(const char *)&probe;
-}
-
-/**
- * lws_set_log_level() - Set the logging bitfield
- * \param level: OR together the LLL_ debug contexts you want output from
- * \param log_emit_function: NULL to leave it as it is, or a user-supplied
- * function to perform log string emission instead of
- * the default stderr one.
- *
- * log level defaults to "err", "warn" and "notice" contexts enabled and
- * emission on stderr. If stderr is a tty (according to isatty()) then
- * the output is coloured according to the log level using ANSI escapes.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_set_log_level(int level,
- void (*log_emit_function)(int level, const char *line));
-
-/**
- * lwsl_emit_syslog() - helper log emit function writes to system log
- *
- * \param level: one of LLL_ log level indexes
- * \param line: log string
- *
- * You use this by passing the function pointer to lws_set_log_level(), to set
- * it as the log emit function, it is not called directly.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsl_emit_syslog(int level, const char *line);
-
-/**
- * lwsl_emit_stderr() - helper log emit function writes to stderr
- *
- * \param level: one of LLL_ log level indexes
- * \param line: log string
- *
- * You use this by passing the function pointer to lws_set_log_level(), to set
- * it as the log emit function, it is not called directly.
- *
- * It prepends a system timestamp like [2018/11/13 07:41:57:3989]
- *
- * If stderr is a tty, then ansi colour codes are added.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsl_emit_stderr(int level, const char *line);
-
-/**
- * lwsl_emit_stderr_notimestamp() - helper log emit function writes to stderr
- *
- * \param level: one of LLL_ log level indexes
- * \param line: log string
- *
- * You use this by passing the function pointer to lws_set_log_level(), to set
- * it as the log emit function, it is not called directly.
- *
- * If stderr is a tty, then ansi colour codes are added.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsl_emit_stderr_notimestamp(int level, const char *line);
-
-/**
- * lwsl_visible() - returns true if the log level should be printed
- *
- * \param level: one of LLL_ log level indexes
- *
- * This is useful if you have to do work to generate the log content, you
- * can skip the work if the log level used to print it is not actually
- * enabled at runtime.
- */
-LWS_VISIBLE LWS_EXTERN int
-lwsl_visible(int level);
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-lwsac.h b/thirdparty/libwebsockets/include/libwebsockets/lws-lwsac.h
deleted file mode 100644
index 1f914b66a6..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-lwsac.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * libwebsockets - lws alloc chunk
- *
- * Copyright (C) 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup log lwsac
- *
- * ##Allocated Chunks
- *
- * If you know you will be allocating a large, unknown number of same or
- * differently sized objects, it's certainly possible to do it with libc
- * malloc. However the allocation cost in time and memory overhead can
- * add up, and deallocation means walking the structure of every object and
- * freeing them in turn.
- *
- * lwsac (LWS Allocated Chunks) allocates chunks intended to be larger
- * than your objects (4000 bytes by default) which you linearly allocate from
- * using lwsac_use().
- *
- * If your next request won't fit in the current chunk, a new chunk is added
- * to the chain of chunks and the allocaton done from there. If the request
- * is larger than the chunk size, an oversize chunk is created to satisfy it.
- *
- * When you are finished with the allocations, you call lwsac_free() and
- * free all the *chunks*. So you may have thousands of objects in the chunks,
- * but they are all destroyed with the chunks without having to deallocate them
- * one by one pointlessly.
- */
-///@{
-
-struct lwsac;
-typedef unsigned char * lwsac_cached_file_t;
-
-
-#define lws_list_ptr_container(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
-
-/*
- * linked-list helper that's commonly useful to manage lists of things
- * allocated using lwsac.
- *
- * These lists point to their corresponding "next" member in the target, NOT
- * the original containing struct. To get the containing struct, you must use
- * lws_list_ptr_container() to convert.
- *
- * It's like that because it means we no longer have to have the next pointer
- * at the start of the struct, and we can have the same struct on multiple
- * linked-lists with everything held in the struct itself.
- */
-typedef void * lws_list_ptr;
-
-/*
- * optional sorting callback called by lws_list_ptr_insert() to sort the right
- * things inside the opqaue struct being sorted / inserted on the list.
- */
-typedef int (*lws_list_ptr_sort_func_t)(lws_list_ptr a, lws_list_ptr b);
-
-#define lws_list_ptr_advance(_lp) _lp = *((void **)_lp)
-
-/* sort may be NULL if you don't care about order */
-LWS_VISIBLE LWS_EXTERN void
-lws_list_ptr_insert(lws_list_ptr *phead, lws_list_ptr *add,
- lws_list_ptr_sort_func_t sort);
-
-
-/**
- * lwsac_use - allocate / use some memory from a lwsac
- *
- * \param head: pointer to the lwsac list object
- * \param ensure: the number of bytes we want to use
- * \param chunk_size: 0, or the size of the chunk to (over)allocate if
- * what we want won't fit in the current tail chunk. If
- * 0, the default value of 4000 is used. If ensure is
- * larger, it is used instead.
- *
- * This also serves to init the lwsac if *head is NULL. Basically it does
- * whatever is necessary to return you a pointer to ensure bytes of memory
- * reserved for the caller.
- *
- * Returns NULL if OOM.
- */
-LWS_VISIBLE LWS_EXTERN void *
-lwsac_use(struct lwsac **head, size_t ensure, size_t chunk_size);
-
-/**
- * lwsac_free - deallocate all chunks in the lwsac and set head NULL
- *
- * \param head: pointer to the lwsac list object
- *
- * This deallocates all chunks in the lwsac, then sets *head to NULL. All
- * lwsac_use() pointers are invalidated in one hit without individual frees.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsac_free(struct lwsac **head);
-
-/*
- * Optional helpers useful for where consumers may need to defer destruction
- * until all consumers are finished with the lwsac
- */
-
-/**
- * lwsac_detach() - destroy an lwsac unless somebody else is referencing it
- *
- * \param head: pointer to the lwsac list object
- *
- * The creator of the lwsac can all this instead of lwsac_free() when it itself
- * has finished with the lwsac, but other code may be consuming it.
- *
- * If there are no other references, the lwsac is destroyed, *head is set to
- * NULL and that's the end; however if something else has called
- * lwsac_reference() on the lwsac, it simply returns. When lws_unreference()
- * is called and no references are left, it will be destroyed then.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsac_detach(struct lwsac **head);
-
-/**
- * lwsac_reference() - increase the lwsac reference count
- *
- * \param head: pointer to the lwsac list object
- *
- * Increment the reference count on the lwsac to defer destruction.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsac_reference(struct lwsac *head);
-
-/**
- * lwsac_reference() - increase the lwsac reference count
- *
- * \param head: pointer to the lwsac list object
- *
- * Decrement the reference count on the lwsac... if it reached 0 on a detached
- * lwsac then the lwsac is immediately destroyed and *head set to NULL.
- */
-LWS_VISIBLE LWS_EXTERN void
-lwsac_unreference(struct lwsac **head);
-
-
-/* helpers to keep a file cached in memory */
-
-LWS_VISIBLE LWS_EXTERN void
-lwsac_use_cached_file_start(lwsac_cached_file_t cache);
-
-LWS_VISIBLE LWS_EXTERN void
-lwsac_use_cached_file_end(lwsac_cached_file_t *cache);
-
-LWS_VISIBLE LWS_EXTERN void
-lwsac_use_cached_file_detach(lwsac_cached_file_t *cache);
-
-LWS_VISIBLE LWS_EXTERN int
-lwsac_cached_file(const char *filepath, lwsac_cached_file_t *cache,
- size_t *len);
-
-/* more advanced helpers */
-
-LWS_VISIBLE LWS_EXTERN size_t
-lwsac_sizeof(void);
-
-LWS_VISIBLE LWS_EXTERN size_t
-lwsac_get_tail_pos(struct lwsac *lac);
-
-LWS_VISIBLE LWS_EXTERN struct lwsac *
-lwsac_get_next(struct lwsac *lac);
-
-LWS_VISIBLE LWS_EXTERN size_t
-lwsac_align(size_t length);
-
-LWS_VISIBLE LWS_EXTERN void
-lwsac_info(struct lwsac *head);
-
-LWS_VISIBLE LWS_EXTERN uint64_t
-lwsac_total_alloc(struct lwsac *head);
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-misc.h b/thirdparty/libwebsockets/include/libwebsockets/lws-misc.h
deleted file mode 100644
index 02fe432d5b..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-misc.h
+++ /dev/null
@@ -1,836 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup misc Miscellaneous APIs
-* ##Miscellaneous APIs
-*
-* Various APIs outside of other categories
-*/
-///@{
-
-/**
- * lws_start_foreach_ll(): linkedlist iterator helper start
- *
- * \param type: type of iteration, eg, struct xyz *
- * \param it: iterator var name to create
- * \param start: start of list
- *
- * This helper creates an iterator and starts a while (it) {
- * loop. The iterator runs through the linked list starting at start and
- * ends when it gets a NULL.
- * The while loop should be terminated using lws_start_foreach_ll().
- */
-#define lws_start_foreach_ll(type, it, start)\
-{ \
- type it = start; \
- while (it) {
-
-/**
- * lws_end_foreach_ll(): linkedlist iterator helper end
- *
- * \param it: same iterator var name given when starting
- * \param nxt: member name in the iterator pointing to next list element
- *
- * This helper is the partner for lws_start_foreach_ll() that ends the
- * while loop.
- */
-
-#define lws_end_foreach_ll(it, nxt) \
- it = it->nxt; \
- } \
-}
-
-/**
- * lws_start_foreach_ll_safe(): linkedlist iterator helper start safe against delete
- *
- * \param type: type of iteration, eg, struct xyz *
- * \param it: iterator var name to create
- * \param start: start of list
- * \param nxt: member name in the iterator pointing to next list element
- *
- * This helper creates an iterator and starts a while (it) {
- * loop. The iterator runs through the linked list starting at start and
- * ends when it gets a NULL.
- * The while loop should be terminated using lws_end_foreach_ll_safe().
- * Performs storage of next increment for situations where iterator can become invalidated
- * during iteration.
- */
-#define lws_start_foreach_ll_safe(type, it, start, nxt)\
-{ \
- type it = start; \
- while (it) { \
- type next_##it = it->nxt;
-
-/**
- * lws_end_foreach_ll_safe(): linkedlist iterator helper end (pre increment storage)
- *
- * \param it: same iterator var name given when starting
- *
- * This helper is the partner for lws_start_foreach_ll_safe() that ends the
- * while loop. It uses the precreated next_ variable already stored during
- * start.
- */
-
-#define lws_end_foreach_ll_safe(it) \
- it = next_##it; \
- } \
-}
-
-/**
- * lws_start_foreach_llp(): linkedlist pointer iterator helper start
- *
- * \param type: type of iteration, eg, struct xyz **
- * \param it: iterator var name to create
- * \param start: start of list
- *
- * This helper creates an iterator and starts a while (it) {
- * loop. The iterator runs through the linked list starting at the
- * address of start and ends when it gets a NULL.
- * The while loop should be terminated using lws_start_foreach_llp().
- *
- * This helper variant iterates using a pointer to the previous linked-list
- * element. That allows you to easily delete list members by rewriting the
- * previous pointer to the element's next pointer.
- */
-#define lws_start_foreach_llp(type, it, start)\
-{ \
- type it = &(start); \
- while (*(it)) {
-
-#define lws_start_foreach_llp_safe(type, it, start, nxt)\
-{ \
- type it = &(start); \
- type next; \
- while (*(it)) { \
- next = &((*(it))->nxt); \
-
-/**
- * lws_end_foreach_llp(): linkedlist pointer iterator helper end
- *
- * \param it: same iterator var name given when starting
- * \param nxt: member name in the iterator pointing to next list element
- *
- * This helper is the partner for lws_start_foreach_llp() that ends the
- * while loop.
- */
-
-#define lws_end_foreach_llp(it, nxt) \
- it = &(*(it))->nxt; \
- } \
-}
-
-#define lws_end_foreach_llp_safe(it) \
- it = next; \
- } \
-}
-
-#define lws_ll_fwd_insert(\
- ___new_object, /* pointer to new object */ \
- ___m_list, /* member for next list object ptr */ \
- ___list_head /* list head */ \
- ) {\
- ___new_object->___m_list = ___list_head; \
- ___list_head = ___new_object; \
- }
-
-#define lws_ll_fwd_remove(\
- ___type, /* type of listed object */ \
- ___m_list, /* member for next list object ptr */ \
- ___target, /* object to remove from list */ \
- ___list_head /* list head */ \
- ) { \
- lws_start_foreach_llp(___type **, ___ppss, ___list_head) { \
- if (*___ppss == ___target) { \
- *___ppss = ___target->___m_list; \
- break; \
- } \
- } lws_end_foreach_llp(___ppss, ___m_list); \
- }
-
-/*
- * doubly linked-list
- */
-
-struct lws_dll { /* abstract */
- struct lws_dll *prev;
- struct lws_dll *next;
-};
-
-/*
- * these all point to the composed list objects... you have to use the
- * lws_container_of() helper to recover the start of the containing struct
- */
-
-LWS_VISIBLE LWS_EXTERN void
-lws_dll_add_front(struct lws_dll *d, struct lws_dll *phead);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_dll_remove(struct lws_dll *d);
-
-struct lws_dll_lws { /* typed as struct lws * */
- struct lws_dll_lws *prev;
- struct lws_dll_lws *next;
-};
-
-#define lws_dll_is_null(___dll) (!(___dll)->prev && !(___dll)->next)
-
-static LWS_INLINE void
-lws_dll_lws_add_front(struct lws_dll_lws *_a, struct lws_dll_lws *_head)
-{
- lws_dll_add_front((struct lws_dll *)_a, (struct lws_dll *)_head);
-}
-
-static LWS_INLINE void
-lws_dll_lws_remove(struct lws_dll_lws *_a)
-{
- lws_dll_remove((struct lws_dll *)_a);
-}
-
-/*
- * these are safe against the current container object getting deleted,
- * since the hold his next in a temp and go to that next. ___tmp is
- * the temp.
- */
-
-#define lws_start_foreach_dll_safe(___type, ___it, ___tmp, ___start) \
-{ \
- ___type ___it = ___start; \
- while (___it) { \
- ___type ___tmp = (___it)->next;
-
-#define lws_end_foreach_dll_safe(___it, ___tmp) \
- ___it = ___tmp; \
- } \
-}
-
-#define lws_start_foreach_dll(___type, ___it, ___start) \
-{ \
- ___type ___it = ___start; \
- while (___it) {
-
-#define lws_end_foreach_dll(___it) \
- ___it = (___it)->next; \
- } \
-}
-
-struct lws_buflist;
-
-/**
- * lws_buflist_append_segment(): add buffer to buflist at head
- *
- * \param head: list head
- * \param buf: buffer to stash
- * \param len: length of buffer to stash
- *
- * Returns -1 on OOM, 1 if this was the first segment on the list, and 0 if
- * it was a subsequent segment.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
- size_t len);
-/**
- * lws_buflist_next_segment_len(): number of bytes left in current segment
- *
- * \param head: list head
- * \param buf: if non-NULL, *buf is written with the address of the start of
- * the remaining data in the segment
- *
- * Returns the number of bytes left in the current segment. 0 indicates
- * that the buflist is empty (there are no segments on the buflist).
- */
-LWS_VISIBLE LWS_EXTERN size_t
-lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf);
-/**
- * lws_buflist_use_segment(): remove len bytes from the current segment
- *
- * \param head: list head
- * \param len: number of bytes to mark as used
- *
- * If len is less than the remaining length of the current segment, the position
- * in the current segment is simply advanced and it returns.
- *
- * If len uses up the remaining length of the current segment, then the segment
- * is deleted and the list head moves to the next segment if any.
- *
- * Returns the number of bytes left in the current segment. 0 indicates
- * that the buflist is empty (there are no segments on the buflist).
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_buflist_use_segment(struct lws_buflist **head, size_t len);
-/**
- * lws_buflist_destroy_all_segments(): free all segments on the list
- *
- * \param head: list head
- *
- * This frees everything on the list unconditionally. *head is always
- * NULL after this.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_buflist_destroy_all_segments(struct lws_buflist **head);
-
-void
-lws_buflist_describe(struct lws_buflist **head, void *id);
-
-/**
- * lws_ptr_diff(): helper to report distance between pointers as an int
- *
- * \param head: the pointer with the larger address
- * \param tail: the pointer with the smaller address
- *
- * This helper gives you an int representing the number of bytes further
- * forward the first pointer is compared to the second pointer.
- */
-#define lws_ptr_diff(head, tail) \
- ((int)((char *)(head) - (char *)(tail)))
-
-/**
- * lws_snprintf(): snprintf that truncates the returned length too
- *
- * \param str: destination buffer
- * \param size: bytes left in destination buffer
- * \param format: format string
- * \param ...: args for format
- *
- * This lets you correctly truncate buffers by concatenating lengths, if you
- * reach the limit the reported length doesn't exceed the limit.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
-
-/**
- * lws_strncpy(): strncpy that guarantees NUL on truncated copy
- *
- * \param dest: destination buffer
- * \param src: source buffer
- * \param size: bytes left in destination buffer
- *
- * This lets you correctly truncate buffers by concatenating lengths, if you
- * reach the limit the reported length doesn't exceed the limit.
- */
-LWS_VISIBLE LWS_EXTERN char *
-lws_strncpy(char *dest, const char *src, size_t size);
-
-/**
- * lws_get_random(): fill a buffer with platform random data
- *
- * \param context: the lws context
- * \param buf: buffer to fill
- * \param len: how much to fill
- *
- * This is intended to be called from the LWS_CALLBACK_RECEIVE callback if
- * it's interested to see if the frame it's dealing with was sent in binary
- * mode.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_get_random(struct lws_context *context, void *buf, int len);
-/**
- * lws_daemonize(): make current process run in the background
- *
- * \param _lock_path: the filepath to write the lock file
- *
- * Spawn lws as a background process, taking care of various things
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_daemonize(const char *_lock_path);
-/**
- * lws_get_library_version(): return string describing the version of lws
- *
- * On unix, also includes the git describe
- */
-LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
-lws_get_library_version(void);
-
-/**
- * lws_wsi_user() - get the user data associated with the connection
- * \param wsi: lws connection
- *
- * Not normally needed since it's passed into the callback
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_wsi_user(struct lws *wsi);
-
-/**
- * lws_wsi_set_user() - set the user data associated with the client connection
- * \param wsi: lws connection
- * \param user: user data
- *
- * By default lws allocates this and it's not legal to externally set it
- * yourself. However client connections may have it set externally when the
- * connection is created... if so, this api can be used to modify it at
- * runtime additionally.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_set_wsi_user(struct lws *wsi, void *user);
-
-/**
- * lws_parse_uri: cut up prot:/ads:port/path into pieces
- * Notice it does so by dropping '\0' into input string
- * and the leading / on the path is consequently lost
- *
- * \param p: incoming uri string.. will get written to
- * \param prot: result pointer for protocol part (https://)
- * \param ads: result pointer for address part
- * \param port: result pointer for port part
- * \param path: result pointer for path part
- *
- * You may also refer to unix socket addresses, using a '+' at the start of
- * the address. In this case, the address should end with ':', which is
- * treated as the separator between the address and path (the normal separator
- * '/' is a valid part of the socket path). Eg,
- *
- * http://+/var/run/mysocket:/my/path
- *
- * If the first character after the + is '@', it's interpreted by lws client
- * processing as meaning to use linux abstract namespace sockets, the @ is
- * replaced with a '\0' before use.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
- const char **path);
-/**
- * lws_cmdline_option(): simple commandline parser
- *
- * \param argc: count of argument strings
- * \param argv: argument strings
- * \param val: string to find
- *
- * Returns NULL if the string \p val is not found in the arguments.
- *
- * If it is found, then it returns a pointer to the next character after \p val.
- * So if \p val is "-d", then for the commandlines "myapp -d15" and
- * "myapp -d 15", in both cases the return will point to the "15".
- *
- * In the case there is no argument, like "myapp -d", the return will
- * either point to the '\\0' at the end of -d, or to the start of the
- * next argument, ie, will be non-NULL.
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_cmdline_option(int argc, const char **argv, const char *val);
-
-/**
- * lws_now_secs(): return seconds since 1970-1-1
- */
-LWS_VISIBLE LWS_EXTERN unsigned long
-lws_now_secs(void);
-
-/**
- * lws_now_usecs(): return useconds since 1970-1-1
- */
-LWS_VISIBLE LWS_EXTERN lws_usec_t
-lws_now_usecs(void);
-
-/**
- * lws_compare_time_t(): return relationship between two time_t
- *
- * \param context: struct lws_context
- * \param t1: time_t 1
- * \param t2: time_t 2
- *
- * returns <0 if t2 > t1; >0 if t1 > t2; or == 0 if t1 == t2.
- *
- * This is aware of clock discontiguities that may have affected either t1 or
- * t2 and adapts the comparison for them.
- *
- * For the discontiguity detection to work, you must avoid any arithmetic on
- * the times being compared. For example to have a timeout that triggers
- * 15s from when it was set, store the time it was set and compare like
- * `if (lws_compare_time_t(context, now, set_time) > 15)`
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_compare_time_t(struct lws_context *context, time_t t1, time_t t2);
-
-/**
- * lws_get_context - Allow getting lws_context from a Websocket connection
- * instance
- *
- * With this function, users can access context in the callback function.
- * Otherwise users may have to declare context as a global variable.
- *
- * \param wsi: Websocket connection instance
- */
-LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
-lws_get_context(const struct lws *wsi);
-
-/**
- * lws_get_vhost_listen_port - Find out the port number a vhost is listening on
- *
- * In the case you passed 0 for the port number at context creation time, you
- * can discover the port number that was actually chosen for the vhost using
- * this api.
- *
- * \param vhost: Vhost to get listen port from
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_get_vhost_listen_port(struct lws_vhost *vhost);
-
-/**
- * lws_get_count_threads(): how many service threads the context uses
- *
- * \param context: the lws context
- *
- * By default this is always 1, if you asked for more than lws can handle it
- * will clip the number of threads. So you can use this to find out how many
- * threads are actually in use.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_get_count_threads(struct lws_context *context);
-
-/**
- * lws_get_parent() - get parent wsi or NULL
- * \param wsi: lws connection
- *
- * Specialized wsi like cgi stdin/out/err are associated to a parent wsi,
- * this allows you to get their parent.
- */
-LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
-lws_get_parent(const struct lws *wsi);
-
-/**
- * lws_get_child() - get child wsi or NULL
- * \param wsi: lws connection
- *
- * Allows you to find a related wsi from the parent wsi.
- */
-LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
-lws_get_child(const struct lws *wsi);
-
-/**
- * lws_get_effective_uid_gid() - find out eventual uid and gid while still root
- *
- * \param context: lws context
- * \param uid: pointer to uid result
- * \param gid: pointer to gid result
- *
- * This helper allows you to find out what the uid and gid for the process will
- * be set to after the privileges are dropped, beforehand. So while still root,
- * eg in LWS_CALLBACK_PROTOCOL_INIT, you can arrange things like cache dir
- * and subdir creation / permissions down /var/cache dynamically.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_get_effective_uid_gid(struct lws_context *context, int *uid, int *gid);
-
-/**
- * lws_get_udp() - get wsi's udp struct
- *
- * \param wsi: lws connection
- *
- * Returns NULL or pointer to the wsi's UDP-specific information
- */
-LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
-lws_get_udp(const struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN void *
-lws_get_opaque_parent_data(const struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_set_opaque_parent_data(struct lws *wsi, void *data);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_get_child_pending_on_writable(const struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_clear_child_pending_on_writable(struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_get_close_length(struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN unsigned char *
-lws_get_close_payload(struct lws *wsi);
-
-/**
- * lws_get_network_wsi() - Returns wsi that has the tcp connection for this wsi
- *
- * \param wsi: wsi you have
- *
- * Returns wsi that has the tcp connection (which may be the incoming wsi)
- *
- * HTTP/1 connections will always return the incoming wsi
- * HTTP/2 connections may return a different wsi that has the tcp connection
- */
-LWS_VISIBLE LWS_EXTERN
-struct lws *lws_get_network_wsi(struct lws *wsi);
-
-/**
- * lws_set_allocator() - custom allocator support
- *
- * \param realloc
- *
- * Allows you to replace the allocator (and deallocator) used by lws
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
-
-enum {
- /*
- * Flags for enable and disable rxflow with reason bitmap and with
- * backwards-compatible single bool
- */
- LWS_RXFLOW_REASON_USER_BOOL = (1 << 0),
- LWS_RXFLOW_REASON_HTTP_RXBUFFER = (1 << 6),
- LWS_RXFLOW_REASON_H2_PPS_PENDING = (1 << 7),
-
- LWS_RXFLOW_REASON_APPLIES = (1 << 14),
- LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT = (1 << 13),
- LWS_RXFLOW_REASON_APPLIES_ENABLE = LWS_RXFLOW_REASON_APPLIES |
- LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT,
- LWS_RXFLOW_REASON_APPLIES_DISABLE = LWS_RXFLOW_REASON_APPLIES,
- LWS_RXFLOW_REASON_FLAG_PROCESS_NOW = (1 << 12),
-
-};
-
-/**
- * lws_rx_flow_control() - Enable and disable socket servicing for
- * received packets.
- *
- * If the output side of a server process becomes choked, this allows flow
- * control for the input side.
- *
- * \param wsi: Websocket connection instance to get callback for
- * \param enable: 0 = disable read servicing for this connection, 1 = enable
- *
- * If you need more than one additive reason for rxflow control, you can give
- * iLWS_RXFLOW_REASON_APPLIES_ENABLE or _DISABLE together with one or more of
- * b5..b0 set to idicate which bits to enable or disable. If any bits are
- * enabled, rx on the connection is suppressed.
- *
- * LWS_RXFLOW_REASON_FLAG_PROCESS_NOW flag may also be given to force any change
- * in rxflowbstatus to benapplied immediately, this should be used when you are
- * changing a wsi flow control state from outside a callback on that wsi.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_rx_flow_control(struct lws *wsi, int enable);
-
-/**
- * lws_rx_flow_allow_all_protocol() - Allow all connections with this protocol to receive
- *
- * When the user server code realizes it can accept more input, it can
- * call this to have the RX flow restriction removed from all connections using
- * the given protocol.
- * \param context: lws_context
- * \param protocol: all connections using this protocol will be allowed to receive
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_rx_flow_allow_all_protocol(const struct lws_context *context,
- const struct lws_protocols *protocol);
-
-/**
- * lws_remaining_packet_payload() - Bytes to come before "overall"
- * rx fragment is complete
- * \param wsi: Websocket instance (available from user callback)
- *
- * This tracks how many bytes are left in the current ws fragment, according
- * to the ws length given in the fragment header.
- *
- * If the message was in a single fragment, and there is no compression, this
- * is the same as "how much data is left to read for this message".
- *
- * However, if the message is being sent in multiple fragments, this will
- * reflect the unread amount of the current **fragment**, not the message. With
- * ws, it is legal to not know the length of the message before it completes.
- *
- * Additionally if the message is sent via the negotiated permessage-deflate
- * extension, this number only tells the amount of **compressed** data left to
- * be read, since that is the only information available at the ws layer.
- */
-LWS_VISIBLE LWS_EXTERN size_t
-lws_remaining_packet_payload(struct lws *wsi);
-
-
-
-/**
- * lws_is_ssl() - Find out if connection is using SSL
- * \param wsi: websocket connection to check
- *
- * Returns 0 if the connection is not using SSL, 1 if using SSL and
- * using verified cert, and 2 if using SSL but the cert was not
- * checked (appears for client wsi told to skip check on connection)
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_is_ssl(struct lws *wsi);
-/**
- * lws_is_cgi() - find out if this wsi is running a cgi process
- * \param wsi: lws connection
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_is_cgi(struct lws *wsi);
-
-/**
- * lws_open() - platform-specific wrapper for open that prepares the fd
- *
- * \param file: the filepath to open
- * \param oflag: option flags
- * \param mode: optional mode of any created file
- *
- * This is a wrapper around platform open() that sets options on the fd
- * according to lws policy. Currently that is FD_CLOEXEC to stop the opened
- * fd being available to any child process forked by user code.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_open(const char *__file, int __oflag, ...);
-
-struct lws_wifi_scan { /* generic wlan scan item */
- struct lws_wifi_scan *next;
- char ssid[32];
- int32_t rssi; /* divide by .count to get db */
- uint8_t bssid[6];
- uint8_t count;
- uint8_t channel;
- uint8_t authmode;
-};
-
-#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
-/**
- * lws_get_ssl() - Return wsi's SSL context structure
- * \param wsi: websocket connection
- *
- * Returns pointer to the SSL library's context structure
- */
-LWS_VISIBLE LWS_EXTERN SSL*
-lws_get_ssl(struct lws *wsi);
-#endif
-
-/** \defgroup smtp SMTP related functions
- * ##SMTP related functions
- * \ingroup lwsapi
- *
- * These apis let you communicate with a local SMTP server to send email from
- * lws. It handles all the SMTP sequencing and protocol actions.
- *
- * Your system should have postfix, sendmail or another MTA listening on port
- * 25 and able to send email using the "mail" commandline app. Usually distro
- * MTAs are configured for this by default.
- *
- * It runs via its own libuv events if initialized (which requires giving it
- * a libuv loop to attach to).
- *
- * It operates using three callbacks, on_next() queries if there is a new email
- * to send, on_get_body() asks for the body of the email, and on_sent() is
- * called after the email is successfully sent.
- *
- * To use it
- *
- * - create an lws_email struct
- *
- * - initialize data, loop, the email_* strings, max_content_size and
- * the callbacks
- *
- * - call lws_email_init()
- *
- * When you have at least one email to send, call lws_email_check() to
- * schedule starting to send it.
- */
-//@{
-#ifdef LWS_WITH_SMTP
-
-/** enum lwsgs_smtp_states - where we are in SMTP protocol sequence */
-enum lwsgs_smtp_states {
- LGSSMTP_IDLE, /**< awaiting new email */
- LGSSMTP_CONNECTING, /**< opening tcp connection to MTA */
- LGSSMTP_CONNECTED, /**< tcp connection to MTA is connected */
- LGSSMTP_SENT_HELO, /**< sent the HELO */
- LGSSMTP_SENT_FROM, /**< sent FROM */
- LGSSMTP_SENT_TO, /**< sent TO */
- LGSSMTP_SENT_DATA, /**< sent DATA request */
- LGSSMTP_SENT_BODY, /**< sent the email body */
- LGSSMTP_SENT_QUIT, /**< sent the session quit */
-};
-
-/** struct lws_email - abstract context for performing SMTP operations */
-struct lws_email {
- void *data;
- /**< opaque pointer set by user code and available to the callbacks */
- uv_loop_t *loop;
- /**< the libuv loop we will work on */
-
- char email_smtp_ip[32]; /**< Fill before init, eg, "127.0.0.1" */
- char email_helo[32]; /**< Fill before init, eg, "myserver.com" */
- char email_from[100]; /**< Fill before init or on_next */
- char email_to[100]; /**< Fill before init or on_next */
-
- unsigned int max_content_size;
- /**< largest possible email body size */
-
- /* Fill all the callbacks before init */
-
- int (*on_next)(struct lws_email *email);
- /**< (Fill in before calling lws_email_init)
- * called when idle, 0 = another email to send, nonzero is idle.
- * If you return 0, all of the email_* char arrays must be set
- * to something useful. */
- int (*on_sent)(struct lws_email *email);
- /**< (Fill in before calling lws_email_init)
- * called when transfer of the email to the SMTP server was
- * successful, your callback would remove the current email
- * from its queue */
- int (*on_get_body)(struct lws_email *email, char *buf, int len);
- /**< (Fill in before calling lws_email_init)
- * called when the body part of the queued email is about to be
- * sent to the SMTP server. */
-
-
- /* private things */
- uv_timer_t timeout_email; /**< private */
- enum lwsgs_smtp_states estate; /**< private */
- uv_connect_t email_connect_req; /**< private */
- uv_tcp_t email_client; /**< private */
- time_t email_connect_started; /**< private */
- char email_buf[256]; /**< private */
- char *content; /**< private */
-};
-
-/**
- * lws_email_init() - Initialize a struct lws_email
- *
- * \param email: struct lws_email to init
- * \param loop: libuv loop to use
- * \param max_content: max email content size
- *
- * Prepares a struct lws_email for use ending SMTP
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_email_init(struct lws_email *email, uv_loop_t *loop, int max_content);
-
-/**
- * lws_email_check() - Request check for new email
- *
- * \param email: struct lws_email context to check
- *
- * Schedules a check for new emails in 1s... call this when you have queued an
- * email for send.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_email_check(struct lws_email *email);
-/**
- * lws_email_destroy() - stop using the struct lws_email
- *
- * \param email: the struct lws_email context
- *
- * Stop sending email using email and free allocations
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_email_destroy(struct lws_email *email);
-
-#endif
-//@}
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-network-helper.h b/thirdparty/libwebsockets/include/libwebsockets/lws-network-helper.h
deleted file mode 100644
index 94ee8d9a5d..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-network-helper.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup net Network related helper APIs
- * ##Network related helper APIs
- *
- * These wrap miscellaneous useful network-related functions
- */
-///@{
-
-/**
- * lws_canonical_hostname() - returns this host's hostname
- *
- * This is typically used by client code to fill in the host parameter
- * when making a client connection. You can only call it after the context
- * has been created.
- *
- * \param context: Websocket context
- */
-LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
-lws_canonical_hostname(struct lws_context *context);
-
-/**
- * lws_get_peer_addresses() - Get client address information
- * \param wsi: Local struct lws associated with
- * \param fd: Connection socket descriptor
- * \param name: Buffer to take client address name
- * \param name_len: Length of client address name buffer
- * \param rip: Buffer to take client address IP dotted quad
- * \param rip_len: Length of client address IP buffer
- *
- * This function fills in name and rip with the name and IP of
- * the client connected with socket descriptor fd. Names may be
- * truncated if there is not enough room. If either cannot be
- * determined, they will be returned as valid zero-length strings.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
- int name_len, char *rip, int rip_len);
-
-/**
- * lws_get_peer_simple() - Get client address information without RDNS
- *
- * \param wsi: Local struct lws associated with
- * \param name: Buffer to take client address name
- * \param namelen: Length of client address name buffer
- *
- * This provides a 123.123.123.123 type IP address in name from the
- * peer that has connected to wsi
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_get_peer_simple(struct lws *wsi, char *name, int namelen);
-
-#define LWS_ITOSA_USABLE 0
-#define LWS_ITOSA_NOT_EXIST -1
-#define LWS_ITOSA_NOT_USABLE -2
-#define LWS_ITOSA_BUSY -3 /* only returned by lws_socket_bind() on
- EADDRINUSE */
-
-#if !defined(LWS_WITH_ESP32)
-/**
- * lws_interface_to_sa() - Convert interface name or IP to sockaddr struct
- *
- * \param ipv6: Allow IPV6 addresses
- * \param ifname: Interface name or IP
- * \param addr: struct sockaddr_in * to be written
- * \param addrlen: Length of addr
- *
- * This converts a textual network interface name to a sockaddr usable by
- * other network functions.
- *
- * If the network interface doesn't exist, it will return LWS_ITOSA_NOT_EXIST.
- *
- * If the network interface is not usable, eg ethernet cable is removed, it
- * may logically exist but not have any IP address. As such it will return
- * LWS_ITOSA_NOT_USABLE.
- *
- * If the network interface exists and is usable, it will return
- * LWS_ITOSA_USABLE.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
- size_t addrlen);
-#endif
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-plugin-generic-sessions.h b/thirdparty/libwebsockets/include/libwebsockets/lws-plugin-generic-sessions.h
deleted file mode 100644
index 7f46f854ec..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-plugin-generic-sessions.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup generic-sessions plugin: generic-sessions
- * \ingroup Protocols-and-Plugins
- *
- * ##Plugin Generic-sessions related
- *
- * generic-sessions plugin provides a reusable, generic session and login /
- * register / forgot password framework including email verification.
- */
-///@{
-
-#define LWSGS_EMAIL_CONTENT_SIZE 16384
-/**< Maximum size of email we might send */
-
-/* SHA-1 binary and hexified versions */
-/** typedef struct lwsgw_hash_bin */
-typedef struct { unsigned char bin[20]; /**< binary representation of hash */} lwsgw_hash_bin;
-/** typedef struct lwsgw_hash */
-typedef struct { char id[41]; /**< ascii hex representation of hash */ } lwsgw_hash;
-
-/** enum lwsgs_auth_bits */
-enum lwsgs_auth_bits {
- LWSGS_AUTH_LOGGED_IN = 1, /**< user is logged in as somebody */
- LWSGS_AUTH_ADMIN = 2, /**< logged in as the admin user */
- LWSGS_AUTH_VERIFIED = 4, /**< user has verified his email */
- LWSGS_AUTH_FORGOT_FLOW = 8, /**< just completed "forgot password" */
-};
-
-/** struct lws_session_info - information about user session status */
-struct lws_session_info {
- char username[32]; /**< username logged in as, or empty string */
- char email[100]; /**< email address associated with login, or empty string */
- char ip[72]; /**< ip address session was started from */
- unsigned int mask; /**< access rights mask associated with session
- * see enum lwsgs_auth_bits */
- char session[42]; /**< session id string, usable as opaque uid when not logged in */
-};
-
-/** enum lws_gs_event */
-enum lws_gs_event {
- LWSGSE_CREATED, /**< a new user was created */
- LWSGSE_DELETED /**< an existing user was deleted */
-};
-
-/** struct lws_gs_event_args */
-struct lws_gs_event_args {
- enum lws_gs_event event; /**< which event happened */
- const char *username; /**< which username the event happened to */
- const char *email; /**< the email address of that user */
-};
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-protocols-plugins.h b/thirdparty/libwebsockets/include/libwebsockets/lws-protocols-plugins.h
deleted file mode 100644
index b6cc44e27f..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-protocols-plugins.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup Protocols-and-Plugins Protocols and Plugins
- * \ingroup lwsapi
- *
- * ##Protocol and protocol plugin -related apis
- *
- * Protocols bind ws protocol names to a custom callback specific to that
- * protocol implementaion.
- *
- * A list of protocols can be passed in at context creation time, but it is
- * also legal to leave that NULL and add the protocols and their callback code
- * using plugins.
- *
- * Plugins are much preferable compared to cut and pasting code into an
- * application each time, since they can be used standalone.
- */
-///@{
-/** struct lws_protocols - List of protocols and handlers client or server
- * supports. */
-
-struct lws_protocols {
- const char *name;
- /**< Protocol name that must match the one given in the client
- * Javascript new WebSocket(url, 'protocol') name. */
- lws_callback_function *callback;
- /**< The service callback used for this protocol. It allows the
- * service action for an entire protocol to be encapsulated in
- * the protocol-specific callback */
- size_t per_session_data_size;
- /**< Each new connection using this protocol gets
- * this much memory allocated on connection establishment and
- * freed on connection takedown. A pointer to this per-connection
- * allocation is passed into the callback in the 'user' parameter */
- size_t rx_buffer_size;
- /**< lws allocates this much space for rx data and informs callback
- * when something came. Due to rx flow control, the callback may not
- * be able to consume it all without having to return to the event
- * loop. That is supported in lws.
- *
- * If .tx_packet_size is 0, this also controls how much may be sent at
- * once for backwards compatibility.
- */
- unsigned int id;
- /**< ignored by lws, but useful to contain user information bound
- * to the selected protocol. For example if this protocol was
- * called "myprotocol-v2", you might set id to 2, and the user
- * code that acts differently according to the version can do so by
- * switch (wsi->protocol->id), user code might use some bits as
- * capability flags based on selected protocol version, etc. */
- void *user; /**< ignored by lws, but user code can pass a pointer
- here it can later access from the protocol callback */
- size_t tx_packet_size;
- /**< 0 indicates restrict send() size to .rx_buffer_size for backwards-
- * compatibility.
- * If greater than zero, a single send() is restricted to this amount
- * and any remainder is buffered by lws and sent afterwards also in
- * these size chunks. Since that is expensive, it's preferable
- * to restrict one fragment you are trying to send to match this
- * size.
- */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility */
-};
-
-/**
- * lws_vhost_name_to_protocol() - get vhost's protocol object from its name
- *
- * \param vh: vhost to search
- * \param name: protocol name
- *
- * Returns NULL or a pointer to the vhost's protocol of the requested name
- */
-LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
-lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name);
-
-/**
- * lws_get_protocol() - Returns a protocol pointer from a websocket
- * connection.
- * \param wsi: pointer to struct websocket you want to know the protocol of
- *
- *
- * Some apis can act on all live connections of a given protocol,
- * this is how you can get a pointer to the active protocol if needed.
- */
-LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
-lws_get_protocol(struct lws *wsi);
-
-/** lws_protocol_get() - deprecated: use lws_get_protocol */
-LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
-lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED;
-
-/**
- * lws_protocol_vh_priv_zalloc() - Allocate and zero down a protocol's per-vhost
- * storage
- * \param vhost: vhost the instance is related to
- * \param prot: protocol the instance is related to
- * \param size: bytes to allocate
- *
- * Protocols often find it useful to allocate a per-vhost struct, this is a
- * helper to be called in the per-vhost init LWS_CALLBACK_PROTOCOL_INIT
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost,
- const struct lws_protocols *prot, int size);
-
-/**
- * lws_protocol_vh_priv_get() - retreive a protocol's per-vhost storage
- *
- * \param vhost: vhost the instance is related to
- * \param prot: protocol the instance is related to
- *
- * Recover a pointer to the allocated per-vhost storage for the protocol created
- * by lws_protocol_vh_priv_zalloc() earlier
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_protocol_vh_priv_get(struct lws_vhost *vhost,
- const struct lws_protocols *prot);
-
-/**
- * lws_adjust_protocol_psds - change a vhost protocol's per session data size
- *
- * \param wsi: a connection with the protocol to change
- * \param new_size: the new size of the per session data size for the protocol
- *
- * Returns user_space for the wsi, after allocating
- *
- * This should not be used except to initalize a vhost protocol's per session
- * data size one time, before any connections are accepted.
- *
- * Sometimes the protocol wraps another protocol and needs to discover and set
- * its per session data size at runtime.
- */
-LWS_VISIBLE LWS_EXTERN void *
-lws_adjust_protocol_psds(struct lws *wsi, size_t new_size);
-
-/**
- * lws_finalize_startup() - drop initial process privileges
- *
- * \param context: lws context
- *
- * This is called after the end of the vhost protocol initializations, but
- * you may choose to call it earlier
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_finalize_startup(struct lws_context *context);
-
-/**
- * lws_pvo_search() - helper to find a named pvo in a linked-list
- *
- * \param pvo: the first pvo in the linked-list
- * \param name: the name of the pvo to return if found
- *
- * Returns NULL, or a pointer to the name pvo in the linked-list
- */
-LWS_VISIBLE LWS_EXTERN const struct lws_protocol_vhost_options *
-lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name);
-
-/**
- * lws_pvo_get_str() - retreive a string pvo value
- *
- * \param pvo: the first pvo in the linked-list
- * \param name: the name of the pvo to return if found
- * \param result: pointer to a const char * to get the result if any
- *
- * Returns 0 if found and *result set, or nonzero if not found
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_pvo_get_str(void *in, const char *name, const char **result);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_protocol_init(struct lws_context *context);
-
-#ifdef LWS_WITH_PLUGINS
-
-/* PLUGINS implies LIBUV */
-
-#define LWS_PLUGIN_API_MAGIC 180
-
-/** struct lws_plugin_capability - how a plugin introduces itself to lws */
-struct lws_plugin_capability {
- unsigned int api_magic; /**< caller fills this in, plugin fills rest */
- const struct lws_protocols *protocols; /**< array of supported protocols provided by plugin */
- int count_protocols; /**< how many protocols */
- const struct lws_extension *extensions; /**< array of extensions provided by plugin */
- int count_extensions; /**< how many extensions */
-};
-
-typedef int (*lws_plugin_init_func)(struct lws_context *,
- struct lws_plugin_capability *);
-typedef int (*lws_plugin_destroy_func)(struct lws_context *);
-
-/** struct lws_plugin */
-struct lws_plugin {
- struct lws_plugin *list; /**< linked list */
-#if (UV_VERSION_MAJOR > 0)
- uv_lib_t lib; /**< shared library pointer */
-#else
- void *l; /**< so we can compile on ancient libuv */
-#endif
- char name[64]; /**< name of the plugin */
- struct lws_plugin_capability caps; /**< plugin capabilities */
-};
-
-#endif
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-purify.h b/thirdparty/libwebsockets/include/libwebsockets/lws-purify.h
deleted file mode 100644
index 0ae35ce33c..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-purify.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-
-/*! \defgroup pur Sanitize / purify SQL and JSON helpers
- *
- * ##Sanitize / purify SQL and JSON helpers
- *
- * APIs for escaping untrusted JSON and SQL safely before use
- */
-//@{
-
-/**
- * lws_sql_purify() - like strncpy but with escaping for sql quotes
- *
- * \param escaped: output buffer
- * \param string: input buffer ('/0' terminated)
- * \param len: output buffer max length
- *
- * Because escaping expands the output string, it's not
- * possible to do it in-place, ie, with escaped == string
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_sql_purify(char *escaped, const char *string, int len);
-
-/**
- * lws_json_purify() - like strncpy but with escaping for json chars
- *
- * \param escaped: output buffer
- * \param string: input buffer ('/0' terminated)
- * \param len: output buffer max length
- *
- * Because escaping expands the output string, it's not
- * possible to do it in-place, ie, with escaped == string
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_json_purify(char *escaped, const char *string, int len);
-
-/**
- * lws_filename_purify_inplace() - replace scary filename chars with underscore
- *
- * \param filename: filename to be purified
- *
- * Replace scary characters in the filename (it should not be a path)
- * with underscore, so it's safe to use.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_filename_purify_inplace(char *filename);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
- int len);
-LWS_VISIBLE LWS_EXTERN int
-lws_plat_write_file(const char *filename, void *buf, int len);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_plat_read_file(const char *filename, void *buf, int len);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_plat_recommended_rsa_bits(void);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-ring.h b/thirdparty/libwebsockets/include/libwebsockets/lws-ring.h
deleted file mode 100644
index 9a5ec2e10b..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-ring.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup lws_ring LWS Ringbuffer APIs
- * ##lws_ring: generic ringbuffer struct
- *
- * Provides an abstract ringbuffer api supporting one head and one or an
- * unlimited number of tails.
- *
- * All of the members are opaque and manipulated by lws_ring_...() apis.
- *
- * The lws_ring and its buffer is allocated at runtime on the heap, using
- *
- * - lws_ring_create()
- * - lws_ring_destroy()
- *
- * It may contain any type, the size of the "element" stored in the ring
- * buffer and the number of elements is given at creation time.
- *
- * When you create the ringbuffer, you can optionally provide an element
- * destroy callback that frees any allocations inside the element. This is then
- * automatically called for elements with no tail behind them, ie, elements
- * which don't have any pending consumer are auto-freed.
- *
- * Whole elements may be inserted into the ringbuffer and removed from it, using
- *
- * - lws_ring_insert()
- * - lws_ring_consume()
- *
- * You can find out how many whole elements are free or waiting using
- *
- * - lws_ring_get_count_free_elements()
- * - lws_ring_get_count_waiting_elements()
- *
- * In addition there are special purpose optional byte-centric apis
- *
- * - lws_ring_next_linear_insert_range()
- * - lws_ring_bump_head()
- *
- * which let you, eg, read() directly into the ringbuffer without needing
- * an intermediate bounce buffer.
- *
- * The accessors understand that the ring wraps, and optimizes insertion and
- * consumption into one or two memcpy()s depending on if the head or tail
- * wraps.
- *
- * lws_ring only supports a single head, but optionally multiple tails with
- * an API to inform it when the "oldest" tail has moved on. You can give
- * NULL where-ever an api asks for a tail pointer, and it will use an internal
- * single tail pointer for convenience.
- *
- * The "oldest tail", which is the only tail if you give it NULL instead of
- * some other tail, is used to track which elements in the ringbuffer are
- * still unread by anyone.
- *
- * - lws_ring_update_oldest_tail()
- */
-///@{
-struct lws_ring;
-
-/**
- * lws_ring_create(): create a new ringbuffer
- *
- * \param element_len: the size in bytes of one element in the ringbuffer
- * \param count: the number of elements the ringbuffer can contain
- * \param destroy_element: NULL, or callback to be called for each element
- * that is removed from the ringbuffer due to the
- * oldest tail moving beyond it
- *
- * Creates the ringbuffer and allocates the storage. Returns the new
- * lws_ring *, or NULL if the allocation failed.
- *
- * If non-NULL, destroy_element will get called back for every element that is
- * retired from the ringbuffer after the oldest tail has gone past it, and for
- * any element still left in the ringbuffer when it is destroyed. It replaces
- * all other element destruction code in your user code.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_ring *
-lws_ring_create(size_t element_len, size_t count,
- void (*destroy_element)(void *element));
-
-/**
- * lws_ring_destroy(): destroy a previously created ringbuffer
- *
- * \param ring: the struct lws_ring to destroy
- *
- * Destroys the ringbuffer allocation and the struct lws_ring itself.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_ring_destroy(struct lws_ring *ring);
-
-/**
- * lws_ring_get_count_free_elements(): return how many elements can fit
- * in the free space
- *
- * \param ring: the struct lws_ring to report on
- *
- * Returns how much room is left in the ringbuffer for whole element insertion.
- */
-LWS_VISIBLE LWS_EXTERN size_t
-lws_ring_get_count_free_elements(struct lws_ring *ring);
-
-/**
- * lws_ring_get_count_waiting_elements(): return how many elements can be consumed
- *
- * \param ring: the struct lws_ring to report on
- * \param tail: a pointer to the tail struct to use, or NULL for single tail
- *
- * Returns how many elements are waiting to be consumed from the perspective
- * of the tail pointer given.
- */
-LWS_VISIBLE LWS_EXTERN size_t
-lws_ring_get_count_waiting_elements(struct lws_ring *ring, uint32_t *tail);
-
-/**
- * lws_ring_insert(): attempt to insert up to max_count elements from src
- *
- * \param ring: the struct lws_ring to report on
- * \param src: the array of elements to be inserted
- * \param max_count: the number of available elements at src
- *
- * Attempts to insert as many of the elements at src as possible, up to the
- * maximum max_count. Returns the number of elements actually inserted.
- */
-LWS_VISIBLE LWS_EXTERN size_t
-lws_ring_insert(struct lws_ring *ring, const void *src, size_t max_count);
-
-/**
- * lws_ring_consume(): attempt to copy out and remove up to max_count elements
- * to src
- *
- * \param ring: the struct lws_ring to report on
- * \param tail: a pointer to the tail struct to use, or NULL for single tail
- * \param dest: the array of elements to be inserted. or NULL for no copy
- * \param max_count: the number of available elements at src
- *
- * Attempts to copy out as many waiting elements as possible into dest, from
- * the perspective of the given tail, up to max_count. If dest is NULL, the
- * copying out is not done but the elements are logically consumed as usual.
- * NULL dest is useful in combination with lws_ring_get_element(), where you
- * can use the element direct from the ringbuffer and then call this with NULL
- * dest to logically consume it.
- *
- * Increments the tail position according to how many elements could be
- * consumed.
- *
- * Returns the number of elements consumed.
- */
-LWS_VISIBLE LWS_EXTERN size_t
-lws_ring_consume(struct lws_ring *ring, uint32_t *tail, void *dest,
- size_t max_count);
-
-/**
- * lws_ring_get_element(): get a pointer to the next waiting element for tail
- *
- * \param ring: the struct lws_ring to report on
- * \param tail: a pointer to the tail struct to use, or NULL for single tail
- *
- * Points to the next element that tail would consume, directly in the
- * ringbuffer. This lets you write() or otherwise use the element without
- * having to copy it out somewhere first.
- *
- * After calling this, you must call lws_ring_consume(ring, &tail, NULL, 1)
- * which will logically consume the element you used up and increment your
- * tail (tail may also be NULL there if you use a single tail).
- *
- * Returns NULL if no waiting element, or a const void * pointing to it.
- */
-LWS_VISIBLE LWS_EXTERN const void *
-lws_ring_get_element(struct lws_ring *ring, uint32_t *tail);
-
-/**
- * lws_ring_update_oldest_tail(): free up elements older than tail for reuse
- *
- * \param ring: the struct lws_ring to report on
- * \param tail: a pointer to the tail struct to use, or NULL for single tail
- *
- * If you are using multiple tails, you must use this API to inform the
- * lws_ring when none of the tails still need elements in the fifo any more,
- * by updating it when the "oldest" tail has moved on.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_ring_update_oldest_tail(struct lws_ring *ring, uint32_t tail);
-
-/**
- * lws_ring_get_oldest_tail(): get current oldest available data index
- *
- * \param ring: the struct lws_ring to report on
- *
- * If you are initializing a new ringbuffer consumer, you can set its tail to
- * this to start it from the oldest ringbuffer entry still available.
- */
-LWS_VISIBLE LWS_EXTERN uint32_t
-lws_ring_get_oldest_tail(struct lws_ring *ring);
-
-/**
- * lws_ring_next_linear_insert_range(): used to write directly into the ring
- *
- * \param ring: the struct lws_ring to report on
- * \param start: pointer to a void * set to the start of the next ringbuffer area
- * \param bytes: pointer to a size_t set to the max length you may use from *start
- *
- * This provides a low-level, bytewise access directly into the ringbuffer
- * allowing direct insertion of data without having to use a bounce buffer.
- *
- * The api reports the position and length of the next linear range that can
- * be written in the ringbuffer, ie, up to the point it would wrap, and sets
- * *start and *bytes accordingly. You can then, eg, directly read() into
- * *start for up to *bytes, and use lws_ring_bump_head() to update the lws_ring
- * with what you have done.
- *
- * Returns nonzero if no insertion is currently possible.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_ring_next_linear_insert_range(struct lws_ring *ring, void **start,
- size_t *bytes);
-
-/**
- * lws_ring_bump_head(): used to write directly into the ring
- *
- * \param ring: the struct lws_ring to operate on
- * \param bytes: the number of bytes you inserted at the current head
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_ring_bump_head(struct lws_ring *ring, size_t bytes);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_ring_dump(struct lws_ring *ring, uint32_t *tail);
-
-/*
- * This is a helper that combines the common pattern of needing to consume
- * some ringbuffer elements, move the consumer tail on, and check if that
- * has moved any ringbuffer elements out of scope, because it was the last
- * consumer that had not already consumed them.
- *
- * Elements that go out of scope because the oldest tail is now after them
- * get garbage-collected by calling the destroy_element callback on them
- * defined when the ringbuffer was created.
- */
-
-#define lws_ring_consume_and_update_oldest_tail(\
- ___ring, /* the lws_ring object */ \
- ___type, /* type of objects with tails */ \
- ___ptail, /* ptr to tail of obj with tail doing consuming */ \
- ___count, /* count of payload objects being consumed */ \
- ___list_head, /* head of list of objects with tails */ \
- ___mtail, /* member name of tail in ___type */ \
- ___mlist /* member name of next list member ptr in ___type */ \
- ) { \
- int ___n, ___m; \
- \
- ___n = lws_ring_get_oldest_tail(___ring) == *(___ptail); \
- lws_ring_consume(___ring, ___ptail, NULL, ___count); \
- if (___n) { \
- uint32_t ___oldest; \
- ___n = 0; \
- ___oldest = *(___ptail); \
- lws_start_foreach_llp(___type **, ___ppss, ___list_head) { \
- ___m = lws_ring_get_count_waiting_elements( \
- ___ring, &(*___ppss)->tail); \
- if (___m >= ___n) { \
- ___n = ___m; \
- ___oldest = (*___ppss)->tail; \
- } \
- } lws_end_foreach_llp(___ppss, ___mlist); \
- \
- lws_ring_update_oldest_tail(___ring, ___oldest); \
- } \
-}
-
-/*
- * This does the same as the lws_ring_consume_and_update_oldest_tail()
- * helper, but for the simpler case there is only one consumer, so one
- * tail, and that tail is always the oldest tail.
- */
-
-#define lws_ring_consume_single_tail(\
- ___ring, /* the lws_ring object */ \
- ___ptail, /* ptr to tail of obj with tail doing consuming */ \
- ___count /* count of payload objects being consumed */ \
- ) { \
- lws_ring_consume(___ring, ___ptail, NULL, ___count); \
- lws_ring_update_oldest_tail(___ring, *(___ptail)); \
-}
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-service.h b/thirdparty/libwebsockets/include/libwebsockets/lws-service.h
deleted file mode 100644
index f4109f0431..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-service.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup service Built-in service loop entry
- *
- * ##Built-in service loop entry
- *
- * If you're not using libev / libuv, these apis are needed to enter the poll()
- * wait in lws and service any connections with pending events.
- */
-///@{
-
-/**
- * lws_service() - Service any pending websocket activity
- * \param context: Websocket context
- * \param timeout_ms: Timeout for poll; 0 means return immediately if nothing needed
- * service otherwise block and service immediately, returning
- * after the timeout if nothing needed service.
- *
- * This function deals with any pending websocket traffic, for three
- * kinds of event. It handles these events on both server and client
- * types of connection the same.
- *
- * 1) Accept new connections to our context's server
- *
- * 2) Call the receive callback for incoming frame data received by
- * server or client connections.
- *
- * You need to call this service function periodically to all the above
- * functions to happen; if your application is single-threaded you can
- * just call it in your main event loop.
- *
- * Alternatively you can fork a new process that asynchronously handles
- * calling this service in a loop. In that case you are happy if this
- * call blocks your thread until it needs to take care of something and
- * would call it with a large nonzero timeout. Your loop then takes no
- * CPU while there is nothing happening.
- *
- * If you are calling it in a single-threaded app, you don't want it to
- * wait around blocking other things in your loop from happening, so you
- * would call it with a timeout_ms of 0, so it returns immediately if
- * nothing is pending, or as soon as it services whatever was pending.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_service(struct lws_context *context, int timeout_ms);
-
-/**
- * lws_service_tsi() - Service any pending websocket activity
- *
- * \param context: Websocket context
- * \param timeout_ms: Timeout for poll; 0 means return immediately if nothing needed
- * service otherwise block and service immediately, returning
- * after the timeout if nothing needed service.
- * \param tsi: Thread service index, starting at 0
- *
- * Same as lws_service(), but for a specific thread service index. Only needed
- * if you are spawning multiple service threads.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
-
-/**
- * lws_cancel_service_pt() - Cancel servicing of pending socket activity
- * on one thread
- * \param wsi: Cancel service on the thread this wsi is serviced by
- *
- * Same as lws_cancel_service(), but targets a single service thread, the one
- * the wsi belongs to. You probably want to use lws_cancel_service() instead.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_cancel_service_pt(struct lws *wsi);
-
-/**
- * lws_cancel_service() - Cancel wait for new pending socket activity
- * \param context: Websocket context
- *
- * This function creates an immediate "synchronous interrupt" to the lws poll()
- * wait or event loop. As soon as possible in the serialzed service sequencing,
- * a LWS_CALLBACK_EVENT_WAIT_CANCELLED callback is sent to every protocol on
- * every vhost.
- *
- * lws_cancel_service() may be called from another thread while the context
- * exists, and its effect will be immediately serialized.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_cancel_service(struct lws_context *context);
-
-/**
- * lws_service_fd() - Service polled socket with something waiting
- * \param context: Websocket context
- * \param pollfd: The pollfd entry describing the socket fd and which events
- * happened, or NULL to tell lws to do only timeout servicing.
- *
- * This function takes a pollfd that has POLLIN or POLLOUT activity and
- * services it according to the state of the associated
- * struct lws.
- *
- * The one call deals with all "service" that might happen on a socket
- * including listen accepts, http files as well as websocket protocol.
- *
- * If a pollfd says it has something, you can just pass it to
- * lws_service_fd() whether it is a socket handled by lws or not.
- * If it sees it is a lws socket, the traffic will be handled and
- * pollfd->revents will be zeroed now.
- *
- * If the socket is foreign to lws, it leaves revents alone. So you can
- * see if you should service yourself by checking the pollfd revents
- * after letting lws try to service it.
- *
- * You should also call this with pollfd = NULL to just allow the
- * once-per-second global timeout checks; if less than a second since the last
- * check it returns immediately then.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd);
-
-/**
- * lws_service_fd_tsi() - Service polled socket in specific service thread
- * \param context: Websocket context
- * \param pollfd: The pollfd entry describing the socket fd and which events
- * happened.
- * \param tsi: thread service index
- *
- * Same as lws_service_fd() but used with multiple service threads
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
- int tsi);
-
-/**
- * lws_service_adjust_timeout() - Check for any connection needing forced service
- * \param context: Websocket context
- * \param timeout_ms: The original poll timeout value. You can just set this
- * to 1 if you don't really have a poll timeout.
- * \param tsi: thread service index
- *
- * Under some conditions connections may need service even though there is no
- * pending network action on them, this is "forced service". For default
- * poll() and libuv / libev, the library takes care of calling this and
- * dealing with it for you. But for external poll() integration, you need
- * access to the apis.
- *
- * If anybody needs "forced service", returned timeout is zero. In that case,
- * you can call lws_service_tsi() with a timeout of -1 to only service
- * guys who need forced service.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi);
-
-/* Backwards compatibility */
-#define lws_plat_service_tsi lws_service_tsi
-
-LWS_VISIBLE LWS_EXTERN int
-lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd);
-
-///@}
-
-/*! \defgroup uv libuv helpers
- *
- * ##libuv helpers
- *
- * APIs specific to libuv event loop itegration
- */
-///@{
-#ifdef LWS_WITH_LIBUV
-/*
- * Any direct libuv allocations in lws protocol handlers must participate in the
- * lws reference counting scheme. Two apis are provided:
- *
- * - lws_libuv_static_refcount_add(handle, context) to mark the handle with
- * a pointer to the context and increment the global uv object counter
- *
- * - lws_libuv_static_refcount_del() which should be used as the close callback
- * for your own libuv objects declared in the protocol scope.
- *
- * Using the apis allows lws to detach itself from a libuv loop completely
- * cleanly and at the moment all of its libuv objects have completed close.
- */
-
-LWS_VISIBLE LWS_EXTERN uv_loop_t *
-lws_uv_getloop(struct lws_context *context, int tsi);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_libuv_static_refcount_add(uv_handle_t *, struct lws_context *context);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_libuv_static_refcount_del(uv_handle_t *);
-
-#endif /* LWS_WITH_LIBUV */
-
-#if defined(LWS_WITH_ESP32)
-#define lws_libuv_static_refcount_add(_a, _b)
-#define lws_libuv_static_refcount_del NULL
-#endif
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-sha1-base64.h b/thirdparty/libwebsockets/include/libwebsockets/lws-sha1-base64.h
deleted file mode 100644
index 5a2bfdbbb0..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-sha1-base64.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup sha SHA and B64 helpers
- * ##SHA and B64 helpers
- *
- * These provide SHA-1 and B64 helper apis
- */
-///@{
-#ifdef LWS_SHA1_USE_OPENSSL_NAME
-#define lws_SHA1 SHA1
-#else
-/**
- * lws_SHA1(): make a SHA-1 digest of a buffer
- *
- * \param d: incoming buffer
- * \param n: length of incoming buffer
- * \param md: buffer for message digest (must be >= 20 bytes)
- *
- * Reduces any size buffer into a 20-byte SHA-1 hash.
- */
-LWS_VISIBLE LWS_EXTERN unsigned char *
-lws_SHA1(const unsigned char *d, size_t n, unsigned char *md);
-#endif
-/**
- * lws_b64_encode_string(): encode a string into base 64
- *
- * \param in: incoming buffer
- * \param in_len: length of incoming buffer
- * \param out: result buffer
- * \param out_size: length of result buffer
- *
- * Encodes a string using b64
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_b64_encode_string(const char *in, int in_len, char *out, int out_size);
-/**
- * lws_b64_encode_string_url(): encode a string into base 64
- *
- * \param in: incoming buffer
- * \param in_len: length of incoming buffer
- * \param out: result buffer
- * \param out_size: length of result buffer
- *
- * Encodes a string using b64 with the "URL" variant (+ -> -, and / -> _)
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_b64_encode_string_url(const char *in, int in_len, char *out, int out_size);
-/**
- * lws_b64_decode_string(): decode a string from base 64
- *
- * \param in: incoming buffer
- * \param out: result buffer
- * \param out_size: length of result buffer
- *
- * Decodes a NUL-terminated string using b64
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_b64_decode_string(const char *in, char *out, int out_size);
-/**
- * lws_b64_decode_string_len(): decode a string from base 64
- *
- * \param in: incoming buffer
- * \param in_len: length of incoming buffer
- * \param out: result buffer
- * \param out_size: length of result buffer
- *
- * Decodes a range of chars using b64
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_b64_decode_string_len(const char *in, int in_len, char *out, int out_size);
-///@}
-
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-spa.h b/thirdparty/libwebsockets/include/libwebsockets/lws-spa.h
deleted file mode 100644
index fcaf3889f5..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-spa.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup form-parsing Form Parsing
- * \ingroup http
- * ##POSTed form parsing functions
- *
- * These lws_spa (stateful post arguments) apis let you parse and urldecode
- * POSTed form arguments, both using simple urlencoded and multipart transfer
- * encoding.
- *
- * It's capable of handling file uploads as well a named input parsing,
- * and the apis are the same for both form upload styles.
- *
- * You feed it a list of parameter names and it creates pointers to the
- * urldecoded arguments: file upload parameters pass the file data in chunks to
- * a user-supplied callback as they come.
- *
- * Since it's stateful, it handles the incoming data needing more than one
- * POST_BODY callback and has no limit on uploaded file size.
- */
-///@{
-
-/** enum lws_spa_fileupload_states */
-enum lws_spa_fileupload_states {
- LWS_UFS_CONTENT,
- /**< a chunk of file content has arrived */
- LWS_UFS_FINAL_CONTENT,
- /**< the last chunk (possibly zero length) of file content has arrived */
- LWS_UFS_OPEN
- /**< a new file is starting to arrive */
-};
-
-/**
- * lws_spa_fileupload_cb() - callback to receive file upload data
- *
- * \param data: opt_data pointer set in lws_spa_create
- * \param name: name of the form field being uploaded
- * \param filename: original filename from client
- * \param buf: start of data to receive
- * \param len: length of data to receive
- * \param state: information about how this call relates to file
- *
- * Notice name and filename shouldn't be trusted, as they are passed from
- * HTTP provided by the client.
- */
-typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
- const char *filename, char *buf, int len,
- enum lws_spa_fileupload_states state);
-
-/** struct lws_spa - opaque urldecode parser capable of handling multipart
- * and file uploads */
-struct lws_spa;
-
-/**
- * lws_spa_create() - create urldecode parser
- *
- * \param wsi: lws connection (used to find Content Type)
- * \param param_names: array of form parameter names, like "username"
- * \param count_params: count of param_names
- * \param max_storage: total amount of form parameter values we can store
- * \param opt_cb: NULL, or callback to receive file upload data.
- * \param opt_data: NULL, or user pointer provided to opt_cb.
- *
- * Creates a urldecode parser and initializes it.
- *
- * opt_cb can be NULL if you just want normal name=value parsing, however
- * if one or more entries in your form are bulk data (file transfer), you
- * can provide this callback and filter on the name callback parameter to
- * treat that urldecoded data separately. The callback should return -1
- * in case of fatal error, and 0 if OK.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_spa *
-lws_spa_create(struct lws *wsi, const char * const *param_names,
- int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
- void *opt_data);
-
-/**
- * lws_spa_process() - parses a chunk of input data
- *
- * \param spa: the parser object previously created
- * \param in: incoming, urlencoded data
- * \param len: count of bytes valid at \param in
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_spa_process(struct lws_spa *spa, const char *in, int len);
-
-/**
- * lws_spa_finalize() - indicate incoming data completed
- *
- * \param spa: the parser object previously created
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_spa_finalize(struct lws_spa *spa);
-
-/**
- * lws_spa_get_length() - return length of parameter value
- *
- * \param spa: the parser object previously created
- * \param n: parameter ordinal to return length of value for
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_spa_get_length(struct lws_spa *spa, int n);
-
-/**
- * lws_spa_get_string() - return pointer to parameter value
- * \param spa: the parser object previously created
- * \param n: parameter ordinal to return pointer to value for
- */
-LWS_VISIBLE LWS_EXTERN const char *
-lws_spa_get_string(struct lws_spa *spa, int n);
-
-/**
- * lws_spa_destroy() - destroy parser object
- *
- * \param spa: the parser object previously created
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_spa_destroy(struct lws_spa *spa);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-stats.h b/thirdparty/libwebsockets/include/libwebsockets/lws-stats.h
deleted file mode 100644
index b0031ca3e5..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-stats.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*
- * Stats are all uint64_t numbers that start at 0.
- * Index names here have the convention
- *
- * _C_ counter
- * _B_ byte count
- * _MS_ millisecond count
- */
-
-enum {
- LWSSTATS_C_CONNECTIONS, /**< count incoming connections */
- LWSSTATS_C_API_CLOSE, /**< count calls to close api */
- LWSSTATS_C_API_READ, /**< count calls to read from socket api */
- LWSSTATS_C_API_LWS_WRITE, /**< count calls to lws_write API */
- LWSSTATS_C_API_WRITE, /**< count calls to write API */
- LWSSTATS_C_WRITE_PARTIALS, /**< count of partial writes */
- LWSSTATS_C_WRITEABLE_CB_REQ, /**< count of writable callback requests */
- LWSSTATS_C_WRITEABLE_CB_EFF_REQ, /**< count of effective writable callback requests */
- LWSSTATS_C_WRITEABLE_CB, /**< count of writable callbacks */
- LWSSTATS_C_SSL_CONNECTIONS_FAILED, /**< count of failed SSL connections */
- LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED, /**< count of accepted SSL connections */
- LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN, /**< count of SSL_accept() attempts */
- LWSSTATS_C_SSL_CONNS_HAD_RX, /**< count of accepted SSL conns that have had some RX */
- LWSSTATS_C_TIMEOUTS, /**< count of timed-out connections */
- LWSSTATS_C_SERVICE_ENTRY, /**< count of entries to lws service loop */
- LWSSTATS_B_READ, /**< aggregate bytes read */
- LWSSTATS_B_WRITE, /**< aggregate bytes written */
- LWSSTATS_B_PARTIALS_ACCEPTED_PARTS, /**< aggreate of size of accepted write data from new partials */
- LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY, /**< aggregate delay in accepting connection */
- LWSSTATS_MS_WRITABLE_DELAY, /**< aggregate delay between asking for writable and getting cb */
- LWSSTATS_MS_WORST_WRITABLE_DELAY, /**< single worst delay between asking for writable and getting cb */
- LWSSTATS_MS_SSL_RX_DELAY, /**< aggregate delay between ssl accept complete and first RX */
- LWSSTATS_C_PEER_LIMIT_AH_DENIED, /**< number of times we would have given an ah but for the peer limit */
- LWSSTATS_C_PEER_LIMIT_WSI_DENIED, /**< number of times we would have given a wsi but for the peer limit */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility */
- LWSSTATS_SIZE
-};
-
-#if defined(LWS_WITH_STATS)
-
-LWS_VISIBLE LWS_EXTERN uint64_t
-lws_stats_get(struct lws_context *context, int index);
-LWS_VISIBLE LWS_EXTERN void
-lws_stats_log_dump(struct lws_context *context);
-#else
-static LWS_INLINE uint64_t
-lws_stats_get(struct lws_context *context, int index) { (void)context; (void)index; return 0; }
-static LWS_INLINE void
-lws_stats_log_dump(struct lws_context *context) { (void)context; }
-#endif
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-threadpool.h b/thirdparty/libwebsockets/include/libwebsockets/lws-threadpool.h
deleted file mode 100644
index eb6c6e1a16..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-threadpool.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup threadpool Threadpool related functions
- * ##Threadpool
- * \ingroup lwsapi
- *
- * This allows you to create one or more pool of threads which can run tasks
- * associated with a wsi. If the pool is busy, tasks wait on a queue.
- *
- * Tasks don't have to be atomic, if they will take more than a few tens of ms
- * they should return back to the threadpool worker with a return of 0. This
- * will allow them to abort cleanly.
- */
-//@{
-
-struct lws_threadpool;
-struct lws_threadpool_task;
-
-enum lws_threadpool_task_status {
- LWS_TP_STATUS_QUEUED,
- LWS_TP_STATUS_RUNNING,
- LWS_TP_STATUS_SYNCING,
- LWS_TP_STATUS_STOPPING,
- LWS_TP_STATUS_FINISHED, /* lws_threadpool_task_status() frees task */
- LWS_TP_STATUS_STOPPED, /* lws_threadpool_task_status() frees task */
-};
-
-enum lws_threadpool_task_return {
- /** Still work to do, just confirming not being stopped */
- LWS_TP_RETURN_CHECKING_IN,
- /** Still work to do, enter cond_wait until service thread syncs. This
- * is used if you have filled your buffer(s) of data to the service
- * thread and are blocked until the service thread completes sending at
- * least one.
- */
- LWS_TP_RETURN_SYNC,
- /** No more work to do... */
- LWS_TP_RETURN_FINISHED,
- /** Responding to request to stop */
- LWS_TP_RETURN_STOPPED,
-
- /* OR on to indicate this task wishes to outlive its wsi */
- LWS_TP_RETURN_FLAG_OUTLIVE = 64
-};
-
-struct lws_threadpool_create_args {
- int threads;
- int max_queue_depth;
-};
-
-struct lws_threadpool_task_args {
- struct lws *wsi; /**< user must set to wsi task is bound to */
- void *user; /**< user may set (user-private pointer) */
- const char *name; /**< user may set to describe task */
- char async_task; /**< set to allow the task to shrug off the loss
- of the associated wsi and continue to
- completion */
- enum lws_threadpool_task_return (*task)(void *user,
- enum lws_threadpool_task_status s);
- /**< user must set to actual task function */
- void (*cleanup)(struct lws *wsi, void *user);
- /**< socket lifecycle may end while task is not stoppable, so the task
- * must be able to detach from any wsi and clean itself up when it does
- * stop. If NULL, no cleanup necessary, otherwise point to a user-
- * supplied function that destroys the stuff in \p user.
- *
- * wsi may be NULL on entry, indicating the task got detached due to the
- * wsi closing before.
- */
-};
-
-/**
- * lws_threadpool_create() - create a pool of worker threads
- *
- * \param context: the lws_context the threadpool will exist inside
- * \param args: argument struct prepared by caller
- * \param format: printf-type format for the task name
- * \param ...: printf type args for the task name format
- *
- * Creates a pool of worker threads with \p threads and a queue of up to
- * \p max_queue_depth waiting tasks if all the threads are busy.
- *
- * Returns NULL if OOM, or a struct lws_threadpool pointer that must be
- * destroyed by lws_threadpool_destroy().
- */
-LWS_VISIBLE LWS_EXTERN struct lws_threadpool *
-lws_threadpool_create(struct lws_context *context,
- const struct lws_threadpool_create_args *args,
- const char *format, ...) LWS_FORMAT(3);
-
-/**
- * lws_threadpool_finish() - Stop all pending and running tasks
- *
- * \param tp: the threadpool object
- *
- * Marks the threadpool as under destruction. Removes everything from the
- * pending queue and completes those tasks as LWS_TP_STATUS_STOPPED.
- *
- * Running tasks will also get LWS_TP_STATUS_STOPPED as soon as they
- * "resurface".
- *
- * This doesn't reap tasks or free the threadpool, the reaping is done by the
- * lws_threadpool_task_status() on the done task.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_threadpool_finish(struct lws_threadpool *tp);
-
-/**
- * lws_threadpool_destroy() - Destroy a threadpool
- *
- * \param tp: the threadpool object
- *
- * Waits for all worker threads to stop, ends the threads and frees the tp.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_threadpool_destroy(struct lws_threadpool *tp);
-
-/**
- * lws_threadpool_enqueue() - Queue the task and run it on a worker thread when possible
- *
- * \param tp: the threadpool to queue / run on
- * \param args: information about what to run
- * \param format: printf-type format for the task name
- * \param ...: printf type args for the task name format
- *
- * This asks for a task to run ASAP on a worker thread in threadpool \p tp.
- *
- * The args defines the wsi, a user-private pointer, a timeout in secs and
- * a pointer to the task function.
- *
- * Returns NULL or an opaque pointer to the queued (or running, or completed)
- * task.
- *
- * Once a task is created and enqueued, it can only be destroyed by calling
- * lws_threadpool_task_status() on it after it has reached the state
- * LWS_TP_STATUS_FINISHED or LWS_TP_STATUS_STOPPED.
- */
-LWS_VISIBLE LWS_EXTERN struct lws_threadpool_task *
-lws_threadpool_enqueue(struct lws_threadpool *tp,
- const struct lws_threadpool_task_args *args,
- const char *format, ...) LWS_FORMAT(3);
-
-/**
- * lws_threadpool_dequeue() - Dequeue or try to stop a running task
- *
- * \param wsi: the wsi whose current task we want to eliminate
- *
- * Returns 0 is the task was dequeued or already compeleted, or 1 if the task
- * has been asked to stop asynchronously.
- *
- * This doesn't free the task. It only shortcuts it to state
- * LWS_TP_STATUS_STOPPED. lws_threadpool_task_status() must be performed on
- * the task separately once it is in LWS_TP_STATUS_STOPPED to free the task.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_threadpool_dequeue(struct lws *wsi);
-
-/**
- * lws_threadpool_task_status() - Dequeue or try to stop a running task
- *
- * \param wsi: the wsi to query the current task of
- * \param task: receives a pointer to the opaque task
- * \param user: receives a void * pointer to the task user data
- *
- * This is the equivalent of posix waitpid()... it returns the status of the
- * task, and if the task is in state LWS_TP_STATUS_FINISHED or
- * LWS_TP_STATUS_STOPPED, frees \p task. If in another state, the task
- * continues to exist.
- *
- * This is designed to be called from the service thread.
- *
- * Its use is to make sure the service thread has seen the state of the task
- * before deleting it.
- */
-LWS_VISIBLE LWS_EXTERN enum lws_threadpool_task_status
-lws_threadpool_task_status_wsi(struct lws *wsi,
- struct lws_threadpool_task **task, void **user);
-
-/**
- * lws_threadpool_task_sync() - Indicate to a stalled task it may continue
- *
- * \param task: the task to unblock
- * \param stop: 0 = run after unblock, 1 = when he unblocks, stop him
- *
- * Inform the task that the service thread has finished with the shared data
- * and that the task, if blocked in LWS_TP_RETURN_SYNC, may continue.
- *
- * If the lws service context determined that the task must be aborted, it
- * should still call this but with stop = 1, causing the task to finish.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_threadpool_task_sync(struct lws_threadpool_task *task, int stop);
-
-/**
- * lws_threadpool_dump() - dump the state of a threadpool to the log
- *
- * \param tp: The threadpool to dump
- *
- * This locks the threadpool and then dumps the pending queue, the worker
- * threads and the done queue, together with time information for how long
- * the tasks have been in their current state, how long they have occupied a
- * thread, etc.
- *
- * This only does anything on lws builds with CMAKE_BUILD_TYPE=DEBUG, otherwise
- * while it still exists, it's a NOP.
- */
-
-LWS_VISIBLE LWS_EXTERN void
-lws_threadpool_dump(struct lws_threadpool *tp);
-//@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-timeout-timer.h b/thirdparty/libwebsockets/include/libwebsockets/lws-timeout-timer.h
deleted file mode 100644
index e715ba15a3..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-timeout-timer.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup timeout Connection timeouts
-
- APIs related to setting connection timeouts
-*/
-//@{
-
-/*
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-enum pending_timeout {
- NO_PENDING_TIMEOUT = 0,
- PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE = 1,
- PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE = 2,
- PENDING_TIMEOUT_ESTABLISH_WITH_SERVER = 3,
- PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE = 4,
- PENDING_TIMEOUT_AWAITING_PING = 5,
- PENDING_TIMEOUT_CLOSE_ACK = 6,
- PENDING_TIMEOUT_UNUSED1 = 7,
- PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE = 8,
- PENDING_TIMEOUT_SSL_ACCEPT = 9,
- PENDING_TIMEOUT_HTTP_CONTENT = 10,
- PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND = 11,
- PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE = 12,
- PENDING_TIMEOUT_SHUTDOWN_FLUSH = 13,
- PENDING_TIMEOUT_CGI = 14,
- PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE = 15,
- PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING = 16,
- PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG = 17,
- PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD = 18,
- PENDING_TIMEOUT_AWAITING_SOCKS_GREETING_REPLY = 19,
- PENDING_TIMEOUT_AWAITING_SOCKS_CONNECT_REPLY = 20,
- PENDING_TIMEOUT_AWAITING_SOCKS_AUTH_REPLY = 21,
- PENDING_TIMEOUT_KILLED_BY_SSL_INFO = 22,
- PENDING_TIMEOUT_KILLED_BY_PARENT = 23,
- PENDING_TIMEOUT_CLOSE_SEND = 24,
- PENDING_TIMEOUT_HOLDING_AH = 25,
- PENDING_TIMEOUT_UDP_IDLE = 26,
- PENDING_TIMEOUT_CLIENT_CONN_IDLE = 27,
- PENDING_TIMEOUT_LAGGING = 28,
- PENDING_TIMEOUT_THREADPOOL = 29,
- PENDING_TIMEOUT_THREADPOOL_TASK = 30,
- PENDING_TIMEOUT_KILLED_BY_PROXY_CLIENT_CLOSE = 31,
-
- /****** add new things just above ---^ ******/
-
- PENDING_TIMEOUT_USER_REASON_BASE = 1000
-};
-
-/**
- * lws_time_in_microseconds() - Returns the unix time in microseconds
- */
-LWS_VISIBLE LWS_EXTERN uint64_t
-lws_time_in_microseconds(void);
-
-#define LWS_TO_KILL_ASYNC -1
-/**< If LWS_TO_KILL_ASYNC is given as the timeout sec in a lws_set_timeout()
- * call, then the connection is marked to be killed at the next timeout
- * check. This is how you should force-close the wsi being serviced if
- * you are doing it outside the callback (where you should close by nonzero
- * return).
- */
-#define LWS_TO_KILL_SYNC -2
-/**< If LWS_TO_KILL_SYNC is given as the timeout sec in a lws_set_timeout()
- * call, then the connection is closed before returning (which may delete
- * the wsi). This should only be used where the wsi being closed is not the
- * wsi currently being serviced.
- */
-/**
- * lws_set_timeout() - marks the wsi as subject to a timeout
- *
- * You will not need this unless you are doing something special
- *
- * \param wsi: Websocket connection instance
- * \param reason: timeout reason
- * \param secs: how many seconds. You may set to LWS_TO_KILL_ASYNC to
- * force the connection to timeout at the next opportunity, or
- * LWS_TO_KILL_SYNC to close it synchronously if you know the
- * wsi is not the one currently being serviced.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
-
-#define LWS_SET_TIMER_USEC_CANCEL ((lws_usec_t)-1ll)
-#define LWS_USEC_PER_SEC (1000000ll)
-
-/**
- * lws_set_timer_usecs() - schedules a callback on the wsi in the future
- *
- * \param wsi: Websocket connection instance
- * \param usecs: LWS_SET_TIMER_USEC_CANCEL removes any existing scheduled
- * callback, otherwise number of microseconds in the future
- * the callback will occur at.
- *
- * NOTE: event loop support for this:
- *
- * default poll() loop: yes
- * libuv event loop: yes
- * libev: not implemented (patch welcome)
- * libevent: not implemented (patch welcome)
- *
- * After the deadline expires, the wsi will get a callback of type
- * LWS_CALLBACK_TIMER and the timer is exhausted. The deadline may be
- * continuously deferred by further calls to lws_set_timer_usecs() with a later
- * deadline, or cancelled by lws_set_timer_usecs(wsi, -1).
- *
- * If the timer should repeat, lws_set_timer_usecs() must be called again from
- * LWS_CALLBACK_TIMER.
- *
- * Accuracy depends on the platform and the load on the event loop or system...
- * all that's guaranteed is the callback will come after the requested wait
- * period.
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs);
-
-/*
- * lws_timed_callback_vh_protocol() - calls back a protocol on a vhost after
- * the specified delay
- *
- * \param vh: the vhost to call back
- * \param protocol: the protocol to call back
- * \param reason: callback reason
- * \param secs: how many seconds in the future to do the callback. Set to
- * -1 to cancel the timer callback.
- *
- * Callback the specified protocol with a fake wsi pointing to the specified
- * vhost and protocol, with the specified reason, at the specified time in the
- * future.
- *
- * Returns 0 if OK.
- *
- * In the multithreaded service case, the callback will occur in the same
- * service thread context as the call to this api that requested it. If it is
- * called from a non-service thread, tsi 0 will handle it.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_timed_callback_vh_protocol(struct lws_vhost *vh,
- const struct lws_protocols *prot,
- int reason, int secs);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-tokenize.h b/thirdparty/libwebsockets/include/libwebsockets/lws-tokenize.h
deleted file mode 100644
index 26a57dfbaf..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-tokenize.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/* Do not treat - as a terminal character, so "my-token" is one token */
-#define LWS_TOKENIZE_F_MINUS_NONTERM (1 << 0)
-/* Separately report aggregate colon-delimited tokens */
-#define LWS_TOKENIZE_F_AGG_COLON (1 << 1)
-/* Enforce sequencing for a simple token , token , token ... list */
-#define LWS_TOKENIZE_F_COMMA_SEP_LIST (1 << 2)
-/* Allow more characters in the tokens and less delimiters... default is
- * only alphanumeric + underscore in tokens */
-#define LWS_TOKENIZE_F_RFC7230_DELIMS (1 << 3)
-/* Do not treat . as a terminal character, so "warmcat.com" is one token */
-#define LWS_TOKENIZE_F_DOT_NONTERM (1 << 4)
-/* If something starts looking like a float, like 1.2, force to be string token.
- * This lets you receive dotted-quads like 192.168.0.1 as string tokens, and
- * avoids illegal float format detection like 1.myserver.com */
-#define LWS_TOKENIZE_F_NO_FLOATS (1 << 5)
-
-typedef enum {
-
- LWS_TOKZE_ERRS = 5, /* the number of errors defined */
-
- LWS_TOKZE_ERR_BROKEN_UTF8 = -5, /* malformed or partial utf8 */
- LWS_TOKZE_ERR_UNTERM_STRING = -4, /* ended while we were in "" */
- LWS_TOKZE_ERR_MALFORMED_FLOAT = -3, /* like 0..1 or 0.1.1 */
- LWS_TOKZE_ERR_NUM_ON_LHS = -2, /* like 123= or 0.1= */
- LWS_TOKZE_ERR_COMMA_LIST = -1, /* like ",tok", or, "tok,," */
-
- LWS_TOKZE_ENDED = 0, /* no more content */
-
- /* Note: results have ordinal 1+, EOT is 0 and errors are < 0 */
-
- LWS_TOKZE_DELIMITER, /* a delimiter appeared */
- LWS_TOKZE_TOKEN, /* a token appeared */
- LWS_TOKZE_INTEGER, /* an integer appeared */
- LWS_TOKZE_FLOAT, /* a float appeared */
- LWS_TOKZE_TOKEN_NAME_EQUALS, /* token [whitespace] = */
- LWS_TOKZE_TOKEN_NAME_COLON, /* token [whitespace] : (only with
- LWS_TOKENIZE_F_AGG_COLON flag) */
- LWS_TOKZE_QUOTED_STRING, /* "*", where * may have any char */
-
-} lws_tokenize_elem;
-
-/*
- * helper enums to allow caller to enforce legal delimiter sequencing, eg
- * disallow "token,,token", "token,", and ",token"
- */
-
-enum lws_tokenize_delimiter_tracking {
- LWSTZ_DT_NEED_FIRST_CONTENT,
- LWSTZ_DT_NEED_DELIM,
- LWSTZ_DT_NEED_NEXT_CONTENT,
-};
-
-struct lws_tokenize {
- const char *start; /**< set to the start of the string to tokenize */
- const char *token; /**< the start of an identified token or delimiter */
- int len; /**< set to the length of the string to tokenize */
- int token_len; /**< the length of the identied token or delimiter */
-
- int flags; /**< optional LWS_TOKENIZE_F_ flags, or 0 */
- int delim;
-};
-
-/**
- * lws_tokenize() - breaks down a string into tokens and delimiters in-place
- *
- * \param ts: the lws_tokenize struct to init
- * \param start: the string to tokenize
- * \param flags: LWS_TOKENIZE_F_ option flags
- *
- * This initializes the tokenize struct to point to the given string, and
- * sets the length to 2GiB - 1 (so there must be a terminating NUL)... you can
- * override this requirement by setting ts.len yourself before using it.
- *
- * .delim is also initialized to LWSTZ_DT_NEED_FIRST_CONTENT.
- */
-
-LWS_VISIBLE LWS_EXTERN void
-lws_tokenize_init(struct lws_tokenize *ts, const char *start, int flags);
-
-/**
- * lws_tokenize() - breaks down a string into tokens and delimiters in-place
- *
- * \param ts: the lws_tokenize struct with information and state on what to do
- *
- * The \p ts struct should have its start, len and flags members initialized to
- * reflect the string to be tokenized and any options.
- *
- * Then `lws_tokenize()` may be called repeatedly on the struct, returning one
- * of `lws_tokenize_elem` each time, and with the struct's `token` and
- * `token_len` members set to describe the content of the delimiter or token
- * payload each time.
- *
- * There are no allocations during the process.
- *
- * returns lws_tokenize_elem that was identified (LWS_TOKZE_ENDED means reached
- * the end of the string).
- */
-
-LWS_VISIBLE LWS_EXTERN lws_tokenize_elem
-lws_tokenize(struct lws_tokenize *ts);
-
-/**
- * lws_tokenize_cstr() - copy token string to NUL-terminated buffer
- *
- * \param ts: pointer to lws_tokenize struct to operate on
- * \param str: destination buffer
- * \pparam max: bytes in destination buffer
- *
- * returns 0 if OK or nonzero if the string + NUL won't fit.
- */
-
-LWS_VISIBLE LWS_EXTERN int
-lws_tokenize_cstr(struct lws_tokenize *ts, char *str, int max);
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-vfs.h b/thirdparty/libwebsockets/include/libwebsockets/lws-vfs.h
deleted file mode 100644
index 00e2fda5d3..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-vfs.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup fops file operation wrapping
- *
- * ##File operation wrapping
- *
- * Use these helper functions if you want to access a file from the perspective
- * of a specific wsi, which is usually the case. If you just want contextless
- * file access, use the fops callbacks directly with NULL wsi instead of these
- * helpers.
- *
- * If so, then it calls the platform handler or user overrides where present
- * (as defined in info->fops)
- *
- * The advantage from all this is user code can be portable for file operations
- * without having to deal with differences between platforms.
- */
-//@{
-
-/** struct lws_plat_file_ops - Platform-specific file operations
- *
- * These provide platform-agnostic ways to deal with filesystem access in the
- * library and in the user code.
- */
-
-#if defined(LWS_WITH_ESP32)
-/* sdk preprocessor defs? compiler issue? gets confused with member names */
-#define LWS_FOP_OPEN _open
-#define LWS_FOP_CLOSE _close
-#define LWS_FOP_SEEK_CUR _seek_cur
-#define LWS_FOP_READ _read
-#define LWS_FOP_WRITE _write
-#else
-#define LWS_FOP_OPEN open
-#define LWS_FOP_CLOSE close
-#define LWS_FOP_SEEK_CUR seek_cur
-#define LWS_FOP_READ read
-#define LWS_FOP_WRITE write
-#endif
-
-#define LWS_FOP_FLAGS_MASK ((1 << 23) - 1)
-#define LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP (1 << 24)
-#define LWS_FOP_FLAG_COMPR_IS_GZIP (1 << 25)
-#define LWS_FOP_FLAG_MOD_TIME_VALID (1 << 26)
-#define LWS_FOP_FLAG_VIRTUAL (1 << 27)
-
-struct lws_plat_file_ops;
-
-struct lws_fop_fd {
- lws_filefd_type fd;
- /**< real file descriptor related to the file... */
- const struct lws_plat_file_ops *fops;
- /**< fops that apply to this fop_fd */
- void *filesystem_priv;
- /**< ignored by lws; owned by the fops handlers */
- lws_filepos_t pos;
- /**< generic "position in file" */
- lws_filepos_t len;
- /**< generic "length of file" */
- lws_fop_flags_t flags;
- /**< copy of the returned flags */
- uint32_t mod_time;
- /**< optional "modification time of file", only valid if .open()
- * set the LWS_FOP_FLAG_MOD_TIME_VALID flag */
-};
-typedef struct lws_fop_fd *lws_fop_fd_t;
-
-struct lws_fops_index {
- const char *sig; /* NULL or vfs signature, eg, ".zip/" */
- uint8_t len; /* length of above string */
-};
-
-struct lws_plat_file_ops {
- lws_fop_fd_t (*LWS_FOP_OPEN)(const struct lws_plat_file_ops *fops,
- const char *filename, const char *vpath,
- lws_fop_flags_t *flags);
- /**< Open file (always binary access if plat supports it)
- * vpath may be NULL, or if the fops understands it, the point at which
- * the filename's virtual part starts.
- * *flags & LWS_FOP_FLAGS_MASK should be set to O_RDONLY or O_RDWR.
- * If the file may be gzip-compressed,
- * LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP is set. If it actually is
- * gzip-compressed, then the open handler should OR
- * LWS_FOP_FLAG_COMPR_IS_GZIP on to *flags before returning.
- */
- int (*LWS_FOP_CLOSE)(lws_fop_fd_t *fop_fd);
- /**< close file AND set the pointer to NULL */
- lws_fileofs_t (*LWS_FOP_SEEK_CUR)(lws_fop_fd_t fop_fd,
- lws_fileofs_t offset_from_cur_pos);
- /**< seek from current position */
- int (*LWS_FOP_READ)(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len);
- /**< Read from file, on exit *amount is set to amount actually read */
- int (*LWS_FOP_WRITE)(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len);
- /**< Write to file, on exit *amount is set to amount actually written */
-
- struct lws_fops_index fi[3];
- /**< vfs path signatures implying use of this fops */
-
- const struct lws_plat_file_ops *next;
- /**< NULL or next fops in list */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility */
-};
-
-/**
- * lws_get_fops() - get current file ops
- *
- * \param context: context
- */
-LWS_VISIBLE LWS_EXTERN struct lws_plat_file_ops * LWS_WARN_UNUSED_RESULT
-lws_get_fops(struct lws_context *context);
-LWS_VISIBLE LWS_EXTERN void
-lws_set_fops(struct lws_context *context, const struct lws_plat_file_ops *fops);
-/**
- * lws_vfs_tell() - get current file position
- *
- * \param fop_fd: fop_fd we are asking about
- */
-LWS_VISIBLE LWS_EXTERN lws_filepos_t LWS_WARN_UNUSED_RESULT
-lws_vfs_tell(lws_fop_fd_t fop_fd);
-/**
- * lws_vfs_get_length() - get current file total length in bytes
- *
- * \param fop_fd: fop_fd we are asking about
- */
-LWS_VISIBLE LWS_EXTERN lws_filepos_t LWS_WARN_UNUSED_RESULT
-lws_vfs_get_length(lws_fop_fd_t fop_fd);
-/**
- * lws_vfs_get_mod_time() - get time file last modified
- *
- * \param fop_fd: fop_fd we are asking about
- */
-LWS_VISIBLE LWS_EXTERN uint32_t LWS_WARN_UNUSED_RESULT
-lws_vfs_get_mod_time(lws_fop_fd_t fop_fd);
-/**
- * lws_vfs_file_seek_set() - seek relative to start of file
- *
- * \param fop_fd: fop_fd we are seeking in
- * \param offset: offset from start of file
- */
-LWS_VISIBLE LWS_EXTERN lws_fileofs_t
-lws_vfs_file_seek_set(lws_fop_fd_t fop_fd, lws_fileofs_t offset);
-/**
- * lws_vfs_file_seek_end() - seek relative to end of file
- *
- * \param fop_fd: fop_fd we are seeking in
- * \param offset: offset from start of file
- */
-LWS_VISIBLE LWS_EXTERN lws_fileofs_t
-lws_vfs_file_seek_end(lws_fop_fd_t fop_fd, lws_fileofs_t offset);
-
-extern struct lws_plat_file_ops fops_zip;
-
-/**
- * lws_plat_file_open() - open vfs filepath
- *
- * \param fops: file ops struct that applies to this descriptor
- * \param vfs_path: filename to open
- * \param flags: pointer to open flags
- *
- * The vfs_path is scanned for known fops signatures, and the open directed
- * to any matching fops open.
- *
- * User code should use this api to perform vfs opens.
- *
- * returns semi-opaque handle
- */
-LWS_VISIBLE LWS_EXTERN lws_fop_fd_t LWS_WARN_UNUSED_RESULT
-lws_vfs_file_open(const struct lws_plat_file_ops *fops, const char *vfs_path,
- lws_fop_flags_t *flags);
-
-/**
- * lws_plat_file_close() - close file
- *
- * \param fop_fd: file handle to close
- */
-static LWS_INLINE int
-lws_vfs_file_close(lws_fop_fd_t *fop_fd)
-{
- return (*fop_fd)->fops->LWS_FOP_CLOSE(fop_fd);
-}
-
-/**
- * lws_plat_file_seek_cur() - close file
- *
- *
- * \param fop_fd: file handle
- * \param offset: position to seek to
- */
-static LWS_INLINE lws_fileofs_t
-lws_vfs_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
-{
- return fop_fd->fops->LWS_FOP_SEEK_CUR(fop_fd, offset);
-}
-/**
- * lws_plat_file_read() - read from file
- *
- * \param fop_fd: file handle
- * \param amount: how much to read (rewritten by call)
- * \param buf: buffer to write to
- * \param len: max length
- */
-static LWS_INLINE int LWS_WARN_UNUSED_RESULT
-lws_vfs_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len)
-{
- return fop_fd->fops->LWS_FOP_READ(fop_fd, amount, buf, len);
-}
-/**
- * lws_plat_file_write() - write from file
- *
- * \param fop_fd: file handle
- * \param amount: how much to write (rewritten by call)
- * \param buf: buffer to read from
- * \param len: max length
- */
-static LWS_INLINE int LWS_WARN_UNUSED_RESULT
-lws_vfs_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len)
-{
- return fop_fd->fops->LWS_FOP_WRITE(fop_fd, amount, buf, len);
-}
-
-/* these are the platform file operations implementations... they can
- * be called directly and used in fops arrays
- */
-
-LWS_VISIBLE LWS_EXTERN lws_fop_fd_t
-_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
- const char *vpath, lws_fop_flags_t *flags);
-LWS_VISIBLE LWS_EXTERN int
-_lws_plat_file_close(lws_fop_fd_t *fop_fd);
-LWS_VISIBLE LWS_EXTERN lws_fileofs_t
-_lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset);
-LWS_VISIBLE LWS_EXTERN int
-_lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len);
-LWS_VISIBLE LWS_EXTERN int
-_lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_alloc_vfs_file(struct lws_context *context, const char *filename,
- uint8_t **buf, lws_filepos_t *amount);
-//@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-write.h b/thirdparty/libwebsockets/include/libwebsockets/lws-write.h
deleted file mode 100644
index b73e51c789..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-write.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup sending-data Sending data
-
- APIs related to writing data on a connection
-*/
-//@{
-#if !defined(LWS_SIZEOFPTR)
-#define LWS_SIZEOFPTR ((int)sizeof (void *))
-#endif
-
-#if defined(__x86_64__)
-#define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
-#else
-#define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
-#endif
-#define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? \
- ((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
-/* last 2 is for lws-meta */
-#define LWS_PRE _LWS_PAD(4 + 10 + 2)
-/* used prior to 1.7 and retained for backward compatibility */
-#define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
-#define LWS_SEND_BUFFER_POST_PADDING 0
-
-#define LWS_WRITE_RAW LWS_WRITE_HTTP
-
-/*
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-enum lws_write_protocol {
- LWS_WRITE_TEXT = 0,
- /**< Send a ws TEXT message,the pointer must have LWS_PRE valid
- * memory behind it.
- *
- * The receiver expects only valid utf-8 in the payload */
- LWS_WRITE_BINARY = 1,
- /**< Send a ws BINARY message, the pointer must have LWS_PRE valid
- * memory behind it.
- *
- * Any sequence of bytes is valid */
- LWS_WRITE_CONTINUATION = 2,
- /**< Continue a previous ws message, the pointer must have LWS_PRE valid
- * memory behind it */
- LWS_WRITE_HTTP = 3,
- /**< Send HTTP content */
-
- /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
- LWS_WRITE_PING = 5,
- LWS_WRITE_PONG = 6,
-
- /* Same as write_http but we know this write ends the transaction */
- LWS_WRITE_HTTP_FINAL = 7,
-
- /* HTTP2 */
-
- LWS_WRITE_HTTP_HEADERS = 8,
- /**< Send http headers (http2 encodes this payload and LWS_WRITE_HTTP
- * payload differently, http 1.x links also handle this correctly. so
- * to be compatible with both in the future,header response part should
- * be sent using this regardless of http version expected)
- */
- LWS_WRITE_HTTP_HEADERS_CONTINUATION = 9,
- /**< Continuation of http/2 headers
- */
-
- /****** add new things just above ---^ ******/
-
- /* flags */
-
- LWS_WRITE_BUFLIST = 0x20,
- /**< Don't actually write it... stick it on the output buflist and
- * write it as soon as possible. Useful if you learn you have to
- * write something, have the data to write to hand but the timing is
- * unrelated as to whether the connection is writable or not, and were
- * otherwise going to have to allocate a temp buffer and write it
- * later anyway */
-
- LWS_WRITE_NO_FIN = 0x40,
- /**< This part of the message is not the end of the message */
-
- LWS_WRITE_H2_STREAM_END = 0x80,
- /**< Flag indicates this packet should go out with STREAM_END if h2
- * STREAM_END is allowed on DATA or HEADERS.
- */
-
- LWS_WRITE_CLIENT_IGNORE_XOR_MASK = 0x80
- /**< client packet payload goes out on wire unmunged
- * only useful for security tests since normal servers cannot
- * decode the content if used */
-};
-
-/* used with LWS_CALLBACK_CHILD_WRITE_VIA_PARENT */
-
-struct lws_write_passthru {
- struct lws *wsi;
- unsigned char *buf;
- size_t len;
- enum lws_write_protocol wp;
-};
-
-
-/**
- * lws_write() - Apply protocol then write data to client
- * \param wsi: Websocket instance (available from user callback)
- * \param buf: The data to send. For data being sent on a websocket
- * connection (ie, not default http), this buffer MUST have
- * LWS_PRE bytes valid BEFORE the pointer.
- * This is so the protocol header data can be added in-situ.
- * \param len: Count of the data bytes in the payload starting from buf
- * \param protocol: Use LWS_WRITE_HTTP to reply to an http connection, and one
- * of LWS_WRITE_BINARY or LWS_WRITE_TEXT to send appropriate
- * data on a websockets connection. Remember to allow the extra
- * bytes before and after buf if LWS_WRITE_BINARY or LWS_WRITE_TEXT
- * are used.
- *
- * This function provides the way to issue data back to the client
- * for both http and websocket protocols.
- *
- * IMPORTANT NOTICE!
- *
- * When sending with websocket protocol
- *
- * LWS_WRITE_TEXT,
- * LWS_WRITE_BINARY,
- * LWS_WRITE_CONTINUATION,
- * LWS_WRITE_PING,
- * LWS_WRITE_PONG,
- *
- * or sending on http/2,
- *
- * the send buffer has to have LWS_PRE bytes valid BEFORE the buffer pointer you
- * pass to lws_write(). Since you'll probably want to use http/2 before too
- * long, it's wise to just always do this with lws_write buffers... LWS_PRE is
- * typically 16 bytes it's not going to hurt usually.
- *
- * start of alloc ptr passed to lws_write end of allocation
- * | | |
- * v <-- LWS_PRE bytes --> v v
- * [---------------- allocated memory ---------------]
- * (for lws use) [====== user buffer ======]
- *
- * This allows us to add protocol info before and after the data, and send as
- * one packet on the network without payload copying, for maximum efficiency.
- *
- * So for example you need this kind of code to use lws_write with a
- * 128-byte payload
- *
- * char buf[LWS_PRE + 128];
- *
- * // fill your part of the buffer... for example here it's all zeros
- * memset(&buf[LWS_PRE], 0, 128);
- *
- * lws_write(wsi, &buf[LWS_PRE], 128, LWS_WRITE_TEXT);
- *
- * LWS_PRE is at least the frame nonce + 2 header + 8 length
- * LWS_SEND_BUFFER_POST_PADDING is deprecated, it's now 0 and can be left off.
- * The example apps no longer use it.
- *
- * Pad LWS_PRE to the CPU word size, so that word references
- * to the address immediately after the padding won't cause an unaligned access
- * error. Sometimes for performance reasons the recommended padding is even
- * larger than sizeof(void *).
- *
- * In the case of sending using websocket protocol, be sure to allocate
- * valid storage before and after buf as explained above. This scheme
- * allows maximum efficiency of sending data and protocol in a single
- * packet while not burdening the user code with any protocol knowledge.
- *
- * Return may be -1 for a fatal error needing connection close, or the
- * number of bytes sent.
- *
- * Truncated Writes
- * ================
- *
- * The OS may not accept everything you asked to write on the connection.
- *
- * Posix defines POLLOUT indication from poll() to show that the connection
- * will accept more write data, but it doesn't specifiy how much. It may just
- * accept one byte of whatever you wanted to send.
- *
- * LWS will buffer the remainder automatically, and send it out autonomously.
- *
- * During that time, WRITABLE callbacks will be suppressed.
- *
- * This is to handle corner cases where unexpectedly the OS refuses what we
- * usually expect it to accept. You should try to send in chunks that are
- * almost always accepted in order to avoid the inefficiency of the buffering.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_write(struct lws *wsi, unsigned char *buf, size_t len,
- enum lws_write_protocol protocol);
-
-/* helper for case where buffer may be const */
-#define lws_write_http(wsi, buf, len) \
- lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
-
-/* helper for multi-frame ws message flags */
-static LWS_INLINE int
-lws_write_ws_flags(int initial, int is_start, int is_end)
-{
- int r;
-
- if (is_start)
- r = initial;
- else
- r = LWS_WRITE_CONTINUATION;
-
- if (!is_end)
- r |= LWS_WRITE_NO_FIN;
-
- return r;
-}
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-writeable.h b/thirdparty/libwebsockets/include/libwebsockets/lws-writeable.h
deleted file mode 100644
index dd5659c3f0..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-writeable.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup callback-when-writeable Callback when writeable
- *
- * ##Callback When Writeable
- *
- * lws can only write data on a connection when it is able to accept more
- * data without blocking.
- *
- * So a basic requirement is we should only use the lws_write() apis when the
- * connection we want to write on says that he can accept more data.
- *
- * When lws cannot complete your send at the time, it will buffer the data
- * and send it in the background, suppressing any further WRITEABLE callbacks
- * on that connection until it completes. So it is important to write new
- * things in a new writeable callback.
- *
- * These apis reflect the various ways we can indicate we would like to be
- * called back when one or more connections is writeable.
- */
-///@{
-
-/**
- * lws_callback_on_writable() - Request a callback when this socket
- * becomes able to be written to without
- * blocking
- *
- * \param wsi: Websocket connection instance to get callback for
- *
- * - Which: only this wsi
- * - When: when the individual connection becomes writeable
- * - What: LWS_CALLBACK_*_WRITEABLE
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable(struct lws *wsi);
-
-/**
- * lws_callback_on_writable_all_protocol() - Request a callback for all
- * connections using the given protocol when it
- * becomes possible to write to each socket without
- * blocking in turn.
- *
- * \param context: lws_context
- * \param protocol: Protocol whose connections will get callbacks
- *
- * - Which: connections using this protocol on ANY VHOST
- * - When: when the individual connection becomes writeable
- * - What: LWS_CALLBACK_*_WRITEABLE
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable_all_protocol(const struct lws_context *context,
- const struct lws_protocols *protocol);
-
-/**
- * lws_callback_on_writable_all_protocol_vhost() - Request a callback for
- * all connections on same vhost using the given protocol
- * when it becomes possible to write to each socket without
- * blocking in turn.
- *
- * \param vhost: Only consider connections on this lws_vhost
- * \param protocol: Protocol whose connections will get callbacks
- *
- * - Which: connections using this protocol on GIVEN VHOST ONLY
- * - When: when the individual connection becomes writeable
- * - What: LWS_CALLBACK_*_WRITEABLE
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
- const struct lws_protocols *protocol);
-
-/**
- * lws_callback_all_protocol() - Callback all connections using
- * the given protocol with the given reason
- *
- * \param context: lws_context
- * \param protocol: Protocol whose connections will get callbacks
- * \param reason: Callback reason index
- *
- * - Which: connections using this protocol on ALL VHOSTS
- * - When: before returning
- * - What: reason
- *
- * This isn't normally what you want... normally any update of connection-
- * specific information can wait until a network-related callback like rx,
- * writable, or close.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_all_protocol(struct lws_context *context,
- const struct lws_protocols *protocol, int reason);
-
-/**
- * lws_callback_all_protocol_vhost() - Callback all connections using
- * the given protocol with the given reason. This is
- * deprecated since v2.4: use lws_callback_all_protocol_vhost_args
- *
- * \param vh: Vhost whose connections will get callbacks
- * \param protocol: Which protocol to match. NULL means all.
- * \param reason: Callback reason index
- *
- * - Which: connections using this protocol on GIVEN VHOST ONLY
- * - When: now
- * - What: reason
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_all_protocol_vhost(struct lws_vhost *vh,
- const struct lws_protocols *protocol,
- int reason)
-LWS_WARN_DEPRECATED;
-
-/**
- * lws_callback_all_protocol_vhost_args() - Callback all connections using
- * the given protocol with the given reason and args
- *
- * \param vh: Vhost whose connections will get callbacks
- * \param protocol: Which protocol to match. NULL means all.
- * \param reason: Callback reason index
- * \param argp: Callback "in" parameter
- * \param len: Callback "len" parameter
- *
- * - Which: connections using this protocol on GIVEN VHOST ONLY
- * - When: now
- * - What: reason
- */
-LWS_VISIBLE int
-lws_callback_all_protocol_vhost_args(struct lws_vhost *vh,
- const struct lws_protocols *protocol,
- int reason, void *argp, size_t len);
-
-/**
- * lws_callback_vhost_protocols() - Callback all protocols enabled on a vhost
- * with the given reason
- *
- * \param wsi: wsi whose vhost will get callbacks
- * \param reason: Callback reason index
- * \param in: in argument to callback
- * \param len: len argument to callback
- *
- * - Which: connections using this protocol on same VHOST as wsi ONLY
- * - When: now
- * - What: reason
- *
- * This is deprecated since v2.5, use lws_callback_vhost_protocols_vhost()
- * which takes the pointer to the vhost directly without using or needing the
- * wsi.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len)
-LWS_WARN_DEPRECATED;
-
-/**
- * lws_callback_vhost_protocols_vhost() - Callback all protocols enabled on a vhost
- * with the given reason
- *
- * \param vh: vhost that will get callbacks
- * \param reason: Callback reason index
- * \param in: in argument to callback
- * \param len: len argument to callback
- *
- * - Which: connections using this protocol on same VHOST as wsi ONLY
- * - When: now
- * - What: reason
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_vhost_protocols_vhost(struct lws_vhost *vh, int reason, void *in,
- size_t len);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
- void *user, void *in, size_t len);
-
-/**
- * lws_get_socket_fd() - returns the socket file descriptor
- *
- * This is needed to use sendto() on UDP raw sockets
- *
- * \param wsi: Websocket connection instance
- */
-LWS_VISIBLE LWS_EXTERN lws_sockfd_type
-lws_get_socket_fd(struct lws *wsi);
-
-/**
- * lws_get_peer_write_allowance() - get the amount of data writeable to peer
- * if known
- *
- * \param wsi: Websocket connection instance
- *
- * if the protocol does not have any guidance, returns -1. Currently only
- * http2 connections get send window information from this API. But your code
- * should use it so it can work properly with any protocol.
- *
- * If nonzero return is the amount of payload data the peer or intermediary has
- * reported it has buffer space for. That has NO relationship with the amount
- * of buffer space your OS can accept on this connection for a write action.
- *
- * This number represents the maximum you could send to the peer or intermediary
- * on this connection right now without the protocol complaining.
- *
- * lws manages accounting for send window updates and payload writes
- * automatically, so this number reflects the situation at the peer or
- * intermediary dynamically.
- */
-LWS_VISIBLE LWS_EXTERN lws_fileofs_t
-lws_get_peer_write_allowance(struct lws *wsi);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-ws-close.h b/thirdparty/libwebsockets/include/libwebsockets/lws-ws-close.h
deleted file mode 100644
index 9721e29233..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-ws-close.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup wsclose Websocket Close
- *
- * ##Websocket close frame control
- *
- * When we close a ws connection, we can send a reason code and a short
- * UTF-8 description back with the close packet.
- */
-///@{
-
-/*
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-/** enum lws_close_status - RFC6455 close status codes */
-enum lws_close_status {
- LWS_CLOSE_STATUS_NOSTATUS = 0,
- LWS_CLOSE_STATUS_NORMAL = 1000,
- /**< 1000 indicates a normal closure, meaning that the purpose for
- which the connection was established has been fulfilled. */
- LWS_CLOSE_STATUS_GOINGAWAY = 1001,
- /**< 1001 indicates that an endpoint is "going away", such as a server
- going down or a browser having navigated away from a page. */
- LWS_CLOSE_STATUS_PROTOCOL_ERR = 1002,
- /**< 1002 indicates that an endpoint is terminating the connection due
- to a protocol error. */
- LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE = 1003,
- /**< 1003 indicates that an endpoint is terminating the connection
- because it has received a type of data it cannot accept (e.g., an
- endpoint that understands only text data MAY send this if it
- receives a binary message). */
- LWS_CLOSE_STATUS_RESERVED = 1004,
- /**< Reserved. The specific meaning might be defined in the future. */
- LWS_CLOSE_STATUS_NO_STATUS = 1005,
- /**< 1005 is a reserved value and MUST NOT be set as a status code in a
- Close control frame by an endpoint. It is designated for use in
- applications expecting a status code to indicate that no status
- code was actually present. */
- LWS_CLOSE_STATUS_ABNORMAL_CLOSE = 1006,
- /**< 1006 is a reserved value and MUST NOT be set as a status code in a
- Close control frame by an endpoint. It is designated for use in
- applications expecting a status code to indicate that the
- connection was closed abnormally, e.g., without sending or
- receiving a Close control frame. */
- LWS_CLOSE_STATUS_INVALID_PAYLOAD = 1007,
- /**< 1007 indicates that an endpoint is terminating the connection
- because it has received data within a message that was not
- consistent with the type of the message (e.g., non-UTF-8 [RFC3629]
- data within a text message). */
- LWS_CLOSE_STATUS_POLICY_VIOLATION = 1008,
- /**< 1008 indicates that an endpoint is terminating the connection
- because it has received a message that violates its policy. This
- is a generic status code that can be returned when there is no
- other more suitable status code (e.g., 1003 or 1009) or if there
- is a need to hide specific details about the policy. */
- LWS_CLOSE_STATUS_MESSAGE_TOO_LARGE = 1009,
- /**< 1009 indicates that an endpoint is terminating the connection
- because it has received a message that is too big for it to
- process. */
- LWS_CLOSE_STATUS_EXTENSION_REQUIRED = 1010,
- /**< 1010 indicates that an endpoint (client) is terminating the
- connection because it has expected the server to negotiate one or
- more extension, but the server didn't return them in the response
- message of the WebSocket handshake. The list of extensions that
- are needed SHOULD appear in the /reason/ part of the Close frame.
- Note that this status code is not used by the server, because it
- can fail the WebSocket handshake instead */
- LWS_CLOSE_STATUS_UNEXPECTED_CONDITION = 1011,
- /**< 1011 indicates that a server is terminating the connection because
- it encountered an unexpected condition that prevented it from
- fulfilling the request. */
- LWS_CLOSE_STATUS_TLS_FAILURE = 1015,
- /**< 1015 is a reserved value and MUST NOT be set as a status code in a
- Close control frame by an endpoint. It is designated for use in
- applications expecting a status code to indicate that the
- connection was closed due to a failure to perform a TLS handshake
- (e.g., the server certificate can't be verified). */
-
- LWS_CLOSE_STATUS_CLIENT_TRANSACTION_DONE = 2000,
-
- /****** add new things just above ---^ ******/
-
- LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
-};
-
-/**
- * lws_close_reason - Set reason and aux data to send with Close packet
- * If you are going to return nonzero from the callback
- * requesting the connection to close, you can optionally
- * call this to set the reason the peer will be told if
- * possible.
- *
- * \param wsi: The websocket connection to set the close reason on
- * \param status: A valid close status from websocket standard
- * \param buf: NULL or buffer containing up to 124 bytes of auxiliary data
- * \param len: Length of data in \param buf to send
- */
-LWS_VISIBLE LWS_EXTERN void
-lws_close_reason(struct lws *wsi, enum lws_close_status status,
- unsigned char *buf, size_t len);
-
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-ws-ext.h b/thirdparty/libwebsockets/include/libwebsockets/lws-ws-ext.h
deleted file mode 100644
index 3face4f344..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-ws-ext.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/*! \defgroup extensions Extension related functions
- * ##Extension releated functions
- *
- * Ws defines optional extensions, lws provides the ability to implement these
- * in user code if so desired.
- *
- * We provide one extensions permessage-deflate.
- */
-///@{
-
-/*
- * NOTE: These public enums are part of the abi. If you want to add one,
- * add it at where specified so existing users are unaffected.
- */
-enum lws_extension_callback_reasons {
- LWS_EXT_CB_CONSTRUCT = 4,
- LWS_EXT_CB_CLIENT_CONSTRUCT = 5,
- LWS_EXT_CB_DESTROY = 8,
- LWS_EXT_CB_PACKET_TX_PRESEND = 12,
- LWS_EXT_CB_PAYLOAD_TX = 21,
- LWS_EXT_CB_PAYLOAD_RX = 22,
- LWS_EXT_CB_OPTION_DEFAULT = 23,
- LWS_EXT_CB_OPTION_SET = 24,
- LWS_EXT_CB_OPTION_CONFIRM = 25,
- LWS_EXT_CB_NAMED_OPTION_SET = 26,
-
- /****** add new things just above ---^ ******/
-};
-
-/** enum lws_ext_options_types */
-enum lws_ext_options_types {
- EXTARG_NONE, /**< does not take an argument */
- EXTARG_DEC, /**< requires a decimal argument */
- EXTARG_OPT_DEC /**< may have an optional decimal argument */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility */
-};
-
-/** struct lws_ext_options - Option arguments to the extension. These are
- * used in the negotiation at ws upgrade time.
- * The helper function lws_ext_parse_options()
- * uses these to generate callbacks */
-struct lws_ext_options {
- const char *name; /**< Option name, eg, "server_no_context_takeover" */
- enum lws_ext_options_types type; /**< What kind of args the option can take */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility */
-};
-
-/** struct lws_ext_option_arg */
-struct lws_ext_option_arg {
- const char *option_name; /**< may be NULL, option_index used then */
- int option_index; /**< argument ordinal to use if option_name missing */
- const char *start; /**< value */
- int len; /**< length of value */
-};
-
-/**
- * typedef lws_extension_callback_function() - Hooks to allow extensions to operate
- * \param context: Websockets context
- * \param ext: This extension
- * \param wsi: Opaque websocket instance pointer
- * \param reason: The reason for the call
- * \param user: Pointer to ptr to per-session user data allocated by library
- * \param in: Pointer used for some callback reasons
- * \param len: Length set for some callback reasons
- *
- * Each extension that is active on a particular connection receives
- * callbacks during the connection lifetime to allow the extension to
- * operate on websocket data and manage itself.
- *
- * Libwebsockets takes care of allocating and freeing "user" memory for
- * each active extension on each connection. That is what is pointed to
- * by the user parameter.
- *
- * LWS_EXT_CB_CONSTRUCT: called when the server has decided to
- * select this extension from the list provided by the client,
- * just before the server will send back the handshake accepting
- * the connection with this extension active. This gives the
- * extension a chance to initialize its connection context found
- * in user.
- *
- * LWS_EXT_CB_CLIENT_CONSTRUCT: same as LWS_EXT_CB_CONSTRUCT
- * but called when client is instantiating this extension. Some
- * extensions will work the same on client and server side and then
- * you can just merge handlers for both CONSTRUCTS.
- *
- * LWS_EXT_CB_DESTROY: called when the connection the extension was
- * being used on is about to be closed and deallocated. It's the
- * last chance for the extension to deallocate anything it has
- * allocated in the user data (pointed to by user) before the
- * user data is deleted. This same callback is used whether you
- * are in client or server instantiation context.
- *
- * LWS_EXT_CB_PACKET_TX_PRESEND: this works the same way as
- * LWS_EXT_CB_PACKET_RX_PREPARSE above, except it gives the
- * extension a chance to change websocket data just before it will
- * be sent out. Using the same lws_token pointer scheme in in,
- * the extension can change the buffer and the length to be
- * transmitted how it likes. Again if it wants to grow the
- * buffer safely, it should copy the data into its own buffer and
- * set the lws_tokens token pointer to it.
- *
- * LWS_EXT_CB_ARGS_VALIDATE:
- */
-typedef int
-lws_extension_callback_function(struct lws_context *context,
- const struct lws_extension *ext, struct lws *wsi,
- enum lws_extension_callback_reasons reason,
- void *user, void *in, size_t len);
-
-/** struct lws_extension - An extension we support */
-struct lws_extension {
- const char *name; /**< Formal extension name, eg, "permessage-deflate" */
- lws_extension_callback_function *callback; /**< Service callback */
- const char *client_offer; /**< String containing exts and options client offers */
-
- /* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibility */
-};
-
-/**
- * lws_set_extension_option(): set extension option if possible
- *
- * \param wsi: websocket connection
- * \param ext_name: name of ext, like "permessage-deflate"
- * \param opt_name: name of option, like "rx_buf_size"
- * \param opt_val: value to set option to
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_set_extension_option(struct lws *wsi, const char *ext_name,
- const char *opt_name, const char *opt_val);
-
-/**
- * lws_ext_parse_options() - deal with parsing negotiated extension options
- *
- * \param ext: related extension struct
- * \param wsi: websocket connection
- * \param ext_user: per-connection extension private data
- * \param opts: list of supported options
- * \param o: option string to parse
- * \param len: length
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
- void *ext_user, const struct lws_ext_options *opts,
- const char *o, int len);
-
-/** lws_extension_callback_pm_deflate() - extension for RFC7692
- *
- * \param context: lws context
- * \param ext: related lws_extension struct
- * \param wsi: websocket connection
- * \param reason: incoming callback reason
- * \param user: per-connection extension private data
- * \param in: pointer parameter
- * \param len: length parameter
- *
- * Built-in callback implementing RFC7692 permessage-deflate
- */
-LWS_EXTERN int
-lws_extension_callback_pm_deflate(struct lws_context *context,
- const struct lws_extension *ext,
- struct lws *wsi,
- enum lws_extension_callback_reasons reason,
- void *user, void *in, size_t len);
-
-/*
- * The internal exts are part of the public abi
- * If we add more extensions, publish the callback here ------v
- */
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-ws-state.h b/thirdparty/libwebsockets/include/libwebsockets/lws-ws-state.h
deleted file mode 100644
index 3f65724a7a..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-ws-state.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-/** \defgroup wsstatus Websocket status APIs
- * ##Websocket connection status APIs
- *
- * These provide information about ws connection or message status
- */
-///@{
-/**
- * lws_send_pipe_choked() - tests if socket is writable or not
- * \param wsi: lws connection
- *
- * Allows you to check if you can write more on the socket
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_send_pipe_choked(struct lws *wsi);
-
-/**
- * lws_is_final_fragment() - tests if last part of ws message
- *
- * \param wsi: lws connection
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_is_final_fragment(struct lws *wsi);
-
-/**
- * lws_is_first_fragment() - tests if first part of ws message
- *
- * \param wsi: lws connection
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_is_first_fragment(struct lws *wsi);
-
-/**
- * lws_get_reserved_bits() - access reserved bits of ws frame
- * \param wsi: lws connection
- */
-LWS_VISIBLE LWS_EXTERN unsigned char
-lws_get_reserved_bits(struct lws *wsi);
-
-/**
- * lws_partial_buffered() - find out if lws buffered the last write
- * \param wsi: websocket connection to check
- *
- * Returns 1 if you cannot use lws_write because the last
- * write on this connection is still buffered, and can't be cleared without
- * returning to the service loop and waiting for the connection to be
- * writeable again.
- *
- * If you will try to do >1 lws_write call inside a single
- * WRITEABLE callback, you must check this after every write and bail if
- * set, ask for a new writeable callback and continue writing from there.
- *
- * This is never set at the start of a writeable callback, but any write
- * may set it.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_partial_buffered(struct lws *wsi);
-
-/**
- * lws_frame_is_binary(): true if the current frame was sent in binary mode
- *
- * \param wsi: the connection we are inquiring about
- *
- * This is intended to be called from the LWS_CALLBACK_RECEIVE callback if
- * it's interested to see if the frame it's dealing with was sent in binary
- * mode.
- */
-LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_frame_is_binary(struct lws *wsi);
-///@}
diff --git a/thirdparty/libwebsockets/include/libwebsockets/lws-x509.h b/thirdparty/libwebsockets/include/libwebsockets/lws-x509.h
deleted file mode 100644
index f8e5cb0fad..0000000000
--- a/thirdparty/libwebsockets/include/libwebsockets/lws-x509.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * included from libwebsockets.h
- */
-
-enum lws_tls_cert_info {
- LWS_TLS_CERT_INFO_VALIDITY_FROM,
- /**< fills .time with the time_t the cert validity started from */
- LWS_TLS_CERT_INFO_VALIDITY_TO,
- /**< fills .time with the time_t the cert validity ends at */
- LWS_TLS_CERT_INFO_COMMON_NAME,
- /**< fills up to len bytes of .ns.name with the cert common name */
- LWS_TLS_CERT_INFO_ISSUER_NAME,
- /**< fills up to len bytes of .ns.name with the cert issuer name */
- LWS_TLS_CERT_INFO_USAGE,
- /**< fills verified with a bitfield asserting the valid uses */
- LWS_TLS_CERT_INFO_VERIFIED,
- /**< fills .verified with a bool representing peer cert validity,
- * call returns -1 if no cert */
- LWS_TLS_CERT_INFO_OPAQUE_PUBLIC_KEY,
- /**< the certificate's public key, as an opaque bytestream. These
- * opaque bytestreams can only be compared with each other using the
- * same tls backend, ie, OpenSSL or mbedTLS. The different backends
- * produce different, incompatible representations for the same cert.
- */
-};
-
-union lws_tls_cert_info_results {
- unsigned int verified;
- time_t time;
- unsigned int usage;
- struct {
- int len;
- /* KEEP LAST... notice the [64] is only there because
- * name[] is not allowed in a union. The actual length of
- * name[] is arbitrary and is passed into the api using the
- * len parameter. Eg
- *
- * char big[1024];
- * union lws_tls_cert_info_results *buf =
- * (union lws_tls_cert_info_results *)big;
- *
- * lws_tls_peer_cert_info(wsi, type, buf, sizeof(big) -
- * sizeof(*buf) + sizeof(buf->ns.name));
- */
- char name[64];
- } ns;
-};
-
-/**
- * lws_tls_peer_cert_info() - get information from the peer's TLS cert
- *
- * \param wsi: the connection to query
- * \param type: one of LWS_TLS_CERT_INFO_
- * \param buf: pointer to union to take result
- * \param len: when result is a string, the true length of buf->ns.name[]
- *
- * lws_tls_peer_cert_info() lets you get hold of information from the peer
- * certificate.
- *
- * Return 0 if there is a result in \p buf, or -1 indicating there was no cert
- * or another problem.
- *
- * This function works the same no matter if the TLS backend is OpenSSL or
- * mbedTLS.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_tls_peer_cert_info(struct lws *wsi, enum lws_tls_cert_info type,
- union lws_tls_cert_info_results *buf, size_t len);
-
-/**
- * lws_tls_vhost_cert_info() - get information from the vhost's own TLS cert
- *
- * \param vhost: the vhost to query
- * \param type: one of LWS_TLS_CERT_INFO_
- * \param buf: pointer to union to take result
- * \param len: when result is a string, the true length of buf->ns.name[]
- *
- * lws_tls_vhost_cert_info() lets you get hold of information from the vhost
- * certificate.
- *
- * Return 0 if there is a result in \p buf, or -1 indicating there was no cert
- * or another problem.
- *
- * This function works the same no matter if the TLS backend is OpenSSL or
- * mbedTLS.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_tls_vhost_cert_info(struct lws_vhost *vhost, enum lws_tls_cert_info type,
- union lws_tls_cert_info_results *buf, size_t len);
-
-/**
- * lws_tls_acme_sni_cert_create() - creates a temp selfsigned cert
- * and attaches to a vhost
- *
- * \param vhost: the vhost to acquire the selfsigned cert
- * \param san_a: SAN written into the certificate
- * \param san_b: second SAN written into the certificate
- *
- *
- * Returns 0 if created and attached to the vhost. Returns -1 if problems and
- * frees all allocations before returning.
- *
- * On success, any allocations are destroyed at vhost destruction automatically.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
- const char *san_b);
-
-/**
- * lws_tls_acme_sni_csr_create() - creates a CSR and related private key PEM
- *
- * \param context: lws_context used for random
- * \param elements: array of LWS_TLS_REQ_ELEMENT_COUNT const char *
- * \param csr: buffer that will get the b64URL(ASN-1 CSR)
- * \param csr_len: max length of the csr buffer
- * \param privkey_pem: pointer to pointer allocated to hold the privkey_pem
- * \param privkey_len: pointer to size_t set to the length of the privkey_pem
- *
- * Creates a CSR according to the information in \p elements, and a private
- * RSA key used to sign the CSR.
- *
- * The outputs are the b64URL(ASN-1 CSR) into csr, and the PEM private key into
- * privkey_pem.
- *
- * Notice that \p elements points to an array of const char *s pointing to the
- * information listed in the enum above. If an entry is NULL or an empty
- * string, the element is set to "none" in the CSR.
- *
- * Returns 0 on success or nonzero for failure.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_tls_acme_sni_csr_create(struct lws_context *context, const char *elements[],
- uint8_t *csr, size_t csr_len, char **privkey_pem,
- size_t *privkey_len);
-
-/**
- * lws_tls_cert_updated() - update every vhost using the given cert path
- *
- * \param context: our lws_context
- * \param certpath: the filepath to the certificate
- * \param keypath: the filepath to the private key of the certificate
- * \param mem_cert: copy of the cert in memory
- * \param len_mem_cert: length of the copy of the cert in memory
- * \param mem_privkey: copy of the private key in memory
- * \param len_mem_privkey: length of the copy of the private key in memory
- *
- * Checks every vhost to see if it is the using certificate described by the
- * the given filepaths. If so, it attempts to update the vhost ssl_ctx to use
- * the new certificate.
- *
- * Returns 0 on success or nonzero for failure.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_tls_cert_updated(struct lws_context *context, const char *certpath,
- const char *keypath,
- const char *mem_cert, size_t len_mem_cert,
- const char *mem_privkey, size_t len_mem_privkey);
-
diff --git a/thirdparty/libwebsockets/ipv6_fixes.diff b/thirdparty/libwebsockets/ipv6_fixes.diff
index 5fa1e5c520..fe3e5e4b63 100644
--- a/thirdparty/libwebsockets/ipv6_fixes.diff
+++ b/thirdparty/libwebsockets/ipv6_fixes.diff
@@ -1,8 +1,8 @@
-diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
-index 693efd28e..192dddee6 100644
---- a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
-+++ b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
-@@ -73,6 +73,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd, int unix_skt)
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-unix.c b/thirdparty/libwebsockets/plat/lws-plat-unix.c
+index 7dba3bd82..d1bca8b5d 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-unix.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-unix.c
+@@ -328,6 +328,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
int optval = 1;
socklen_t optlen = sizeof(optval);
@@ -14,11 +14,11 @@ index 693efd28e..192dddee6 100644
#if defined(__APPLE__) || \
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || \
-diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
-index bf0935057..62a0a4984 100644
---- a/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
-+++ b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
-@@ -56,6 +56,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
+index 1850b6425..26caab2cd 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
+@@ -348,6 +348,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
struct protoent *tcp_proto;
#endif
diff --git a/thirdparty/libwebsockets/lib/core/adopt.c b/thirdparty/libwebsockets/lib/core/adopt.c
deleted file mode 100644
index 49ac5af161..0000000000
--- a/thirdparty/libwebsockets/lib/core/adopt.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "core/private.h"
-
-
-static int
-lws_get_idlest_tsi(struct lws_context *context)
-{
- unsigned int lowest = ~0;
- int n = 0, hit = -1;
-
- for (; n < context->count_threads; n++) {
- if ((unsigned int)context->pt[n].fds_count !=
- context->fd_limit_per_thread - 1 &&
- (unsigned int)context->pt[n].fds_count < lowest) {
- lowest = context->pt[n].fds_count;
- hit = n;
- }
- }
-
- return hit;
-}
-
-struct lws *
-lws_create_new_server_wsi(struct lws_vhost *vhost, int fixed_tsi)
-{
- struct lws *new_wsi;
- int n = fixed_tsi;
-
- if (n < 0)
- n = lws_get_idlest_tsi(vhost->context);
-
- if (n < 0) {
- lwsl_err("no space for new conn\n");
- return NULL;
- }
-
- new_wsi = lws_zalloc(sizeof(struct lws), "new server wsi");
- if (new_wsi == NULL) {
- lwsl_err("Out of memory for new connection\n");
- return NULL;
- }
-
- new_wsi->tsi = n;
- lwsl_debug("new wsi %p joining vhost %s, tsi %d\n", new_wsi,
- vhost->name, new_wsi->tsi);
-
- lws_vhost_bind_wsi(vhost, new_wsi);
- new_wsi->context = vhost->context;
- new_wsi->pending_timeout = NO_PENDING_TIMEOUT;
- new_wsi->rxflow_change_to = LWS_RXFLOW_ALLOW;
-
- /* initialize the instance struct */
-
- lwsi_set_state(new_wsi, LRS_UNCONNECTED);
- new_wsi->hdr_parsing_completed = 0;
-
-#ifdef LWS_WITH_TLS
- new_wsi->tls.use_ssl = LWS_SSL_ENABLED(vhost);
-#endif
-
- /*
- * these can only be set once the protocol is known
- * we set an un-established connection's protocol pointer
- * to the start of the supported list, so it can look
- * for matching ones during the handshake
- */
- new_wsi->protocol = vhost->protocols;
- new_wsi->user_space = NULL;
- new_wsi->desc.sockfd = LWS_SOCK_INVALID;
- new_wsi->position_in_fds_table = LWS_NO_FDS_POS;
-
- vhost->context->count_wsi_allocated++;
-
- /*
- * outermost create notification for wsi
- * no user_space because no protocol selection
- */
- vhost->protocols[0].callback(new_wsi, LWS_CALLBACK_WSI_CREATE, NULL,
- NULL, 0);
-
- return new_wsi;
-}
-
-
-/* if not a socket, it's a raw, non-ssl file descriptor */
-
-LWS_VISIBLE struct lws *
-lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
- lws_sock_file_fd_type fd, const char *vh_prot_name,
- struct lws *parent)
-{
- struct lws_context *context = vh->context;
- struct lws *new_wsi;
- struct lws_context_per_thread *pt;
- int n;
-
-#if defined(LWS_WITH_PEER_LIMITS)
- struct lws_peer *peer = NULL;
-
- if (type & LWS_ADOPT_SOCKET) {
- peer = lws_get_or_create_peer(vh, fd.sockfd);
-
- if (peer && context->ip_limit_wsi &&
- peer->count_wsi >= context->ip_limit_wsi) {
- lwsl_notice("Peer reached wsi limit %d\n",
- context->ip_limit_wsi);
- lws_stats_atomic_bump(context, &context->pt[0],
- LWSSTATS_C_PEER_LIMIT_WSI_DENIED,
- 1);
- return NULL;
- }
- }
-#endif
-
- n = -1;
- if (parent)
- n = parent->tsi;
- new_wsi = lws_create_new_server_wsi(vh, n);
- if (!new_wsi) {
- if (type & LWS_ADOPT_SOCKET)
- compatible_close(fd.sockfd);
- return NULL;
- }
-#if defined(LWS_WITH_PEER_LIMITS)
- if (peer)
- lws_peer_add_wsi(context, peer, new_wsi);
-#endif
- pt = &context->pt[(int)new_wsi->tsi];
- lws_stats_atomic_bump(context, pt, LWSSTATS_C_CONNECTIONS, 1);
-
- if (parent) {
- new_wsi->parent = parent;
- new_wsi->sibling_list = parent->child_list;
- parent->child_list = new_wsi;
- }
-
- new_wsi->desc = fd;
-
- if (vh_prot_name) {
- new_wsi->protocol = lws_vhost_name_to_protocol(new_wsi->vhost,
- vh_prot_name);
- if (!new_wsi->protocol) {
- lwsl_err("Protocol %s not enabled on vhost %s\n",
- vh_prot_name, new_wsi->vhost->name);
- goto bail;
- }
- if (lws_ensure_user_space(new_wsi)) {
- lwsl_notice("OOM trying to get user_space\n");
- goto bail;
- }
- }
-
- if (!LWS_SSL_ENABLED(new_wsi->vhost) || !(type & LWS_ADOPT_SOCKET))
- type &= ~LWS_ADOPT_ALLOW_SSL;
-
- if (lws_role_call_adoption_bind(new_wsi, type, vh_prot_name)) {
- lwsl_err("Unable to find a role that can adopt descriptor\n");
- goto bail;
- }
-
- /*
- * A new connection was accepted. Give the user a chance to
- * set properties of the newly created wsi. There's no protocol
- * selected yet so we issue this to the vhosts's default protocol,
- * itself by default protocols[0]
- */
- n = LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED;
- if (!(type & LWS_ADOPT_HTTP)) {
- if (!(type & LWS_ADOPT_SOCKET))
- n = LWS_CALLBACK_RAW_ADOPT_FILE;
- else
- n = LWS_CALLBACK_RAW_ADOPT;
- }
-
- lwsl_debug("new wsi wsistate 0x%x\n", new_wsi->wsistate);
-
- if (context->event_loop_ops->accept)
- if (context->event_loop_ops->accept(new_wsi))
- goto fail;
-
- if (!(type & LWS_ADOPT_ALLOW_SSL)) {
- lws_pt_lock(pt, __func__);
- if (__insert_wsi_socket_into_fds(context, new_wsi)) {
- lws_pt_unlock(pt);
- lwsl_err("%s: fail inserting socket\n", __func__);
- goto fail;
- }
- lws_pt_unlock(pt);
- } else
- if (lws_server_socket_service_ssl(new_wsi, fd.sockfd)) {
- lwsl_info("%s: fail ssl negotiation\n", __func__);
- goto fail;
- }
-
- /*
- * by deferring callback to this point, after insertion to fds,
- * lws_callback_on_writable() can work from the callback
- */
- if ((new_wsi->protocol->callback)(new_wsi, n, new_wsi->user_space,
- NULL, 0))
- goto fail;
-
- /* role may need to do something after all adoption completed */
-
- lws_role_call_adoption_bind(new_wsi, type | _LWS_ADOPT_FINISH,
- vh_prot_name);
-
- lws_cancel_service_pt(new_wsi);
-
- return new_wsi;
-
-fail:
- if (type & LWS_ADOPT_SOCKET)
- lws_close_free_wsi(new_wsi, LWS_CLOSE_STATUS_NOSTATUS,
- "adopt skt fail");
-
- return NULL;
-
-bail:
- lwsl_notice("%s: exiting on bail\n", __func__);
- if (parent)
- parent->child_list = new_wsi->sibling_list;
- if (new_wsi->user_space)
- lws_free(new_wsi->user_space);
-
- vh->context->count_wsi_allocated--;
-
- lws_vhost_unbind_wsi(new_wsi);
- lws_free(new_wsi);
-
- compatible_close(fd.sockfd);
-
- return NULL;
-}
-
-LWS_VISIBLE struct lws *
-lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd)
-{
- lws_sock_file_fd_type fd;
-
- fd.sockfd = accept_fd;
- return lws_adopt_descriptor_vhost(vh, LWS_ADOPT_SOCKET |
- LWS_ADOPT_HTTP | LWS_ADOPT_ALLOW_SSL, fd, NULL, NULL);
-}
-
-LWS_VISIBLE struct lws *
-lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd)
-{
- return lws_adopt_socket_vhost(context->vhost_list, accept_fd);
-}
-
-/* Common read-buffer adoption for lws_adopt_*_readbuf */
-static struct lws*
-adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
-{
- struct lws_context_per_thread *pt;
- struct lws_pollfd *pfd;
- int n;
-
- if (!wsi)
- return NULL;
-
- if (!readbuf || len == 0)
- return wsi;
-
- if (wsi->position_in_fds_table == LWS_NO_FDS_POS)
- return wsi;
-
- pt = &wsi->context->pt[(int)wsi->tsi];
-
- n = lws_buflist_append_segment(&wsi->buflist, (const uint8_t *)readbuf,
- len);
- if (n < 0)
- goto bail;
- if (n)
- lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
-
- /*
- * we can't process the initial read data until we can attach an ah.
- *
- * if one is available, get it and place the data in his ah rxbuf...
- * wsi with ah that have pending rxbuf get auto-POLLIN service.
- *
- * no autoservice because we didn't get a chance to attach the
- * readbuf data to wsi or ah yet, and we will do it next if we get
- * the ah.
- */
- if (wsi->http.ah || !lws_header_table_attach(wsi, 0)) {
-
- lwsl_notice("%s: calling service on readbuf ah\n", __func__);
-
- /*
- * unlike a normal connect, we have the headers already
- * (or the first part of them anyway).
- * libuv won't come back and service us without a network
- * event, so we need to do the header service right here.
- */
- pfd = &pt->fds[wsi->position_in_fds_table];
- pfd->revents |= LWS_POLLIN;
- lwsl_err("%s: calling service\n", __func__);
- if (lws_service_fd_tsi(wsi->context, pfd, wsi->tsi))
- /* service closed us */
- return NULL;
-
- return wsi;
- }
- lwsl_err("%s: deferring handling ah\n", __func__);
-
- return wsi;
-
-bail:
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
- "adopt skt readbuf fail");
-
- return NULL;
-}
-
-LWS_EXTERN struct lws *
-lws_create_adopt_udp(struct lws_vhost *vhost, int port, int flags,
- const char *protocol_name, struct lws *parent_wsi)
-{
- lws_sock_file_fd_type sock;
- struct addrinfo h, *r, *rp;
- struct lws *wsi = NULL;
- char buf[16];
- int n;
-
- memset(&h, 0, sizeof(h));
- h.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
- h.ai_socktype = SOCK_DGRAM;
- h.ai_protocol = IPPROTO_UDP;
- h.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
-
- lws_snprintf(buf, sizeof(buf), "%u", port);
- n = getaddrinfo(NULL, buf, &h, &r);
- if (n) {
- lwsl_info("%s: getaddrinfo error: %s\n", __func__,
- gai_strerror(n));
- goto bail;
- }
-
- for (rp = r; rp; rp = rp->ai_next) {
- sock.sockfd = socket(rp->ai_family, rp->ai_socktype,
- rp->ai_protocol);
- if (sock.sockfd != LWS_SOCK_INVALID)
- break;
- }
- if (!rp) {
- lwsl_err("%s: unable to create INET socket\n", __func__);
- goto bail1;
- }
-
- if ((flags & LWS_CAUDP_BIND) && bind(sock.sockfd, rp->ai_addr,
-#if defined(_WIN32)
- (int)rp->ai_addrlen
-#else
- rp->ai_addrlen
-#endif
- ) == -1) {
- lwsl_err("%s: bind failed\n", __func__);
- goto bail2;
- }
-
- wsi = lws_adopt_descriptor_vhost(vhost, LWS_ADOPT_RAW_SOCKET_UDP, sock,
- protocol_name, parent_wsi);
- if (!wsi)
- lwsl_err("%s: udp adoption failed\n", __func__);
-
-bail2:
- if (!wsi)
- compatible_close((int)sock.sockfd);
-bail1:
- freeaddrinfo(r);
-
-bail:
- return wsi;
-}
-
-LWS_VISIBLE struct lws *
-lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
- const char *readbuf, size_t len)
-{
- return adopt_socket_readbuf(lws_adopt_socket(context, accept_fd),
- readbuf, len);
-}
-
-LWS_VISIBLE struct lws *
-lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost,
- lws_sockfd_type accept_fd,
- const char *readbuf, size_t len)
-{
- return adopt_socket_readbuf(lws_adopt_socket_vhost(vhost, accept_fd),
- readbuf, len);
-}
diff --git a/thirdparty/libwebsockets/lib/core/connect.c b/thirdparty/libwebsockets/lib/core/connect.c
deleted file mode 100644
index daffc193c8..0000000000
--- a/thirdparty/libwebsockets/lib/core/connect.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "core/private.h"
-
-void
-lws_client_stash_destroy(struct lws *wsi)
-{
- if (!wsi || !wsi->stash)
- return;
-
- lws_free_set_NULL(wsi->stash->address);
- lws_free_set_NULL(wsi->stash->path);
- lws_free_set_NULL(wsi->stash->host);
- lws_free_set_NULL(wsi->stash->origin);
- lws_free_set_NULL(wsi->stash->protocol);
- lws_free_set_NULL(wsi->stash->method);
- lws_free_set_NULL(wsi->stash->iface);
- lws_free_set_NULL(wsi->stash->alpn);
-
- lws_free_set_NULL(wsi->stash);
-}
-
-LWS_VISIBLE struct lws *
-lws_client_connect_via_info(const struct lws_client_connect_info *i)
-{
- struct lws *wsi, *safe = NULL;
- const struct lws_protocols *p;
- const char *local = i->protocol;
-#if LWS_MAX_SMP > 1
- int n, tid;
-#endif
-
- if (i->context->requested_kill)
- return NULL;
-
- if (!i->context->protocol_init_done)
- lws_protocol_init(i->context);
- /*
- * If we have .local_protocol_name, use it to select the local protocol
- * handler to bind to. Otherwise use .protocol if http[s].
- */
- if (i->local_protocol_name)
- local = i->local_protocol_name;
-
- /* PHASE 1: create a bare wsi */
-
- wsi = lws_zalloc(sizeof(struct lws), "client wsi");
- if (wsi == NULL)
- goto bail;
-
- wsi->context = i->context;
- wsi->desc.sockfd = LWS_SOCK_INVALID;
-
- wsi->vhost = NULL;
- if (!i->vhost)
- lws_vhost_bind_wsi(i->context->vhost_list, wsi);
- else
- lws_vhost_bind_wsi(i->vhost, wsi);
-
- if (!wsi->vhost) {
- lwsl_err("%s: No vhost in the context\n", __func__);
-
- goto bail;
- }
-
- /*
- * PHASE 2: if SMP, bind the client to whatever tsi the current thread
- * represents
- */
-
-#if LWS_MAX_SMP > 1
- tid = wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_GET_THREAD_ID,
- NULL, NULL, 0);
-
- lws_context_lock(i->context, "client find tsi");
-
- for (n = 0; n < i->context->count_threads; n++)
- if (i->context->pt[n].service_tid == tid) {
- lwsl_info("%s: client binds to caller tsi %d\n",
- __func__, n);
- wsi->tsi = n;
- break;
- }
-
- /*
- * this binding is sort of provisional, since when we try to insert
- * into the pt fds, there may be no space and it will fail
- */
-
- lws_context_unlock(i->context);
-#endif
-
- /*
- * PHASE 3: Choose an initial role for the wsi and do role-specific init
- *
- * Note the initial role may not reflect the final role, eg,
- * we may want ws, but first we have to go through h1 to get that
- */
-
- lws_role_call_client_bind(wsi, i);
-
- /*
- * PHASE 4: fill up the wsi with stuff from the connect_info as far as
- * it can go. It's uncertain because not only is our connection
- * going to complete asynchronously, we might have bound to h1 and not
- * even be able to get ahold of an ah immediately.
- */
-
- wsi->user_space = NULL;
- wsi->pending_timeout = NO_PENDING_TIMEOUT;
- wsi->position_in_fds_table = LWS_NO_FDS_POS;
- wsi->c_port = i->port;
-
- wsi->protocol = &wsi->vhost->protocols[0];
- wsi->client_pipeline = !!(i->ssl_connection & LCCSCF_PIPELINE);
-
- /*
- * PHASE 5: handle external user_space now, generic alloc is done in
- * role finalization
- */
-
- if (!wsi->user_space && i->userdata) {
- wsi->user_space_externally_allocated = 1;
- wsi->user_space = i->userdata;
- }
-
- if (local) {
- lwsl_info("%s: protocol binding to %s\n", __func__, local);
- p = lws_vhost_name_to_protocol(wsi->vhost, local);
- if (p)
- lws_bind_protocol(wsi, p, __func__);
- }
-
- /*
- * PHASE 5: handle external user_space now, generic alloc is done in
- * role finalization
- */
-
- if (!wsi->user_space && i->userdata) {
- wsi->user_space_externally_allocated = 1;
- wsi->user_space = i->userdata;
- }
-
-#if defined(LWS_WITH_TLS)
- wsi->tls.use_ssl = i->ssl_connection;
-#else
- if (i->ssl_connection & LCCSCF_USE_SSL) {
- lwsl_err("%s: lws not configured for tls\n", __func__);
- goto bail;
- }
-#endif
-
- /*
- * PHASE 6: stash the things from connect_info that we can't process
- * right now, eg, if http binding, without an ah. If h1 and no ah, we
- * will go on the ah waiting list and process those things later (after
- * the connect_info and maybe the things pointed to have gone out of
- * scope)
- *
- * However these things are stashed in a generic way at this point,
- * with no relationship to http or ah
- */
-
- wsi->stash = lws_zalloc(sizeof(*wsi->stash), "client stash");
- if (!wsi->stash) {
- lwsl_err("%s: OOM\n", __func__);
- goto bail1;
- }
-
- wsi->stash->address = lws_strdup(i->address);
- wsi->stash->path = lws_strdup(i->path);
- wsi->stash->host = lws_strdup(i->host);
-
- if (!wsi->stash->address || !wsi->stash->path || !wsi->stash->host)
- goto bail1;
-
- if (i->origin) {
- wsi->stash->origin = lws_strdup(i->origin);
- if (!wsi->stash->origin)
- goto bail1;
- }
- if (i->protocol) {
- wsi->stash->protocol = lws_strdup(i->protocol);
- if (!wsi->stash->protocol)
- goto bail1;
- }
- if (i->method) {
- wsi->stash->method = lws_strdup(i->method);
- if (!wsi->stash->method)
- goto bail1;
- }
- if (i->iface) {
- wsi->stash->iface = lws_strdup(i->iface);
- if (!wsi->stash->iface)
- goto bail1;
- }
- if (i->alpn) {
- wsi->stash->alpn = lws_strdup(i->alpn);
- if (!wsi->stash->alpn)
- goto bail1;
- }
-
- /*
- * at this point user callbacks like
- * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER will be interested to
- * know the parent... eg for proxying we can grab extra headers from
- * the parent's incoming ah and add them to the child client handshake
- */
-
- if (i->parent_wsi) {
- lwsl_info("%s: created child %p of parent %p\n", __func__,
- wsi, i->parent_wsi);
- wsi->parent = i->parent_wsi;
- safe = wsi->sibling_list = i->parent_wsi->child_list;
- i->parent_wsi->child_list = wsi;
- }
-
- /*
- * PHASE 7: Do any role-specific finalization processing. We can still
- * see important info things via wsi->stash
- */
-
- if (wsi->role_ops->client_bind) {
- int n = wsi->role_ops->client_bind(wsi, NULL);
-
- if (n && i->parent_wsi) {
- /* unpick from parent */
-
- i->parent_wsi->child_list = safe;
- }
-
- if (n < 0)
- /* we didn't survive, wsi is freed */
- goto bail2;
-
- if (n)
- /* something else failed, wsi needs freeing */
- goto bail;
- }
-
- /* let the caller's optional wsi storage have the wsi we created */
-
- if (i->pwsi)
- *i->pwsi = wsi;
-
-
-#if defined(LWS_WITH_HUBBUB)
- if (i->uri_replace_to)
- wsi->http.rw = lws_rewrite_create(wsi, html_parser_cb,
- i->uri_replace_from,
- i->uri_replace_to);
-#endif
-
- return wsi;
-
-bail1:
- lws_client_stash_destroy(wsi);
-
-bail:
- lws_free(wsi);
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
-bail2:
-#endif
- if (i->pwsi)
- *i->pwsi = NULL;
-
- return NULL;
-}
diff --git a/thirdparty/libwebsockets/lib/core/dummy-callback.c b/thirdparty/libwebsockets/lib/core/dummy-callback.c
deleted file mode 100644
index 8fd18be9c5..0000000000
--- a/thirdparty/libwebsockets/lib/core/dummy-callback.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "core/private.h"
-
-#if defined(LWS_WITH_HTTP_PROXY)
-static int
-proxy_header(struct lws *wsi, struct lws *par, unsigned char *temp,
- int temp_len, int index, unsigned char **p, unsigned char *end)
-{
- int n = lws_hdr_total_length(par, index);
-
- if (n < 1) {
- lwsl_debug("%s: no index %d:\n", __func__, index);
- return 0;
- }
-
- if (lws_hdr_copy(par, (char *)temp, temp_len, index) < 0)
- return -1;
-
- lwsl_debug("%s: index %d: %s\n", __func__, index, (char *)temp);
-
- if (lws_add_http_header_by_token(wsi, index, temp, n, p, end))
- return -1;
-
- return 0;
-}
-
-static int
-stream_close(struct lws *wsi)
-{
- char buf[LWS_PRE + 6], *out = buf + LWS_PRE;
-
- if (wsi->http.did_stream_close)
- return 0;
-
- wsi->http.did_stream_close = 1;
-
- if (wsi->http2_substream) {
- if (lws_write(wsi, (unsigned char *)buf + LWS_PRE, 0,
- LWS_WRITE_HTTP_FINAL) < 0) {
- lwsl_info("%s: COMPL_CLIENT_HTTP: h2 fin wr failed\n",
- __func__);
-
- return -1;
- }
- } else {
- *out++ = '0';
- *out++ = '\x0d';
- *out++ = '\x0a';
- *out++ = '\x0d';
- *out++ = '\x0a';
-
- if (lws_write(wsi, (unsigned char *)buf + LWS_PRE, 5,
- LWS_WRITE_HTTP_FINAL) < 0) {
- lwsl_err("%s: COMPL_CLIENT_HTTP: "
- "h2 final write failed\n", __func__);
-
- return -1;
- }
- }
-
- return 0;
-}
-
-#endif
-
-LWS_VISIBLE int
-lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
- void *user, void *in, size_t len)
-{
- struct lws_ssl_info *si;
-#ifdef LWS_WITH_CGI
- struct lws_cgi_args *args;
-#endif
-#if defined(LWS_WITH_CGI) || defined(LWS_WITH_HTTP_PROXY)
- char buf[8192];
- int n;
-#endif
-#if defined(LWS_WITH_HTTP_PROXY)
- unsigned char **p, *end;
- struct lws *parent;
-#endif
-
- switch (reason) {
-#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
- case LWS_CALLBACK_HTTP:
-#ifndef LWS_NO_SERVER
- if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL))
- return -1;
-
- if (lws_http_transaction_completed(wsi))
-#endif
- return -1;
- break;
-#if !defined(LWS_NO_SERVER)
- case LWS_CALLBACK_HTTP_BODY_COMPLETION:
- case LWS_CALLBACK_HTTP_FILE_COMPLETION:
- if (lws_http_transaction_completed(wsi))
- return -1;
- break;
-#endif
-
- case LWS_CALLBACK_HTTP_WRITEABLE:
-#ifdef LWS_WITH_CGI
- if (wsi->reason_bf & (LWS_CB_REASON_AUX_BF__CGI_HEADERS |
- LWS_CB_REASON_AUX_BF__CGI)) {
- n = lws_cgi_write_split_stdout_headers(wsi);
- if (n < 0) {
- lwsl_debug("AUX_BF__CGI forcing close\n");
- return -1;
- }
- if (!n)
- lws_rx_flow_control(
- wsi->http.cgi->stdwsi[LWS_STDOUT], 1);
-
- if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_HEADERS)
- wsi->reason_bf &=
- ~LWS_CB_REASON_AUX_BF__CGI_HEADERS;
- else
- wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__CGI;
-
- if (wsi->http.cgi && wsi->http.cgi->cgi_transaction_over)
- return -1;
- break;
- }
-
- if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_CHUNK_END) {
- if (!wsi->http2_substream) {
- memcpy(buf + LWS_PRE, "0\x0d\x0a\x0d\x0a", 5);
- lwsl_debug("writing chunk term and exiting\n");
- n = lws_write(wsi, (unsigned char *)buf +
- LWS_PRE, 5, LWS_WRITE_HTTP);
- } else
- n = lws_write(wsi, (unsigned char *)buf +
- LWS_PRE, 0,
- LWS_WRITE_HTTP_FINAL);
-
- /* always close after sending it */
- return -1;
- }
-#endif
-#if defined(LWS_WITH_HTTP_PROXY)
-
- if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__PROXY_HEADERS) {
-
- wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__PROXY_HEADERS;
-
- lwsl_debug("%s: %p: issuing proxy headers\n",
- __func__, wsi);
- n = lws_write(wsi, wsi->http.pending_return_headers +
- LWS_PRE,
- wsi->http.pending_return_headers_len,
- LWS_WRITE_HTTP_HEADERS);
-
- lws_free_set_NULL(wsi->http.pending_return_headers);
-
- if (n < 0) {
- lwsl_err("%s: EST_CLIENT_HTTP: write failed\n",
- __func__);
- return -1;
- }
- lws_callback_on_writable(wsi);
- break;
- }
-
- if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__PROXY) {
- char *px = buf + LWS_PRE;
- int lenx = sizeof(buf) - LWS_PRE - 32;
-
- /*
- * our sink is writeable and our source has something
- * to read. So read a lump of source material of
- * suitable size to send or what's available, whichever
- * is the smaller.
- */
- wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__PROXY;
- if (!lws_get_child(wsi))
- break;
-
- /* this causes LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ */
- if (lws_http_client_read(lws_get_child(wsi), &px,
- &lenx) < 0) {
- lwsl_info("%s: LWS_CB_REASON_AUX_BF__PROXY: "
- "client closed\n", __func__);
-
- stream_close(wsi);
-
- return -1;
- }
- break;
- }
-
- if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__PROXY_TRANS_END) {
- lwsl_info("%s: LWS_CB_REASON_AUX_BF__PROXY_TRANS_END\n",
- __func__);
-
- wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__PROXY_TRANS_END;
-
- if (stream_close(wsi))
- return -1;
-
- if (lws_http_transaction_completed(wsi))
- return -1;
- }
-#endif
- break;
-
-#if defined(LWS_WITH_HTTP_PROXY)
- case LWS_CALLBACK_RECEIVE_CLIENT_HTTP:
- assert(lws_get_parent(wsi));
- if (!lws_get_parent(wsi))
- break;
- lws_get_parent(wsi)->reason_bf |= LWS_CB_REASON_AUX_BF__PROXY;
- lws_callback_on_writable(lws_get_parent(wsi));
- break;
-
- case LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ: {
- char *out = buf + LWS_PRE;
-
- assert(lws_get_parent(wsi));
-
- if (wsi->http.proxy_parent_chunked) {
-
- if (len > sizeof(buf) - LWS_PRE - 16) {
- lwsl_err("oversize buf %d %d\n", (int)len,
- (int)sizeof(buf) - LWS_PRE - 16);
- return -1;
- }
-
- /*
- * this only needs dealing with on http/1.1 to allow
- * pipelining
- */
- n = lws_snprintf(out, 14, "%X\x0d\x0a", (int)len);
- out += n;
- memcpy(out, in, len);
- out += len;
- *out++ = '\x0d';
- *out++ = '\x0a';
-
- n = lws_write(lws_get_parent(wsi),
- (unsigned char *)buf + LWS_PRE,
- len + n + 2, LWS_WRITE_HTTP);
- } else
- n = lws_write(lws_get_parent(wsi), (unsigned char *)in,
- len, LWS_WRITE_HTTP);
- if (n < 0)
- return -1;
- break; }
-
-
- /* this handles the proxy case... */
- case LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP: {
- unsigned char *start, *p, *end;
-
- /*
- * We want to proxy these headers, but we are being called
- * at the point the onward client was established, which is
- * unrelated to the state or writability of our proxy
- * connection.
- *
- * Therefore produce the headers using the onward client ah
- * while we have it, and stick them on the output buflist to be
- * written on the proxy connection as soon as convenient.
- */
-
- parent = lws_get_parent(wsi);
-
- if (!parent)
- return 0;
-
- start = p = (unsigned char *)buf + LWS_PRE;
- end = p + sizeof(buf) - LWS_PRE - 256;
-
- if (lws_add_http_header_status(lws_get_parent(wsi),
- lws_http_client_http_response(wsi), &p, end))
- return 1;
-
- /*
- * copy these headers from the client connection to the parent
- */
-
- proxy_header(parent, wsi, end, 256,
- WSI_TOKEN_HTTP_CONTENT_LENGTH, &p, end);
- proxy_header(parent, wsi, end, 256,
- WSI_TOKEN_HTTP_CONTENT_TYPE, &p, end);
- proxy_header(parent, wsi, end, 256,
- WSI_TOKEN_HTTP_ETAG, &p, end);
- proxy_header(parent, wsi, end, 256,
- WSI_TOKEN_HTTP_ACCEPT_LANGUAGE, &p, end);
- proxy_header(parent, wsi, end, 256,
- WSI_TOKEN_HTTP_CONTENT_ENCODING, &p, end);
- proxy_header(parent, wsi, end, 256,
- WSI_TOKEN_HTTP_CACHE_CONTROL, &p, end);
-
- if (!parent->http2_substream)
- if (lws_add_http_header_by_token(parent,
- WSI_TOKEN_CONNECTION, (unsigned char *)"close",
- 5, &p, end))
- return -1;
-
- /*
- * We proxy using h1 only atm, and strip any chunking so it
- * can go back out on h2 just fine.
- *
- * However if we are actually going out on h1, we need to add
- * our own chunking since we still don't know the size.
- */
-
- if (!parent->http2_substream &&
- !lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {
- lwsl_debug("downstream parent chunked\n");
- if (lws_add_http_header_by_token(parent,
- WSI_TOKEN_HTTP_TRANSFER_ENCODING,
- (unsigned char *)"chunked", 7, &p, end))
- return -1;
-
- wsi->http.proxy_parent_chunked = 1;
- }
-
- if (lws_finalize_http_header(parent, &p, end))
- return 1;
-
- parent->http.pending_return_headers_len =
- lws_ptr_diff(p, start);
- parent->http.pending_return_headers =
- lws_malloc(parent->http.pending_return_headers_len +
- LWS_PRE, "return proxy headers");
- if (!parent->http.pending_return_headers)
- return -1;
-
- memcpy(parent->http.pending_return_headers + LWS_PRE, start,
- parent->http.pending_return_headers_len);
-
- parent->reason_bf |= LWS_CB_REASON_AUX_BF__PROXY_HEADERS;
-
- lwsl_debug("%s: LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP: "
- "prepared headers\n", __func__);
- lws_callback_on_writable(parent);
-
- break; }
-
- case LWS_CALLBACK_COMPLETED_CLIENT_HTTP:
- lwsl_info("%s: COMPLETED_CLIENT_HTTP: %p (parent %p)\n",
- __func__, wsi, lws_get_parent(wsi));
- if (!lws_get_parent(wsi))
- break;
- lws_get_parent(wsi)->reason_bf |=
- LWS_CB_REASON_AUX_BF__PROXY_TRANS_END;
- lws_callback_on_writable(lws_get_parent(wsi));
- break;
-
- case LWS_CALLBACK_CLOSED_CLIENT_HTTP:
- if (!lws_get_parent(wsi))
- break;
- lwsl_err("%s: LWS_CALLBACK_CLOSED_CLIENT_HTTP\n", __func__);
- lws_set_timeout(lws_get_parent(wsi), LWS_TO_KILL_ASYNC,
- PENDING_TIMEOUT_KILLED_BY_PROXY_CLIENT_CLOSE);
- break;
-
- case LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER:
- parent = lws_get_parent(wsi);
-
- if (!parent)
- break;
-
- p = (unsigned char **)in;
- end = (*p) + len;
-
- /*
- * copy these headers from the parent request to the client
- * connection's request
- */
-
- proxy_header(wsi, parent, (unsigned char *)buf, sizeof(buf),
- WSI_TOKEN_HOST, p, end);
- proxy_header(wsi, parent, (unsigned char *)buf, sizeof(buf),
- WSI_TOKEN_HTTP_ETAG, p, end);
- proxy_header(wsi, parent, (unsigned char *)buf, sizeof(buf),
- WSI_TOKEN_HTTP_IF_MODIFIED_SINCE, p, end);
- proxy_header(wsi, parent, (unsigned char *)buf, sizeof(buf),
- WSI_TOKEN_HTTP_ACCEPT_LANGUAGE, p, end);
- proxy_header(wsi, parent, (unsigned char *)buf, sizeof(buf),
- WSI_TOKEN_HTTP_ACCEPT_ENCODING, p, end);
- proxy_header(wsi, parent, (unsigned char *)buf, sizeof(buf),
- WSI_TOKEN_HTTP_CACHE_CONTROL, p, end);
-
- buf[0] = '\0';
- lws_get_peer_simple(parent, buf, sizeof(buf));
- if (lws_add_http_header_by_token(wsi, WSI_TOKEN_X_FORWARDED_FOR,
- (unsigned char *)buf, (int)strlen(buf), p, end))
- return -1;
-
- break;
-
-#endif
-
-#ifdef LWS_WITH_CGI
- /* CGI IO events (POLLIN/OUT) appear here, our default policy is:
- *
- * - POST data goes on subprocess stdin
- * - subprocess stdout goes on http via writeable callback
- * - subprocess stderr goes to the logs
- */
- case LWS_CALLBACK_CGI:
- args = (struct lws_cgi_args *)in;
- switch (args->ch) { /* which of stdin/out/err ? */
- case LWS_STDIN:
- /* TBD stdin rx flow control */
- break;
- case LWS_STDOUT:
- /* quench POLLIN on STDOUT until MASTER got writeable */
- lws_rx_flow_control(args->stdwsi[LWS_STDOUT], 0);
- wsi->reason_bf |= LWS_CB_REASON_AUX_BF__CGI;
- /* when writing to MASTER would not block */
- lws_callback_on_writable(wsi);
- break;
- case LWS_STDERR:
- n = lws_get_socket_fd(args->stdwsi[LWS_STDERR]);
- if (n < 0)
- break;
- n = read(n, buf, sizeof(buf) - 2);
- if (n > 0) {
- if (buf[n - 1] != '\n')
- buf[n++] = '\n';
- buf[n] = '\0';
- lwsl_notice("CGI-stderr: %s\n", buf);
- }
- break;
- }
- break;
-
- case LWS_CALLBACK_CGI_TERMINATED:
- lwsl_debug("LWS_CALLBACK_CGI_TERMINATED: %d %" PRIu64 "\n",
- wsi->http.cgi->explicitly_chunked,
- (uint64_t)wsi->http.cgi->content_length);
- if (!wsi->http.cgi->explicitly_chunked &&
- !wsi->http.cgi->content_length) {
- /* send terminating chunk */
- lwsl_debug("LWS_CALLBACK_CGI_TERMINATED: ending\n");
- wsi->reason_bf |= LWS_CB_REASON_AUX_BF__CGI_CHUNK_END;
- lws_callback_on_writable(wsi);
- lws_set_timeout(wsi, PENDING_TIMEOUT_CGI, 3);
- break;
- }
- return -1;
-
- case LWS_CALLBACK_CGI_STDIN_DATA: /* POST body for stdin */
- args = (struct lws_cgi_args *)in;
- args->data[args->len] = '\0';
- if (!args->stdwsi[LWS_STDIN])
- return -1;
- n = lws_get_socket_fd(args->stdwsi[LWS_STDIN]);
- if (n < 0)
- return -1;
-
-#if defined(LWS_WITH_ZLIB)
- if (wsi->http.cgi->gzip_inflate) {
- /* gzip handling */
-
- if (!wsi->http.cgi->gzip_init) {
- lwsl_info("inflating gzip\n");
-
- memset(&wsi->http.cgi->inflate, 0,
- sizeof(wsi->http.cgi->inflate));
-
- if (inflateInit2(&wsi->http.cgi->inflate,
- 16 + 15) != Z_OK) {
- lwsl_err("%s: iniflateInit failed\n",
- __func__);
- return -1;
- }
-
- wsi->http.cgi->gzip_init = 1;
- }
-
- wsi->http.cgi->inflate.next_in = args->data;
- wsi->http.cgi->inflate.avail_in = args->len;
-
- do {
-
- wsi->http.cgi->inflate.next_out =
- wsi->http.cgi->inflate_buf;
- wsi->http.cgi->inflate.avail_out =
- sizeof(wsi->http.cgi->inflate_buf);
-
- n = inflate(&wsi->http.cgi->inflate,
- Z_SYNC_FLUSH);
-
- switch (n) {
- case Z_NEED_DICT:
- case Z_STREAM_ERROR:
- case Z_DATA_ERROR:
- case Z_MEM_ERROR:
- inflateEnd(&wsi->http.cgi->inflate);
- wsi->http.cgi->gzip_init = 0;
- lwsl_err("zlib error inflate %d\n", n);
- return -1;
- }
-
- if (wsi->http.cgi->inflate.avail_out !=
- sizeof(wsi->http.cgi->inflate_buf)) {
- int written;
-
- written = write(args->stdwsi[LWS_STDIN]->desc.filefd,
- wsi->http.cgi->inflate_buf,
- sizeof(wsi->http.cgi->inflate_buf) -
- wsi->http.cgi->inflate.avail_out);
-
- if (written != (int)(
- sizeof(wsi->http.cgi->inflate_buf) -
- wsi->http.cgi->inflate.avail_out)) {
- lwsl_notice("LWS_CALLBACK_CGI_STDIN_DATA: "
- "sent %d only %d went", n, args->len);
- }
-
- if (n == Z_STREAM_END) {
- lwsl_err("gzip inflate end\n");
- inflateEnd(&wsi->http.cgi->inflate);
- wsi->http.cgi->gzip_init = 0;
- break;
- }
-
- } else
- break;
-
- if (wsi->http.cgi->inflate.avail_out)
- break;
-
- } while (1);
-
- return args->len;
- }
-#endif /* WITH_ZLIB */
-
- n = write(n, args->data, args->len);
-// lwsl_hexdump_notice(args->data, args->len);
- if (n < args->len)
- lwsl_notice("LWS_CALLBACK_CGI_STDIN_DATA: "
- "sent %d only %d went", n, args->len);
-
- if (wsi->http.cgi->post_in_expected && args->stdwsi[LWS_STDIN] &&
- args->stdwsi[LWS_STDIN]->desc.filefd > 0) {
- wsi->http.cgi->post_in_expected -= n;
- if (!wsi->http.cgi->post_in_expected) {
- struct lws *siwsi = args->stdwsi[LWS_STDIN];
-
- lwsl_debug("%s: expected POST in end: "
- "closing stdin wsi %p, fd %d\n",
- __func__, siwsi, siwsi->desc.sockfd);
-
- __remove_wsi_socket_from_fds(siwsi);
- lwsi_set_state(siwsi, LRS_DEAD_SOCKET);
- siwsi->socket_is_permanently_unusable = 1;
- lws_remove_child_from_any_parent(siwsi);
- if (wsi->context->event_loop_ops->
- close_handle_manually) {
- wsi->context->event_loop_ops->
- close_handle_manually(siwsi);
- siwsi->told_event_loop_closed = 1;
- } else {
- compatible_close(siwsi->desc.sockfd);
- __lws_free_wsi(siwsi);
- }
- wsi->http.cgi->pipe_fds[LWS_STDIN][1] = -1;
-
- args->stdwsi[LWS_STDIN] = NULL;
- }
- }
-
- return n;
-#endif /* WITH_CGI */
-#endif /* ROLE_ H1 / H2 */
- case LWS_CALLBACK_SSL_INFO:
- si = in;
-
- (void)si;
- lwsl_notice("LWS_CALLBACK_SSL_INFO: where: 0x%x, ret: 0x%x\n",
- si->where, si->ret);
- break;
-
-#if LWS_MAX_SMP > 1
- case LWS_CALLBACK_GET_THREAD_ID:
- return (int)(unsigned long long)pthread_self();
-#endif
-
- default:
- break;
- }
-
- return 0;
-}
diff --git a/thirdparty/libwebsockets/lib/plat/unix/private.h b/thirdparty/libwebsockets/lib/plat/unix/private.h
deleted file mode 100644
index 8583ee7bc8..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/private.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * Included from lib/core/private.h if no explicit platform
- */
-
-#include <fcntl.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <poll.h>
-#include <netdb.h>
-
-#ifndef __cplusplus
-#include <errno.h>
-#endif
-#include <netdb.h>
-#include <signal.h>
-
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <sys/un.h>
-
-#if defined(__APPLE__)
-#include <machine/endian.h>
-#endif
-#if defined(__FreeBSD__)
-#include <sys/endian.h>
-#endif
-#if defined(__linux__)
-#include <endian.h>
-#endif
-#if defined(__QNX__)
- #include <gulliver.h>
- #if defined(__LITTLEENDIAN__)
- #define BYTE_ORDER __LITTLEENDIAN__
- #define LITTLE_ENDIAN __LITTLEENDIAN__
- #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc); for suppres warning that BIG_ENDIAN is not defined. */
- #endif
- #if defined(__BIGENDIAN__)
- #define BYTE_ORDER __BIGENDIAN__
- #define LITTLE_ENDIAN 1234 /* to show byte order (taken from gcc); for suppres warning that LITTLE_ENDIAN is not defined. */
- #define BIG_ENDIAN __BIGENDIAN__
- #endif
-#endif
-
-#if defined(__sun) && defined(__GNUC__)
-
-#include <arpa/nameser_compat.h>
-
-#if !defined (BYTE_ORDER)
-#define BYTE_ORDER __BYTE_ORDER__
-#endif
-
-#if !defined(LITTLE_ENDIAN)
-#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
-#endif
-
-#if !defined(BIG_ENDIAN)
-#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
-#endif
-
-#endif /* sun + GNUC */
-
-#if !defined(BYTE_ORDER)
-#define BYTE_ORDER __BYTE_ORDER
-#endif
-#if !defined(LITTLE_ENDIAN)
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-#endif
-#if !defined(BIG_ENDIAN)
-#define BIG_ENDIAN __BIG_ENDIAN
-#endif
-
-#if defined(LWS_BUILTIN_GETIFADDRS)
-#include "./misc/getifaddrs.h"
-#else
-
-#if defined(__HAIKU__)
-#define _BSD_SOURCE
-#endif
-#include <ifaddrs.h>
-
-#endif
-
-#if defined (__sun) || defined(__HAIKU__) || defined(__QNX__)
-#include <syslog.h>
-#else
-#include <sys/syslog.h>
-#endif
-
-#ifdef __QNX__
-# include "netinet/tcp_var.h"
-# define TCP_KEEPINTVL TCPCTL_KEEPINTVL
-# define TCP_KEEPIDLE TCPCTL_KEEPIDLE
-# define TCP_KEEPCNT TCPCTL_KEEPCNT
-#endif
-
-#define LWS_ERRNO errno
-#define LWS_EAGAIN EAGAIN
-#define LWS_EALREADY EALREADY
-#define LWS_EINPROGRESS EINPROGRESS
-#define LWS_EINTR EINTR
-#define LWS_EISCONN EISCONN
-#define LWS_ENOTCONN ENOTCONN
-#define LWS_EWOULDBLOCK EWOULDBLOCK
-#define LWS_EADDRINUSE EADDRINUSE
-#define lws_set_blocking_send(wsi)
-#define LWS_SOCK_INVALID (-1)
-
-#define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]
-#define insert_wsi(A,B) assert(A->lws_lookup[B->desc.sockfd - \
- lws_plat_socket_offset()] == 0); \
- A->lws_lookup[B->desc.sockfd - \
- lws_plat_socket_offset()] = B
-#define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] = 0
-
-#ifndef LWS_NO_FORK
-#ifdef LWS_HAVE_SYS_PRCTL_H
-#include <sys/prctl.h>
-#endif
-#endif
-
-#if defined (__ANDROID__)
- #include <syslog.h>
- #include <sys/resource.h>
-#endif
-
-#define compatible_close(x) close(x)
-#define lws_plat_socket_offset() (0)
-
-/*
- * Mac OSX as well as iOS do not define the MSG_NOSIGNAL flag,
- * but happily have something equivalent in the SO_NOSIGPIPE flag.
- */
-#ifdef __APPLE__
-#define MSG_NOSIGNAL SO_NOSIGPIPE
-#endif
-
-/*
- * Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in
- * POSIX 2008.
- */
-#ifdef __sun
- #define MSG_NOSIGNAL 0
-#endif
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-caps.c b/thirdparty/libwebsockets/lib/plat/unix/unix-caps.c
deleted file mode 100644
index 64aea61816..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-caps.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-#include <pwd.h>
-#include <grp.h>
-
-#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
-static void
-_lws_plat_apply_caps(int mode, const cap_value_t *cv, int count)
-{
- cap_t caps;
-
- if (!count)
- return;
-
- caps = cap_get_proc();
-
- cap_set_flag(caps, mode, count, cv, CAP_SET);
- cap_set_proc(caps);
- prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
- cap_free(caps);
-}
-#endif
-
-void
-lws_plat_drop_app_privileges(const struct lws_context_creation_info *info)
-{
- if (info->gid && info->gid != -1)
- if (setgid(info->gid))
- lwsl_warn("setgid: %s\n", strerror(LWS_ERRNO));
-
- if (info->uid && info->uid != -1) {
- struct passwd *p = getpwuid(info->uid);
-
- if (p) {
-
-#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
- _lws_plat_apply_caps(CAP_PERMITTED, info->caps,
- info->count_caps);
-#endif
-
- initgroups(p->pw_name, info->gid);
- if (setuid(info->uid))
- lwsl_warn("setuid: %s\n", strerror(LWS_ERRNO));
- else
- lwsl_notice("Set privs to user '%s'\n",
- p->pw_name);
-
-#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
- _lws_plat_apply_caps(CAP_EFFECTIVE, info->caps,
- info->count_caps);
-
- if (info->count_caps) {
- int n;
- for (n = 0; n < info->count_caps; n++)
- lwsl_notice(" RETAINING CAP %d\n",
- (int)info->caps[n]);
- }
-#endif
-
- } else
- lwsl_warn("getpwuid: unable to find uid %d", info->uid);
- }
-}
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-fds.c b/thirdparty/libwebsockets/lib/plat/unix/unix-fds.c
deleted file mode 100644
index 8a00bcff3f..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-fds.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-void
-lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
-
- if (context->event_loop_ops->io)
- context->event_loop_ops->io(wsi, LWS_EV_START | LWS_EV_READ);
-
- pt->fds[pt->fds_count++].revents = 0;
-}
-
-void
-lws_plat_delete_socket_from_fds(struct lws_context *context,
- struct lws *wsi, int m)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
-
- if (context->event_loop_ops->io)
- context->event_loop_ops->io(wsi,
- LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
-
- pt->fds_count--;
-}
-
-int
-lws_plat_change_pollfd(struct lws_context *context,
- struct lws *wsi, struct lws_pollfd *pfd)
-{
- return 0;
-}
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-file.c b/thirdparty/libwebsockets/lib/plat/unix/unix-file.c
deleted file mode 100644
index bcdc213a89..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-file.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-#include <pwd.h>
-#include <grp.h>
-
-#ifdef LWS_WITH_PLUGINS
-#include <dlfcn.h>
-#endif
-#include <dirent.h>
-
-int lws_plat_apply_FD_CLOEXEC(int n)
-{
- if (n == -1)
- return 0;
-
- return fcntl(n, F_SETFD, FD_CLOEXEC);
-}
-
-int
-lws_plat_write_file(const char *filename, void *buf, int len)
-{
- int m, fd;
-
- fd = lws_open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
-
- if (fd == -1)
- return 1;
-
- m = write(fd, buf, len);
- close(fd);
-
- return m != len;
-}
-
-int
-lws_plat_read_file(const char *filename, void *buf, int len)
-{
- int n, fd = lws_open(filename, O_RDONLY);
- if (fd == -1)
- return -1;
-
- n = read(fd, buf, len);
- close(fd);
-
- return n;
-}
-
-lws_fop_fd_t
-_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
- const char *vpath, lws_fop_flags_t *flags)
-{
- struct stat stat_buf;
- int ret = lws_open(filename, (*flags) & LWS_FOP_FLAGS_MASK, 0664);
- lws_fop_fd_t fop_fd;
-
- if (ret < 0)
- return NULL;
-
- if (fstat(ret, &stat_buf) < 0)
- goto bail;
-
- fop_fd = malloc(sizeof(*fop_fd));
- if (!fop_fd)
- goto bail;
-
- fop_fd->fops = fops;
- fop_fd->flags = *flags;
- fop_fd->fd = ret;
- fop_fd->filesystem_priv = NULL; /* we don't use it */
- fop_fd->len = stat_buf.st_size;
- fop_fd->pos = 0;
-
- return fop_fd;
-
-bail:
- close(ret);
- return NULL;
-}
-
-int
-_lws_plat_file_close(lws_fop_fd_t *fop_fd)
-{
- int fd = (*fop_fd)->fd;
-
- free(*fop_fd);
- *fop_fd = NULL;
-
- return close(fd);
-}
-
-lws_fileofs_t
-_lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
-{
- lws_fileofs_t r;
-
- if (offset > 0 &&
- offset > (lws_fileofs_t)fop_fd->len - (lws_fileofs_t)fop_fd->pos)
- offset = fop_fd->len - fop_fd->pos;
-
- if ((lws_fileofs_t)fop_fd->pos + offset < 0)
- offset = -fop_fd->pos;
-
- r = lseek(fop_fd->fd, offset, SEEK_CUR);
-
- if (r >= 0)
- fop_fd->pos = r;
- else
- lwsl_err("error seeking from cur %ld, offset %ld\n",
- (long)fop_fd->pos, (long)offset);
-
- return r;
-}
-
-int
-_lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len)
-{
- long n;
-
- n = read((int)fop_fd->fd, buf, len);
- if (n == -1) {
- *amount = 0;
- return -1;
- }
- fop_fd->pos += n;
- lwsl_debug("%s: read %ld of req %ld, pos %ld, len %ld\n", __func__, n,
- (long)len, (long)fop_fd->pos, (long)fop_fd->len);
- *amount = n;
-
- return 0;
-}
-
-int
-_lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len)
-{
- long n;
-
- n = write((int)fop_fd->fd, buf, len);
- if (n == -1) {
- *amount = 0;
- return -1;
- }
-
- fop_fd->pos += n;
- *amount = n;
-
- return 0;
-}
-
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-init.c b/thirdparty/libwebsockets/lib/plat/unix/unix-init.c
deleted file mode 100644
index fa9a30e8d2..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-init.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-#include <pwd.h>
-#include <grp.h>
-
-#ifdef LWS_WITH_PLUGINS
-#include <dlfcn.h>
-#endif
-#include <dirent.h>
-
-int
-lws_plat_init(struct lws_context *context,
- const struct lws_context_creation_info *info)
-{
- int fd;
-
- /* master context has the global fd lookup array */
- context->lws_lookup = lws_zalloc(sizeof(struct lws *) *
- context->max_fds, "lws_lookup");
- if (context->lws_lookup == NULL) {
- lwsl_err("OOM on lws_lookup array for %d connections\n",
- context->max_fds);
- return 1;
- }
-
- lwsl_info(" mem: platform fd map: %5lu bytes\n",
- (unsigned long)(sizeof(struct lws *) * context->max_fds));
- fd = lws_open(SYSTEM_RANDOM_FILEPATH, O_RDONLY);
-
- context->fd_random = fd;
- if (context->fd_random < 0) {
- lwsl_err("Unable to open random device %s %d\n",
- SYSTEM_RANDOM_FILEPATH, context->fd_random);
- return 1;
- }
-
-#ifdef LWS_WITH_PLUGINS
- if (info->plugin_dirs && (context->options & LWS_SERVER_OPTION_LIBUV))
- lws_plat_plugins_init(context, info->plugin_dirs);
-#endif
-
- return 0;
-}
-
-int
-lws_plat_context_early_init(void)
-{
-#if !defined(LWS_AVOID_SIGPIPE_IGN)
- signal(SIGPIPE, SIG_IGN);
-#endif
-
- return 0;
-}
-
-void
-lws_plat_context_early_destroy(struct lws_context *context)
-{
-}
-
-void
-lws_plat_context_late_destroy(struct lws_context *context)
-{
-#ifdef LWS_WITH_PLUGINS
- if (context->plugin_list)
- lws_plat_plugins_destroy(context);
-#endif
-
- if (context->lws_lookup)
- lws_free(context->lws_lookup);
-
- if (!context->fd_random)
- lwsl_err("ZERO RANDOM FD\n");
- if (context->fd_random != LWS_INVALID_FILE)
- close(context->fd_random);
-}
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-misc.c b/thirdparty/libwebsockets/lib/plat/unix/unix-misc.c
deleted file mode 100644
index d4b0f76658..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-misc.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-
-uint64_t
-lws_time_in_microseconds(void)
-{
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- return ((unsigned long long)tv.tv_sec * 1000000LL) + tv.tv_usec;
-}
-
-LWS_VISIBLE int
-lws_get_random(struct lws_context *context, void *buf, int len)
-{
- return read(context->fd_random, (char *)buf, len);
-}
-
-LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
-{
- int syslog_level = LOG_DEBUG;
-
- switch (level) {
- case LLL_ERR:
- syslog_level = LOG_ERR;
- break;
- case LLL_WARN:
- syslog_level = LOG_WARNING;
- break;
- case LLL_NOTICE:
- syslog_level = LOG_NOTICE;
- break;
- case LLL_INFO:
- syslog_level = LOG_INFO;
- break;
- }
- syslog(syslog_level, "%s", line);
-}
-
-
-int
-lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
- int len)
-{
- int n;
-
- n = write(fd, buf, len);
-
- fsync(fd);
- if (lseek(fd, 0, SEEK_SET) < 0)
- return 1;
-
- return n != len;
-}
-
-
-int
-lws_plat_recommended_rsa_bits(void)
-{
- return 4096;
-}
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-pipe.c b/thirdparty/libwebsockets/lib/plat/unix/unix-pipe.c
deleted file mode 100644
index 64ce253be6..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-pipe.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-
-int
-lws_plat_pipe_create(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
-
-#if defined(LWS_HAVE_PIPE2)
- return pipe2(pt->dummy_pipe_fds, O_NONBLOCK);
-#else
- return pipe(pt->dummy_pipe_fds);
-#endif
-}
-
-int
-lws_plat_pipe_signal(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- char buf = 0;
- int n;
-
- n = write(pt->dummy_pipe_fds[1], &buf, 1);
-
- return n != 1;
-}
-
-void
-lws_plat_pipe_close(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
-
- if (pt->dummy_pipe_fds[0] && pt->dummy_pipe_fds[0] != -1)
- close(pt->dummy_pipe_fds[0]);
- if (pt->dummy_pipe_fds[1] && pt->dummy_pipe_fds[1] != -1)
- close(pt->dummy_pipe_fds[1]);
-
- pt->dummy_pipe_fds[0] = pt->dummy_pipe_fds[1] = -1;
-}
-
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-service.c b/thirdparty/libwebsockets/lib/plat/unix/unix-service.c
deleted file mode 100644
index e61ef59959..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-service.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-int
-lws_poll_listen_fd(struct lws_pollfd *fd)
-{
- return poll(fd, 1, 0);
-}
-
-LWS_EXTERN int
-_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
-{
- volatile struct lws_foreign_thread_pollfd *ftp, *next;
- volatile struct lws_context_per_thread *vpt;
- struct lws_context_per_thread *pt;
- int n = -1, m, c;
-
- /* stay dead once we are dead */
-
- if (!context || !context->vhost_list)
- return 1;
-
- pt = &context->pt[tsi];
- vpt = (volatile struct lws_context_per_thread *)pt;
-
- lws_stats_atomic_bump(context, pt, LWSSTATS_C_SERVICE_ENTRY, 1);
-
- if (timeout_ms < 0)
- goto faked_service;
-
- if (context->event_loop_ops->run_pt)
- context->event_loop_ops->run_pt(context, tsi);
-
- if (!pt->service_tid_detected) {
- struct lws _lws;
-
- memset(&_lws, 0, sizeof(_lws));
- _lws.context = context;
-
- pt->service_tid =
- context->vhost_list->protocols[0].callback(
- &_lws, LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0);
- pt->service_tid_detected = 1;
- }
-
- /*
- * is there anybody with pending stuff that needs service forcing?
- */
- if (!lws_service_adjust_timeout(context, 1, tsi)) {
- /* -1 timeout means just do forced service */
- _lws_plat_service_tsi(context, -1, pt->tid);
- /* still somebody left who wants forced service? */
- if (!lws_service_adjust_timeout(context, 1, pt->tid))
- /* yes... come back again quickly */
- timeout_ms = 0;
- }
-
- if (timeout_ms) {
- lws_pt_lock(pt, __func__);
- /* don't stay in poll wait longer than next hr timeout */
- lws_usec_t t = __lws_hrtimer_service(pt);
- if ((lws_usec_t)timeout_ms * 1000 > t)
- timeout_ms = t / 1000;
- lws_pt_unlock(pt);
- }
-
- vpt->inside_poll = 1;
- lws_memory_barrier();
- n = poll(pt->fds, pt->fds_count, timeout_ms);
- vpt->inside_poll = 0;
- lws_memory_barrier();
-
- /* Collision will be rare and brief. Just spin until it completes */
- while (vpt->foreign_spinlock)
- ;
-
- /*
- * At this point we are not inside a foreign thread pollfd change,
- * and we have marked ourselves as outside the poll() wait. So we
- * are the only guys that can modify the lws_foreign_thread_pollfd
- * list on the pt. Drain the list and apply the changes to the
- * affected pollfds in the correct order.
- */
-
- lws_pt_lock(pt, __func__);
-
- ftp = vpt->foreign_pfd_list;
- //lwsl_notice("cleared list %p\n", ftp);
- while (ftp) {
- struct lws *wsi;
- struct lws_pollfd *pfd;
-
- next = ftp->next;
- pfd = &vpt->fds[ftp->fd_index];
- if (lws_socket_is_valid(pfd->fd)) {
- wsi = wsi_from_fd(context, pfd->fd);
- if (wsi)
- __lws_change_pollfd(wsi, ftp->_and, ftp->_or);
- }
- lws_free((void *)ftp);
- ftp = next;
- }
- vpt->foreign_pfd_list = NULL;
- lws_memory_barrier();
-
- /* we have come out of a poll wait... check the hrtimer list */
-
- __lws_hrtimer_service(pt);
-
- lws_pt_unlock(pt);
-
- m = 0;
-#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
- m |= !!pt->ws.rx_draining_ext_list;
-#endif
-
- if (pt->context->tls_ops &&
- pt->context->tls_ops->fake_POLLIN_for_buffered)
- m |= pt->context->tls_ops->fake_POLLIN_for_buffered(pt);
-
- if (!m && !n) { /* nothing to do */
- lws_service_fd_tsi(context, NULL, tsi);
- lws_service_do_ripe_rxflow(pt);
-
- return 0;
- }
-
-faked_service:
- m = lws_service_flag_pending(context, tsi);
- if (m)
- c = -1; /* unknown limit */
- else
- if (n < 0) {
- if (LWS_ERRNO != LWS_EINTR)
- return -1;
- return 0;
- } else
- c = n;
-
- /* any socket with events to service? */
- for (n = 0; n < (int)pt->fds_count && c; n++) {
- if (!pt->fds[n].revents)
- continue;
-
- c--;
-
- m = lws_service_fd_tsi(context, &pt->fds[n], tsi);
- if (m < 0) {
- lwsl_err("%s: lws_service_fd_tsi returned %d\n",
- __func__, m);
- return -1;
- }
- /* if something closed, retry this slot */
- if (m)
- n--;
- }
-
- lws_service_do_ripe_rxflow(pt);
-
- return 0;
-}
-
-int
-lws_plat_check_connection_error(struct lws *wsi)
-{
- return 0;
-}
-
-int
-lws_plat_service(struct lws_context *context, int timeout_ms)
-{
- return _lws_plat_service_tsi(context, timeout_ms, 0);
-}
-
-
-void
-lws_plat_service_periodic(struct lws_context *context)
-{
- /* if our parent went down, don't linger around */
- if (context->started_with_parent &&
- kill(context->started_with_parent, 0) < 0)
- kill(getpid(), SIGTERM);
-}
diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
deleted file mode 100644
index 192dddee63..0000000000
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include "core/private.h"
-
-#include <pwd.h>
-#include <grp.h>
-
-
-
-int
-lws_send_pipe_choked(struct lws *wsi)
-{
- struct lws_pollfd fds;
- struct lws *wsi_eff;
-
-#if defined(LWS_WITH_HTTP2)
- wsi_eff = lws_get_network_wsi(wsi);
-#else
- wsi_eff = wsi;
-#endif
-
- /* the fact we checked implies we avoided back-to-back writes */
- wsi_eff->could_have_pending = 0;
-
- /* treat the fact we got a truncated send pending as if we're choked */
- if (lws_has_buffered_out(wsi_eff)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- ||wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more
-#endif
- )
- return 1;
-
- fds.fd = wsi_eff->desc.sockfd;
- fds.events = POLLOUT;
- fds.revents = 0;
-
- if (poll(&fds, 1, 0) != 1)
- return 1;
-
- if ((fds.revents & POLLOUT) == 0)
- return 1;
-
- /* okay to send another packet without blocking */
-
- return 0;
-}
-
-
-int
-lws_plat_set_socket_options(struct lws_vhost *vhost, int fd, int unix_skt)
-{
- int optval = 1;
- socklen_t optlen = sizeof(optval);
-
-#ifdef LWS_WITH_IPV6
- optval = 0;
- setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
-#endif
-
-#if defined(__APPLE__) || \
- defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
- defined(__NetBSD__) || \
- defined(__OpenBSD__) || \
- defined(__HAIKU__)
- struct protoent *tcp_proto;
-#endif
-
- (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
-
- if (!unix_skt && vhost->ka_time) {
- /* enable keepalive on this socket */
- optval = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
- (const void *)&optval, optlen) < 0)
- return 1;
-
-#if defined(__APPLE__) || \
- defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
- defined(__NetBSD__) || \
- defined(__CYGWIN__) || defined(__OpenBSD__) || defined (__sun) || \
- defined(__HAIKU__)
-
- /*
- * didn't find a way to set these per-socket, need to
- * tune kernel systemwide values
- */
-#else
- /* set the keepalive conditions we want on it too */
-
-#if defined(LWS_HAVE_TCP_USER_TIMEOUT)
- optval = 1000 * (vhost->ka_time +
- (vhost->ka_interval * vhost->ka_probes));
- if (setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT,
- (const void *)&optval, optlen) < 0)
- return 1;
-#endif
- optval = vhost->ka_time;
- if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
- (const void *)&optval, optlen) < 0)
- return 1;
-
- optval = vhost->ka_interval;
- if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL,
- (const void *)&optval, optlen) < 0)
- return 1;
-
- optval = vhost->ka_probes;
- if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT,
- (const void *)&optval, optlen) < 0)
- return 1;
-#endif
- }
-
-#if defined(SO_BINDTODEVICE)
- if (!unix_skt && vhost->bind_iface && vhost->iface) {
- lwsl_info("binding listen skt to %s using SO_BINDTODEVICE\n", vhost->iface);
- if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, vhost->iface,
- strlen(vhost->iface)) < 0) {
- lwsl_warn("Failed to bind to device %s\n", vhost->iface);
- return 1;
- }
- }
-#endif
-
- /* Disable Nagle */
- optval = 1;
-#if defined (__sun) || defined(__QNX__)
- if (!unix_skt && setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
- return 1;
-#elif !defined(__APPLE__) && \
- !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
- !defined(__NetBSD__) && \
- !defined(__OpenBSD__) && \
- !defined(__HAIKU__)
- if (!unix_skt && setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
- return 1;
-#else
- tcp_proto = getprotobyname("TCP");
- if (!unix_skt && setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, &optval, optlen) < 0)
- return 1;
-#endif
-
- /* We are nonblocking... */
- if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
- return 1;
-
- return 0;
-}
-
-
-/* cast a struct sockaddr_in6 * into addr for ipv6 */
-
-int
-lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
- size_t addrlen)
-{
- int rc = LWS_ITOSA_NOT_EXIST;
-
- struct ifaddrs *ifr;
- struct ifaddrs *ifc;
-#ifdef LWS_WITH_IPV6
- struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
-#endif
-
- getifaddrs(&ifr);
- for (ifc = ifr; ifc != NULL && rc; ifc = ifc->ifa_next) {
- if (!ifc->ifa_addr)
- continue;
-
- lwsl_debug(" interface %s vs %s (fam %d) ipv6 %d\n",
- ifc->ifa_name, ifname,
- ifc->ifa_addr->sa_family, ipv6);
-
- if (strcmp(ifc->ifa_name, ifname))
- continue;
-
- switch (ifc->ifa_addr->sa_family) {
-#if defined(AF_PACKET)
- case AF_PACKET:
- /* interface exists but is not usable */
- rc = LWS_ITOSA_NOT_USABLE;
- continue;
-#endif
-
- case AF_INET:
-#ifdef LWS_WITH_IPV6
- if (ipv6) {
- /* map IPv4 to IPv6 */
- bzero((char *)&addr6->sin6_addr,
- sizeof(struct in6_addr));
- addr6->sin6_addr.s6_addr[10] = 0xff;
- addr6->sin6_addr.s6_addr[11] = 0xff;
- memcpy(&addr6->sin6_addr.s6_addr[12],
- &((struct sockaddr_in *)ifc->ifa_addr)->sin_addr,
- sizeof(struct in_addr));
- } else
-#endif
- memcpy(addr,
- (struct sockaddr_in *)ifc->ifa_addr,
- sizeof(struct sockaddr_in));
- break;
-#ifdef LWS_WITH_IPV6
- case AF_INET6:
- memcpy(&addr6->sin6_addr,
- &((struct sockaddr_in6 *)ifc->ifa_addr)->sin6_addr,
- sizeof(struct in6_addr));
- break;
-#endif
- default:
- continue;
- }
- rc = LWS_ITOSA_USABLE;
- }
-
- freeifaddrs(ifr);
-
- if (rc) {
- /* check if bind to IP address */
-#ifdef LWS_WITH_IPV6
- if (inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1)
- rc = LWS_ITOSA_USABLE;
- else
-#endif
- if (inet_pton(AF_INET, ifname, &addr->sin_addr) == 1)
- rc = LWS_ITOSA_USABLE;
- }
-
- return rc;
-}
-
-
-const char *
-lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
-{
- return inet_ntop(af, src, dst, cnt);
-}
-
-int
-lws_plat_inet_pton(int af, const char *src, void *dst)
-{
- return inet_pton(af, src, dst);
-}
diff --git a/thirdparty/libwebsockets/lib/plat/windows/private.h b/thirdparty/libwebsockets/lib/plat/windows/private.h
deleted file mode 100644
index 980028ce42..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/private.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- *
- * Included from lib/core/private.h if defined(WIN32) || defined(_WIN32)
- */
-
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
-
- #if (WINVER < 0x0501)
- #undef WINVER
- #undef _WIN32_WINNT
- #define WINVER 0x0501
- #define _WIN32_WINNT WINVER
- #endif
-
- #define LWS_NO_DAEMONIZE
- #define LWS_ERRNO WSAGetLastError()
- #define LWS_EAGAIN WSAEWOULDBLOCK
- #define LWS_EALREADY WSAEALREADY
- #define LWS_EINPROGRESS WSAEINPROGRESS
- #define LWS_EINTR WSAEINTR
- #define LWS_EISCONN WSAEISCONN
- #define LWS_ENOTCONN WSAENOTCONN
- #define LWS_EWOULDBLOCK WSAEWOULDBLOCK
- #define LWS_EADDRINUSE WSAEADDRINUSE
- #define MSG_NOSIGNAL 0
- #define SHUT_RDWR SD_BOTH
- #define SOL_TCP IPPROTO_TCP
- #define SHUT_WR SD_SEND
-
- #define compatible_close(fd) closesocket(fd)
- #define lws_set_blocking_send(wsi) wsi->sock_send_blocking = 1
- #define LWS_SOCK_INVALID (INVALID_SOCKET)
-
- #include <winsock2.h>
- #include <ws2tcpip.h>
- #include <windows.h>
- #include <tchar.h>
- #ifdef LWS_HAVE_IN6ADDR_H
- #include <in6addr.h>
- #endif
- #include <mstcpip.h>
- #include <io.h>
-
- #if !defined(LWS_HAVE_ATOLL)
- #if defined(LWS_HAVE__ATOI64)
- #define atoll _atoi64
- #else
- #warning No atoll or _atoi64 available, using atoi
- #define atoll atoi
- #endif
- #endif
-
- #ifndef __func__
- #define __func__ __FUNCTION__
- #endif
-
- #ifdef LWS_HAVE__VSNPRINTF
- #define vsnprintf _vsnprintf
- #endif
-
-/* we don't have an implementation for this on windows... */
-int kill(int pid, int sig);
-int fork(void);
-#ifndef SIGINT
-#define SIGINT 2
-#endif
-
-#include <gettimeofday.h>
-
-#ifndef BIG_ENDIAN
- #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */
-#endif
-#ifndef LITTLE_ENDIAN
- #define LITTLE_ENDIAN 1234
-#endif
-#ifndef BYTE_ORDER
- #define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
-#undef __P
-#ifndef __P
- #if __STDC__
- #define __P(protos) protos
- #else
- #define __P(protos) ()
- #endif
-#endif
-
-#ifdef _WIN32
- #ifndef FD_HASHTABLE_MODULUS
- #define FD_HASHTABLE_MODULUS 32
- #endif
-#endif
-
-#define lws_plat_socket_offset() (0)
-
-struct lws;
-struct lws_context;
-
-#define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) % FD_HASHTABLE_MODULUS)
-struct lws_fd_hashtable {
- struct lws **wsi;
- int length;
-};
-
-
-#ifdef LWS_DLL
-#ifdef LWS_INTERNAL
-#define LWS_EXTERN extern __declspec(dllexport)
-#else
-#define LWS_EXTERN extern __declspec(dllimport)
-#endif
-#else
-#define LWS_EXTERN
-#endif
-
-typedef SOCKET lws_sockfd_type;
-typedef HANDLE lws_filefd_type;
-#define LWS_WIN32_HANDLE_TYPES
-
-LWS_EXTERN struct lws *
-wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd);
-
-LWS_EXTERN int
-insert_wsi(struct lws_context *context, struct lws *wsi);
-
-LWS_EXTERN int
-delete_from_fd(struct lws_context *context, lws_sockfd_type fd);
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-fds.c b/thirdparty/libwebsockets/lib/plat/windows/windows-fds.c
deleted file mode 100644
index 0d324e8f3a..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-fds.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-struct lws *
-wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd)
-{
- int h = LWS_FD_HASH(fd);
- int n = 0;
-
- for (n = 0; n < context->fd_hashtable[h].length; n++)
- if (context->fd_hashtable[h].wsi[n]->desc.sockfd == fd)
- return context->fd_hashtable[h].wsi[n];
-
- return NULL;
-}
-
-int
-insert_wsi(struct lws_context *context, struct lws *wsi)
-{
- int h = LWS_FD_HASH(wsi->desc.sockfd);
-
- if (context->fd_hashtable[h].length == (getdtablesize() - 1)) {
- lwsl_err("hash table overflow\n");
- return 1;
- }
-
- context->fd_hashtable[h].wsi[context->fd_hashtable[h].length++] = wsi;
-
- return 0;
-}
-
-int
-delete_from_fd(struct lws_context *context, lws_sockfd_type fd)
-{
- int h = LWS_FD_HASH(fd);
- int n = 0;
-
- for (n = 0; n < context->fd_hashtable[h].length; n++)
- if (context->fd_hashtable[h].wsi[n]->desc.sockfd == fd) {
- while (n < context->fd_hashtable[h].length) {
- context->fd_hashtable[h].wsi[n] =
- context->fd_hashtable[h].wsi[n + 1];
- n++;
- }
- context->fd_hashtable[h].length--;
-
- return 0;
- }
-
- lwsl_err("Failed to find fd %d requested for "
- "delete in hashtable\n", fd);
- return 1;
-}
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-file.c b/thirdparty/libwebsockets/lib/plat/windows/windows-file.c
deleted file mode 100644
index eb73aab7f6..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-file.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-int lws_plat_apply_FD_CLOEXEC(int n)
-{
- return 0;
-}
-
-lws_fop_fd_t
-_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
- const char *vpath, lws_fop_flags_t *flags)
-{
- HANDLE ret;
- WCHAR buf[MAX_PATH];
- lws_fop_fd_t fop_fd;
- FILE_STANDARD_INFO fInfo = {0};
-
- MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, LWS_ARRAY_SIZE(buf));
-
-#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 // Windows 8 (minimum when UWP_ENABLED, but can be used in Windows builds)
- CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
- extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
-
- if (((*flags) & 7) == _O_RDONLY) {
- ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams);
- } else {
- ret = CreateFile2(buf, GENERIC_WRITE, 0, CREATE_ALWAYS, &extParams);
- }
-#else
- if (((*flags) & 7) == _O_RDONLY) {
- ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- } else {
- ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- }
-#endif
-
- if (ret == LWS_INVALID_FILE)
- goto bail;
-
- fop_fd = malloc(sizeof(*fop_fd));
- if (!fop_fd)
- goto bail;
-
- fop_fd->fops = fops;
- fop_fd->fd = ret;
- fop_fd->filesystem_priv = NULL; /* we don't use it */
- fop_fd->flags = *flags;
- fop_fd->len = 0;
- if(GetFileInformationByHandleEx(ret, FileStandardInfo, &fInfo, sizeof(fInfo)))
- fop_fd->len = fInfo.EndOfFile.QuadPart;
-
- fop_fd->pos = 0;
-
- return fop_fd;
-
-bail:
- return NULL;
-}
-
-int
-_lws_plat_file_close(lws_fop_fd_t *fop_fd)
-{
- HANDLE fd = (*fop_fd)->fd;
-
- free(*fop_fd);
- *fop_fd = NULL;
-
- CloseHandle((HANDLE)fd);
-
- return 0;
-}
-
-lws_fileofs_t
-_lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
-{
- LARGE_INTEGER l;
-
- l.QuadPart = offset;
- return SetFilePointerEx((HANDLE)fop_fd->fd, l, NULL, FILE_CURRENT);
-}
-
-int
-_lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t *buf, lws_filepos_t len)
-{
- DWORD _amount;
-
- if (!ReadFile((HANDLE)fop_fd->fd, buf, (DWORD)len, &_amount, NULL)) {
- *amount = 0;
-
- return 1;
- }
-
- fop_fd->pos += _amount;
- *amount = (unsigned long)_amount;
-
- return 0;
-}
-
-int
-_lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
- uint8_t* buf, lws_filepos_t len)
-{
- DWORD _amount;
-
- if (!WriteFile((HANDLE)fop_fd->fd, buf, (DWORD)len, &_amount, NULL)) {
- *amount = 0;
-
- return 1;
- }
-
- fop_fd->pos += _amount;
- *amount = (unsigned long)_amount;
-
- return 0;
-}
-
-
-int
-lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
- int len)
-{
- int n;
-
- n = write(fd, buf, len);
-
- lseek(fd, 0, SEEK_SET);
-
- return n != len;
-}
-
-int
-lws_plat_write_file(const char *filename, void *buf, int len)
-{
- int m, fd;
-
- fd = lws_open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
-
- if (fd == -1)
- return -1;
-
- m = write(fd, buf, len);
- close(fd);
-
- return m != len;
-}
-
-int
-lws_plat_read_file(const char *filename, void *buf, int len)
-{
- int n, fd = lws_open(filename, O_RDONLY);
- if (fd == -1)
- return -1;
-
- n = read(fd, buf, len);
- close(fd);
-
- return n;
-}
-
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-init.c b/thirdparty/libwebsockets/lib/plat/windows/windows-init.c
deleted file mode 100644
index 8c4d9373f6..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-init.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-void
-lws_plat_drop_app_privileges(const struct lws_context_creation_info *info)
-{
-}
-
-int
-lws_plat_context_early_init(void)
-{
- WORD wVersionRequested;
- WSADATA wsaData;
- int err;
-
- /* Use the MAKEWORD(lowbyte, highbyte) macro from Windef.h */
- wVersionRequested = MAKEWORD(2, 2);
-
- err = WSAStartup(wVersionRequested, &wsaData);
- if (!err)
- return 0;
- /*
- * Tell the user that we could not find a usable
- * Winsock DLL
- */
- lwsl_err("WSAStartup failed with error: %d\n", err);
-
- return 1;
-}
-
-int
-lws_plat_init(struct lws_context *context,
- const struct lws_context_creation_info *info)
-{
- struct lws_context_per_thread *pt = &context->pt[0];
- int i, n = context->count_threads;
-
- for (i = 0; i < FD_HASHTABLE_MODULUS; i++) {
- context->fd_hashtable[i].wsi =
- lws_zalloc(sizeof(struct lws*) * context->max_fds,
- "win hashtable");
-
- if (!context->fd_hashtable[i].wsi)
- return -1;
- }
-
- while (n--) {
- pt->fds_count = 0;
- pt->events = WSACreateEvent(); /* the cancel event */
-
- pt++;
- }
-
- context->fd_random = 0;
-
-#ifdef LWS_WITH_PLUGINS
- if (info->plugin_dirs)
- lws_plat_plugins_init(context, info->plugin_dirs);
-#endif
-
- return 0;
-}
-
-void
-lws_plat_context_early_destroy(struct lws_context *context)
-{
- struct lws_context_per_thread *pt = &context->pt[0];
- int n = context->count_threads;
-
- while (n--) {
- WSACloseEvent(pt->events);
- pt++;
- }
-}
-
-void
-lws_plat_context_late_destroy(struct lws_context *context)
-{
- int n;
-
- for (n = 0; n < FD_HASHTABLE_MODULUS; n++) {
- if (context->fd_hashtable[n].wsi)
- lws_free(context->fd_hashtable[n].wsi);
- }
-
- WSACleanup();
-}
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-misc.c b/thirdparty/libwebsockets/lib/plat/windows/windows-misc.c
deleted file mode 100644
index 53cc19b6b9..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-misc.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-
-uint64_t
-lws_time_in_microseconds()
-{
-#ifndef DELTA_EPOCH_IN_MICROSECS
-#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
-#endif
- FILETIME filetime;
- ULARGE_INTEGER datetime;
-
-#ifdef _WIN32_WCE
- GetCurrentFT(&filetime);
-#else
- GetSystemTimeAsFileTime(&filetime);
-#endif
-
- /*
- * As per Windows documentation for FILETIME, copy the resulting
- * FILETIME structure to a ULARGE_INTEGER structure using memcpy
- * (using memcpy instead of direct assignment can prevent alignment
- * faults on 64-bit Windows).
- */
- memcpy(&datetime, &filetime, sizeof(datetime));
-
- /* Windows file times are in 100s of nanoseconds. */
- return (datetime.QuadPart / 10) - DELTA_EPOCH_IN_MICROSECS;
-}
-
-
-#ifdef _WIN32_WCE
-time_t time(time_t *t)
-{
- time_t ret = lws_time_in_microseconds() / 1000000;
-
- if(t != NULL)
- *t = ret;
-
- return ret;
-}
-#endif
-
-LWS_VISIBLE int
-lws_get_random(struct lws_context *context, void *buf, int len)
-{
- int n;
- char *p = (char *)buf;
-
- for (n = 0; n < len; n++)
- p[n] = (unsigned char)rand();
-
- return n;
-}
-
-
-LWS_VISIBLE void
-lwsl_emit_syslog(int level, const char *line)
-{
- lwsl_emit_stderr(level, line);
-}
-
-
-int kill(int pid, int sig)
-{
- lwsl_err("Sorry Windows doesn't support kill().");
- exit(0);
-}
-
-int fork(void)
-{
- lwsl_err("Sorry Windows doesn't support fork().");
- exit(0);
-}
-
-
-int
-lws_plat_recommended_rsa_bits(void)
-{
- return 4096;
-}
-
-
-
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-pipe.c b/thirdparty/libwebsockets/lib/plat/windows/windows-pipe.c
deleted file mode 100644
index af2af1fa83..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-pipe.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-int
-lws_plat_pipe_create(struct lws *wsi)
-{
- return 1;
-}
-
-int
-lws_plat_pipe_signal(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
-
- WSASetEvent(pt->events); /* trigger the cancel event */
-
- return 0;
-}
-
-void
-lws_plat_pipe_close(struct lws *wsi)
-{
-}
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-service.c b/thirdparty/libwebsockets/lib/plat/windows/windows-service.c
deleted file mode 100644
index a6adefbd3b..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-service.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-
-LWS_EXTERN int
-_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
-{
- struct lws_context_per_thread *pt;
- WSANETWORKEVENTS networkevents;
- struct lws_pollfd *pfd;
- struct lws *wsi;
- unsigned int i;
- DWORD ev;
- int n;
-
- /* stay dead once we are dead */
- if (context == NULL || !context->vhost_list)
- return 1;
-
- pt = &context->pt[tsi];
-
- if (!pt->service_tid_detected) {
- struct lws _lws;
-
- memset(&_lws, 0, sizeof(_lws));
- _lws.context = context;
-
- pt->service_tid = context->vhost_list->
- protocols[0].callback(&_lws, LWS_CALLBACK_GET_THREAD_ID,
- NULL, NULL, 0);
- pt->service_tid_detected = 1;
- }
-
- if (timeout_ms < 0) {
- if (lws_service_flag_pending(context, tsi)) {
- /* any socket with events to service? */
- for (n = 0; n < (int)pt->fds_count; n++) {
- int m;
- if (!pt->fds[n].revents)
- continue;
-
- m = lws_service_fd_tsi(context, &pt->fds[n], tsi);
- if (m < 0)
- return -1;
- /* if something closed, retry this slot */
- if (m)
- n--;
- }
- }
- return 0;
- }
-
- if (context->event_loop_ops->run_pt)
- context->event_loop_ops->run_pt(context, tsi);
-
- for (i = 0; i < pt->fds_count; ++i) {
- pfd = &pt->fds[i];
-
- if (!(pfd->events & LWS_POLLOUT))
- continue;
-
- wsi = wsi_from_fd(context, pfd->fd);
- if (!wsi || wsi->listener)
- continue;
- if (wsi->sock_send_blocking)
- continue;
- pfd->revents = LWS_POLLOUT;
- n = lws_service_fd(context, pfd);
- if (n < 0)
- return -1;
-
- /* Force WSAWaitForMultipleEvents() to check events and then return immediately. */
- timeout_ms = 0;
-
- /* if something closed, retry this slot */
- if (n)
- i--;
- }
-
- /*
- * is there anybody with pending stuff that needs service forcing?
- */
- if (!lws_service_adjust_timeout(context, 1, tsi)) {
- /* -1 timeout means just do forced service */
- _lws_plat_service_tsi(context, -1, pt->tid);
- /* still somebody left who wants forced service? */
- if (!lws_service_adjust_timeout(context, 1, pt->tid))
- /* yes... come back again quickly */
- timeout_ms = 0;
- }
-
- if (timeout_ms) {
- lws_usec_t t;
-
- lws_pt_lock(pt, __func__);
- /* don't stay in poll wait longer than next hr timeout */
- t = __lws_hrtimer_service(pt);
-
- if ((lws_usec_t)timeout_ms * 1000 > t)
- timeout_ms = (int)(t / 1000);
- lws_pt_unlock(pt);
- }
-
- ev = WSAWaitForMultipleEvents(1, &pt->events, FALSE, timeout_ms, FALSE);
- if (ev == WSA_WAIT_EVENT_0) {
- unsigned int eIdx;
-
- WSAResetEvent(pt->events);
-
- if (pt->context->tls_ops &&
- pt->context->tls_ops->fake_POLLIN_for_buffered)
- pt->context->tls_ops->fake_POLLIN_for_buffered(pt);
-
- for (eIdx = 0; eIdx < pt->fds_count; ++eIdx) {
- unsigned int err;
-
- if (WSAEnumNetworkEvents(pt->fds[eIdx].fd, 0,
- &networkevents) == SOCKET_ERROR) {
- lwsl_err("WSAEnumNetworkEvents() failed "
- "with error %d\n", LWS_ERRNO);
- return -1;
- }
-
- pfd = &pt->fds[eIdx];
- pfd->revents = (short)networkevents.lNetworkEvents;
-
- err = networkevents.iErrorCode[FD_CONNECT_BIT];
-
- if ((networkevents.lNetworkEvents & FD_CONNECT) &&
- err && err != LWS_EALREADY &&
- err != LWS_EINPROGRESS && err != LWS_EWOULDBLOCK &&
- err != WSAEINVAL) {
- lwsl_debug("Unable to connect errno=%d\n", err);
- pfd->revents |= LWS_POLLHUP;
- }
-
- if (pfd->revents & LWS_POLLOUT) {
- wsi = wsi_from_fd(context, pfd->fd);
- if (wsi)
- wsi->sock_send_blocking = 0;
- }
- /* if something closed, retry this slot */
- if (pfd->revents & LWS_POLLHUP)
- --eIdx;
-
- if (pfd->revents) {
- recv(pfd->fd, NULL, 0, 0);
- lws_service_fd_tsi(context, pfd, tsi);
- }
- }
- }
-
- if (ev == WSA_WAIT_TIMEOUT)
- lws_service_fd(context, NULL);
-
- return 0;
-}
-
-int
-lws_plat_service(struct lws_context *context, int timeout_ms)
-{
- return _lws_plat_service_tsi(context, timeout_ms, 0);
-}
-
-
-
-void
-lws_plat_service_periodic(struct lws_context *context)
-{
-}
-
diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
deleted file mode 100644
index 62a0a49846..0000000000
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
+++ /dev/null
@@ -1,288 +0,0 @@
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS
-#endif
-#include "core/private.h"
-
-
-LWS_VISIBLE int
-lws_send_pipe_choked(struct lws *wsi)
-{ struct lws *wsi_eff;
-
-#if defined(LWS_WITH_HTTP2)
- wsi_eff = lws_get_network_wsi(wsi);
-#else
- wsi_eff = wsi;
-#endif
- /* the fact we checked implies we avoided back-to-back writes */
- wsi_eff->could_have_pending = 0;
-
- /* treat the fact we got a truncated send pending as if we're choked */
- if (lws_has_buffered_out(wsi_eff)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- ||wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more
-#endif
- )
- return 1;
-
- return (int)wsi_eff->sock_send_blocking;
-}
-
-int
-lws_poll_listen_fd(struct lws_pollfd *fd)
-{
- fd_set readfds;
- struct timeval tv = { 0, 0 };
-
- assert((fd->events & LWS_POLLIN) == LWS_POLLIN);
-
- FD_ZERO(&readfds);
- FD_SET(fd->fd, &readfds);
-
- return select(((int)fd->fd) + 1, &readfds, NULL, NULL, &tv);
-}
-
-int
-lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
- int unix_skt)
-{
- int optval = 1;
- int optlen = sizeof(optval);
- u_long optl = 1;
- DWORD dwBytesRet;
- struct tcp_keepalive alive;
- int protonbr;
-#ifndef _WIN32_WCE
- struct protoent *tcp_proto;
-#endif
-
-#ifdef LWS_WITH_IPV6
- optval = 0;
- setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
-#endif
-
- if (vhost->ka_time) {
- /* enable keepalive on this socket */
- optval = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
- (const char *)&optval, optlen) < 0)
- return 1;
-
- alive.onoff = TRUE;
- alive.keepalivetime = vhost->ka_time;
- alive.keepaliveinterval = vhost->ka_interval;
-
- if (WSAIoctl(fd, SIO_KEEPALIVE_VALS, &alive, sizeof(alive),
- NULL, 0, &dwBytesRet, NULL, NULL))
- return 1;
- }
-
- /* Disable Nagle */
- optval = 1;
-#ifndef _WIN32_WCE
- tcp_proto = getprotobyname("TCP");
- if (!tcp_proto) {
- lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO);
- return 1;
- }
- protonbr = tcp_proto->p_proto;
-#else
- protonbr = 6;
-#endif
-
- setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen);
-
- /* We are nonblocking... */
- ioctlsocket(fd, FIONBIO, &optl);
-
- return 0;
-}
-
-
-LWS_EXTERN int
-lws_interface_to_sa(int ipv6,
- const char *ifname, struct sockaddr_in *addr, size_t addrlen)
-{
-#ifdef LWS_WITH_IPV6
- struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
-
- if (ipv6) {
- if (lws_plat_inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1) {
- return LWS_ITOSA_USABLE;
- }
- }
-#endif
-
- long long address = inet_addr(ifname);
-
- if (address == INADDR_NONE) {
- struct hostent *entry = gethostbyname(ifname);
- if (entry)
- address = ((struct in_addr *)entry->h_addr_list[0])->s_addr;
- }
-
- if (address == INADDR_NONE)
- return LWS_ITOSA_NOT_EXIST;
-
- addr->sin_addr.s_addr = (unsigned long)(lws_intptr_t)address;
-
- return LWS_ITOSA_USABLE;
-}
-
-void
-lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
-
- pt->fds[pt->fds_count++].revents = 0;
- WSAEventSelect(wsi->desc.sockfd, pt->events,
- LWS_POLLIN | LWS_POLLHUP | FD_CONNECT);
-}
-
-void
-lws_plat_delete_socket_from_fds(struct lws_context *context,
- struct lws *wsi, int m)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
-
- pt->fds_count--;
-}
-
-
-int
-lws_plat_check_connection_error(struct lws *wsi)
-{
- int optVal;
- int optLen = sizeof(int);
-
- if (getsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_ERROR,
- (char*)&optVal, &optLen) != SOCKET_ERROR && optVal &&
- optVal != LWS_EALREADY && optVal != LWS_EINPROGRESS &&
- optVal != LWS_EWOULDBLOCK && optVal != WSAEINVAL) {
- lwsl_debug("Connect failed SO_ERROR=%d\n", optVal);
- return 1;
- }
-
- return 0;
-}
-
-int
-lws_plat_change_pollfd(struct lws_context *context,
- struct lws *wsi, struct lws_pollfd *pfd)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- long networkevents = LWS_POLLHUP | FD_CONNECT;
-
- if ((pfd->events & LWS_POLLIN))
- networkevents |= LWS_POLLIN;
-
- if ((pfd->events & LWS_POLLOUT))
- networkevents |= LWS_POLLOUT;
-
- if (WSAEventSelect(wsi->desc.sockfd, pt->events,
- networkevents) != SOCKET_ERROR)
- return 0;
-
- lwsl_err("WSAEventSelect() failed with error %d\n", LWS_ERRNO);
-
- return 1;
-}
-
-const char *
-lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
-{
- WCHAR *buffer;
- DWORD bufferlen = cnt;
- BOOL ok = FALSE;
-
- buffer = lws_malloc(bufferlen * 2, "inet_ntop");
- if (!buffer) {
- lwsl_err("Out of memory\n");
- return NULL;
- }
-
- if (af == AF_INET) {
- struct sockaddr_in srcaddr;
- bzero(&srcaddr, sizeof(srcaddr));
- srcaddr.sin_family = AF_INET;
- memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr));
-
- if (!WSAAddressToStringW((struct sockaddr*)&srcaddr, sizeof(srcaddr), 0, buffer, &bufferlen))
- ok = TRUE;
-#ifdef LWS_WITH_IPV6
- } else if (af == AF_INET6) {
- struct sockaddr_in6 srcaddr;
- bzero(&srcaddr, sizeof(srcaddr));
- srcaddr.sin6_family = AF_INET6;
- memcpy(&(srcaddr.sin6_addr), src, sizeof(srcaddr.sin6_addr));
-
- if (!WSAAddressToStringW((struct sockaddr*)&srcaddr, sizeof(srcaddr), 0, buffer, &bufferlen))
- ok = TRUE;
-#endif
- } else
- lwsl_err("Unsupported type\n");
-
- if (!ok) {
- int rv = WSAGetLastError();
- lwsl_err("WSAAddressToString() : %d\n", rv);
- } else {
- if (WideCharToMultiByte(CP_ACP, 0, buffer, bufferlen, dst, cnt, 0, NULL) <= 0)
- ok = FALSE;
- }
-
- lws_free(buffer);
- return ok ? dst : NULL;
-}
-
-int
-lws_plat_inet_pton(int af, const char *src, void *dst)
-{
- WCHAR *buffer;
- DWORD bufferlen = (int)strlen(src) + 1;
- BOOL ok = FALSE;
-
- buffer = lws_malloc(bufferlen * 2, "inet_pton");
- if (!buffer) {
- lwsl_err("Out of memory\n");
- return -1;
- }
-
- if (MultiByteToWideChar(CP_ACP, 0, src, bufferlen, buffer, bufferlen) <= 0) {
- lwsl_err("Failed to convert multi byte to wide char\n");
- lws_free(buffer);
- return -1;
- }
-
- if (af == AF_INET) {
- struct sockaddr_in dstaddr;
- int dstaddrlen = sizeof(dstaddr);
- bzero(&dstaddr, sizeof(dstaddr));
- dstaddr.sin_family = AF_INET;
-
- if (!WSAStringToAddressW(buffer, af, 0, (struct sockaddr *) &dstaddr, &dstaddrlen)) {
- ok = TRUE;
- memcpy(dst, &dstaddr.sin_addr, sizeof(dstaddr.sin_addr));
- }
-#ifdef LWS_WITH_IPV6
- } else if (af == AF_INET6) {
- struct sockaddr_in6 dstaddr;
- int dstaddrlen = sizeof(dstaddr);
- bzero(&dstaddr, sizeof(dstaddr));
- dstaddr.sin6_family = AF_INET6;
-
- if (!WSAStringToAddressW(buffer, af, 0, (struct sockaddr *) &dstaddr, &dstaddrlen)) {
- ok = TRUE;
- memcpy(dst, &dstaddr.sin6_addr, sizeof(dstaddr.sin6_addr));
- }
-#endif
- } else
- lwsl_err("Unsupported type\n");
-
- if (!ok) {
- int rv = WSAGetLastError();
- lwsl_err("WSAAddressToString() : %d\n", rv);
- }
-
- lws_free(buffer);
- return ok ? 1 : -1;
-}
diff --git a/thirdparty/libwebsockets/lib/roles/raw-file/ops-raw-file.c b/thirdparty/libwebsockets/lib/roles/raw-file/ops-raw-file.c
deleted file mode 100644
index 075a2ee8b1..0000000000
--- a/thirdparty/libwebsockets/lib/roles/raw-file/ops-raw-file.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include <core/private.h>
-
-static int
-rops_handle_POLLIN_raw_file(struct lws_context_per_thread *pt, struct lws *wsi,
- struct lws_pollfd *pollfd)
-{
- int n;
-
- if (pollfd->revents & LWS_POLLOUT) {
- n = lws_callback_as_writeable(wsi);
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_info("failed at set pollfd\n");
- return LWS_HPI_RET_WSI_ALREADY_DIED;
- }
- if (n)
- return LWS_HPI_RET_PLEASE_CLOSE_ME;
- }
-
- if (pollfd->revents & LWS_POLLIN) {
- if (user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_RAW_RX_FILE,
- wsi->user_space, NULL, 0)) {
- lwsl_debug("raw rx callback closed it\n");
- return LWS_HPI_RET_PLEASE_CLOSE_ME;
- }
- }
-
- if (pollfd->revents & LWS_POLLHUP)
- return LWS_HPI_RET_PLEASE_CLOSE_ME;
-
- return LWS_HPI_RET_HANDLED;
-}
-
-#if !defined(LWS_NO_SERVER)
-static int
-rops_adoption_bind_raw_file(struct lws *wsi, int type, const char *vh_prot_name)
-{
- /* no socket or http: it can only be a raw file */
- if ((type & LWS_ADOPT_HTTP) || (type & LWS_ADOPT_SOCKET) ||
- (type & _LWS_ADOPT_FINISH))
- return 0; /* no match */
-
- lws_role_transition(wsi, 0, LRS_ESTABLISHED, &role_ops_raw_file);
-
- if (!vh_prot_name)
- wsi->protocol = &wsi->vhost->protocols[
- wsi->vhost->default_protocol_index];
-
- return 1; /* bound */
-}
-#endif
-
-struct lws_role_ops role_ops_raw_file = {
- /* role name */ "raw-file",
- /* alpn id */ NULL,
- /* check_upgrades */ NULL,
- /* init_context */ NULL,
- /* init_vhost */ NULL,
- /* destroy_vhost */ NULL,
- /* periodic_checks */ NULL,
- /* service_flag_pending */ NULL,
- /* handle_POLLIN */ rops_handle_POLLIN_raw_file,
- /* handle_POLLOUT */ NULL,
- /* perform_user_POLLOUT */ NULL,
- /* callback_on_writable */ NULL,
- /* tx_credit */ NULL,
- /* write_role_protocol */ NULL,
- /* encapsulation_parent */ NULL,
- /* alpn_negotiated */ NULL,
- /* close_via_role_protocol */ NULL,
- /* close_role */ NULL,
- /* close_kill_connection */ NULL,
- /* destroy_role */ NULL,
-#if !defined(LWS_NO_SERVER)
- /* adoption_bind */ rops_adoption_bind_raw_file,
-#else
- NULL,
-#endif
- /* client_bind */ NULL,
- /* writeable cb clnt, srv */ { LWS_CALLBACK_RAW_WRITEABLE_FILE, 0 },
- /* close cb clnt, srv */ { LWS_CALLBACK_RAW_CLOSE_FILE, 0 },
- /* protocol_bind cb c, srv */ { LWS_CALLBACK_RAW_FILE_BIND_PROTOCOL,
- LWS_CALLBACK_RAW_FILE_BIND_PROTOCOL },
- /* protocol_unbind cb c, srv */ { LWS_CALLBACK_RAW_FILE_DROP_PROTOCOL,
- LWS_CALLBACK_RAW_FILE_DROP_PROTOCOL },
- /* file_handle */ 1,
-};
diff --git a/thirdparty/libwebsockets/libwebsockets.h b/thirdparty/libwebsockets/libwebsockets.h
new file mode 100644
index 0000000000..2c01696404
--- /dev/null
+++ b/thirdparty/libwebsockets/libwebsockets.h
@@ -0,0 +1,7346 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+/** @file */
+
+#ifndef LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
+#define LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
+
+#ifdef __cplusplus
+#include <cstddef>
+#include <cstdarg>
+
+extern "C" {
+#else
+#include <stdarg.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "lws_config.h"
+
+/*
+ * CARE: everything using cmake defines needs to be below here
+ */
+
+#if defined(LWS_HAS_INTPTR_T)
+#include <stdint.h>
+#define lws_intptr_t intptr_t
+#else
+typedef unsigned long long lws_intptr_t;
+#endif
+
+#if defined(WIN32) || defined(_WIN32)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <stddef.h>
+#include <basetsd.h>
+#include <io.h>
+#ifndef _WIN32_WCE
+#include <fcntl.h>
+#else
+#define _O_RDONLY 0x0000
+#define O_RDONLY _O_RDONLY
+#endif
+
+#define LWS_INLINE __inline
+#define LWS_VISIBLE
+#define LWS_WARN_UNUSED_RESULT
+#define LWS_WARN_DEPRECATED
+#define LWS_FORMAT(string_index)
+
+#ifdef LWS_DLL
+#ifdef LWS_INTERNAL
+#define LWS_EXTERN extern __declspec(dllexport)
+#else
+#define LWS_EXTERN extern __declspec(dllimport)
+#endif
+#else
+#define LWS_EXTERN
+#endif
+
+#define LWS_INVALID_FILE INVALID_HANDLE_VALUE
+#define LWS_O_RDONLY _O_RDONLY
+#define LWS_O_WRONLY _O_WRONLY
+#define LWS_O_CREAT _O_CREAT
+#define LWS_O_TRUNC _O_TRUNC
+
+#ifndef __func__
+#define __func__ __FUNCTION__
+#endif
+
+#else /* NOT WIN32 */
+#include <unistd.h>
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+#include <sys/capability.h>
+#endif
+
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__QNX__) || defined(__OpenBSD__)
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif
+
+#define LWS_INLINE inline
+#define LWS_O_RDONLY O_RDONLY
+#define LWS_O_WRONLY O_WRONLY
+#define LWS_O_CREAT O_CREAT
+#define LWS_O_TRUNC O_TRUNC
+
+#if !defined(LWS_PLAT_OPTEE) && !defined(OPTEE_TA) && !defined(LWS_WITH_ESP32)
+#include <poll.h>
+#include <netdb.h>
+#define LWS_INVALID_FILE -1
+#else
+#define getdtablesize() (30)
+#if defined(LWS_WITH_ESP32)
+#define LWS_INVALID_FILE NULL
+#else
+#define LWS_INVALID_FILE NULL
+#endif
+#endif
+
+#if defined(__GNUC__)
+
+/* warn_unused_result attribute only supported by GCC 3.4 or later */
+#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#define LWS_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#define LWS_WARN_UNUSED_RESULT
+#endif
+
+#define LWS_VISIBLE __attribute__((visibility("default")))
+#define LWS_WARN_DEPRECATED __attribute__ ((deprecated))
+#define LWS_FORMAT(string_index) __attribute__ ((format(printf, string_index, string_index+1)))
+#else
+#define LWS_VISIBLE
+#define LWS_WARN_UNUSED_RESULT
+#define LWS_WARN_DEPRECATED
+#define LWS_FORMAT(string_index)
+#endif
+
+#if defined(__ANDROID__)
+#include <netinet/in.h>
+#include <unistd.h>
+#define getdtablesize() sysconf(_SC_OPEN_MAX)
+#endif
+
+#endif
+
+#if defined(LWS_WITH_LIBEV)
+#include <ev.h>
+#endif /* LWS_WITH_LIBEV */
+#ifdef LWS_WITH_LIBUV
+#include <uv.h>
+#ifdef LWS_HAVE_UV_VERSION_H
+#include <uv-version.h>
+#endif
+#ifdef LWS_HAVE_NEW_UV_VERSION_H
+#include <uv/version.h>
+#endif
+#endif /* LWS_WITH_LIBUV */
+#if defined(LWS_WITH_LIBEVENT)
+#include <event2/event.h>
+#endif /* LWS_WITH_LIBEVENT */
+
+#ifndef LWS_EXTERN
+#define LWS_EXTERN extern
+#endif
+
+#ifdef _WIN32
+#define random rand
+#else
+#if !defined(OPTEE_TA)
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+#endif
+
+#if defined(LWS_WITH_TLS)
+
+#ifdef USE_WOLFSSL
+#ifdef USE_OLD_CYASSL
+#ifdef _WIN32
+/*
+ * Include user-controlled settings for windows from
+ * <wolfssl-root>/IDE/WIN/user_settings.h
+ */
+#include <IDE/WIN/user_settings.h>
+#include <cyassl/ctaocrypt/settings.h>
+#else
+#include <cyassl/options.h>
+#endif
+#include <cyassl/openssl/ssl.h>
+#include <cyassl/error-ssl.h>
+
+#else
+#ifdef _WIN32
+/*
+ * Include user-controlled settings for windows from
+ * <wolfssl-root>/IDE/WIN/user_settings.h
+ */
+#include <IDE/WIN/user_settings.h>
+#include <wolfssl/wolfcrypt/settings.h>
+#else
+#include <wolfssl/options.h>
+#endif
+#include <wolfssl/openssl/ssl.h>
+#include <wolfssl/error-ssl.h>
+#endif /* not USE_OLD_CYASSL */
+#else
+#if defined(LWS_WITH_MBEDTLS)
+#if defined(LWS_WITH_ESP32)
+/* this filepath is passed to us but without quotes or <> */
+#undef MBEDTLS_CONFIG_FILE
+#define MBEDTLS_CONFIG_FILE <mbedtls/esp_config.h>
+#endif
+#include <mbedtls/ssl.h>
+#else
+#include <openssl/ssl.h>
+#if !defined(LWS_WITH_MBEDTLS)
+#include <openssl/err.h>
+#endif
+#endif
+#endif /* not USE_WOLFSSL */
+#endif
+
+/*
+ * Helpers for pthread mutex in user code... if lws is built for
+ * multiple service threads, these resolve to pthread mutex
+ * operations. In the case LWS_MAX_SMP is 1 (the default), they
+ * are all NOPs and no pthread type or api is referenced.
+ */
+
+#if LWS_MAX_SMP > 1
+
+#include <pthread.h>
+
+#define lws_pthread_mutex(name) pthread_mutex_t name;
+
+static LWS_INLINE void
+lws_pthread_mutex_init(pthread_mutex_t *lock)
+{
+ pthread_mutex_init(lock, NULL);
+}
+
+static LWS_INLINE void
+lws_pthread_mutex_destroy(pthread_mutex_t *lock)
+{
+ pthread_mutex_destroy(lock);
+}
+
+static LWS_INLINE void
+lws_pthread_mutex_lock(pthread_mutex_t *lock)
+{
+ pthread_mutex_lock(lock);
+}
+
+static LWS_INLINE void
+lws_pthread_mutex_unlock(pthread_mutex_t *lock)
+{
+ pthread_mutex_unlock(lock);
+}
+
+#else
+#define lws_pthread_mutex(name)
+#define lws_pthread_mutex_init(_a)
+#define lws_pthread_mutex_destroy(_a)
+#define lws_pthread_mutex_lock(_a)
+#define lws_pthread_mutex_unlock(_a)
+#endif
+
+
+#define CONTEXT_PORT_NO_LISTEN -1
+#define CONTEXT_PORT_NO_LISTEN_SERVER -2
+
+/** \defgroup log Logging
+ *
+ * ##Logging
+ *
+ * Lws provides flexible and filterable logging facilities, which can be
+ * used inside lws and in user code.
+ *
+ * Log categories may be individually filtered bitwise, and directed to built-in
+ * sinks for syslog-compatible logging, or a user-defined function.
+ */
+///@{
+
+enum lws_log_levels {
+ LLL_ERR = 1 << 0,
+ LLL_WARN = 1 << 1,
+ LLL_NOTICE = 1 << 2,
+ LLL_INFO = 1 << 3,
+ LLL_DEBUG = 1 << 4,
+ LLL_PARSER = 1 << 5,
+ LLL_HEADER = 1 << 6,
+ LLL_EXT = 1 << 7,
+ LLL_CLIENT = 1 << 8,
+ LLL_LATENCY = 1 << 9,
+ LLL_USER = 1 << 10,
+
+ LLL_COUNT = 11 /* set to count of valid flags */
+};
+
+LWS_VISIBLE LWS_EXTERN void _lws_log(int filter, const char *format, ...) LWS_FORMAT(2);
+LWS_VISIBLE LWS_EXTERN void _lws_logv(int filter, const char *format, va_list vl);
+/**
+ * lwsl_timestamp: generate logging timestamp string
+ *
+ * \param level: logging level
+ * \param p: char * buffer to take timestamp
+ * \param len: length of p
+ *
+ * returns length written in p
+ */
+LWS_VISIBLE LWS_EXTERN int
+lwsl_timestamp(int level, char *p, int len);
+
+/* these guys are unconditionally included */
+
+#define lwsl_err(...) _lws_log(LLL_ERR, __VA_ARGS__)
+#define lwsl_user(...) _lws_log(LLL_USER, __VA_ARGS__)
+
+#if !defined(LWS_WITH_NO_LOGS)
+/* notice and warn are usually included by being compiled in */
+#define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
+#define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
+#endif
+/*
+ * weaker logging can be deselected by telling CMake to build in RELEASE mode
+ * that gets rid of the overhead of checking while keeping _warn and _err
+ * active
+ */
+
+#ifdef _DEBUG
+#if defined(LWS_WITH_NO_LOGS)
+/* notice, warn and log are always compiled in */
+#define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
+#define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
+#endif
+#define lwsl_info(...) _lws_log(LLL_INFO, __VA_ARGS__)
+#define lwsl_debug(...) _lws_log(LLL_DEBUG, __VA_ARGS__)
+#define lwsl_parser(...) _lws_log(LLL_PARSER, __VA_ARGS__)
+#define lwsl_header(...) _lws_log(LLL_HEADER, __VA_ARGS__)
+#define lwsl_ext(...) _lws_log(LLL_EXT, __VA_ARGS__)
+#define lwsl_client(...) _lws_log(LLL_CLIENT, __VA_ARGS__)
+#define lwsl_latency(...) _lws_log(LLL_LATENCY, __VA_ARGS__)
+
+#else /* no debug */
+#if defined(LWS_WITH_NO_LOGS)
+#define lwsl_warn(...) do {} while(0)
+#define lwsl_notice(...) do {} while(0)
+#endif
+#define lwsl_info(...) do {} while(0)
+#define lwsl_debug(...) do {} while(0)
+#define lwsl_parser(...) do {} while(0)
+#define lwsl_header(...) do {} while(0)
+#define lwsl_ext(...) do {} while(0)
+#define lwsl_client(...) do {} while(0)
+#define lwsl_latency(...) do {} while(0)
+
+#endif
+
+#define lwsl_hexdump_err(...) lwsl_hexdump_level(LLL_ERR, __VA_ARGS__)
+#define lwsl_hexdump_warn(...) lwsl_hexdump_level(LLL_WARN, __VA_ARGS__)
+#define lwsl_hexdump_notice(...) lwsl_hexdump_level(LLL_NOTICE, __VA_ARGS__)
+#define lwsl_hexdump_info(...) lwsl_hexdump_level(LLL_INFO, __VA_ARGS__)
+#define lwsl_hexdump_debug(...) lwsl_hexdump_level(LLL_DEBUG, __VA_ARGS__)
+
+/**
+ * lwsl_hexdump_level() - helper to hexdump a buffer at a selected debug level
+ *
+ * \param level: one of LLL_ constants
+ * \param vbuf: buffer start to dump
+ * \param len: length of buffer to dump
+ *
+ * If \p level is visible, does a nice hexdump -C style dump of \p vbuf for
+ * \p len bytes. This can be extremely convenient while debugging.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lwsl_hexdump_level(int level, const void *vbuf, size_t len);
+
+/**
+ * lwsl_hexdump() - helper to hexdump a buffer (DEBUG builds only)
+ *
+ * \param buf: buffer start to dump
+ * \param len: length of buffer to dump
+ *
+ * Calls through to lwsl_hexdump_level(LLL_DEBUG, ... for compatability.
+ * It's better to use lwsl_hexdump_level(level, ... directly so you can control
+ * the visibility.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lwsl_hexdump(const void *buf, size_t len);
+
+/**
+ * lws_is_be() - returns nonzero if the platform is Big Endian
+ */
+static LWS_INLINE int lws_is_be(void) {
+ const int probe = ~0xff;
+
+ return *(const char *)&probe;
+}
+
+/**
+ * lws_set_log_level() - Set the logging bitfield
+ * \param level: OR together the LLL_ debug contexts you want output from
+ * \param log_emit_function: NULL to leave it as it is, or a user-supplied
+ * function to perform log string emission instead of
+ * the default stderr one.
+ *
+ * log level defaults to "err", "warn" and "notice" contexts enabled and
+ * emission on stderr. If stderr is a tty (according to isatty()) then
+ * the output is coloured according to the log level using ANSI escapes.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_set_log_level(int level,
+ void (*log_emit_function)(int level, const char *line));
+
+/**
+ * lwsl_emit_syslog() - helper log emit function writes to system log
+ *
+ * \param level: one of LLL_ log level indexes
+ * \param line: log string
+ *
+ * You use this by passing the function pointer to lws_set_log_level(), to set
+ * it as the log emit function, it is not called directly.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lwsl_emit_syslog(int level, const char *line);
+
+/**
+ * lwsl_visible() - returns true if the log level should be printed
+ *
+ * \param level: one of LLL_ log level indexes
+ *
+ * This is useful if you have to do work to generate the log content, you
+ * can skip the work if the log level used to print it is not actually
+ * enabled at runtime.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lwsl_visible(int level);
+
+///@}
+
+
+#include <stddef.h>
+
+#ifndef lws_container_of
+#define lws_container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
+#endif
+
+struct lws;
+
+typedef int64_t lws_usec_t;
+
+/* api change list for user code to test against */
+
+#define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
+
+/* the struct lws_protocols has the id field present */
+#define LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD
+
+/* you can call lws_get_peer_write_allowance */
+#define LWS_FEATURE_PROTOCOLS_HAS_PEER_WRITE_ALLOWANCE
+
+/* extra parameter introduced in 917f43ab821 */
+#define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_LEN
+
+/* File operations stuff exists */
+#define LWS_FEATURE_FOPS
+
+
+#if defined(_WIN32)
+typedef SOCKET lws_sockfd_type;
+typedef HANDLE lws_filefd_type;
+
+struct lws_pollfd {
+ lws_sockfd_type fd; /**< file descriptor */
+ SHORT events; /**< which events to respond to */
+ SHORT revents; /**< which events happened */
+};
+#define LWS_POLLHUP (FD_CLOSE)
+#define LWS_POLLIN (FD_READ | FD_ACCEPT)
+#define LWS_POLLOUT (FD_WRITE)
+#else
+
+
+#if defined(LWS_WITH_ESP32)
+
+typedef int lws_sockfd_type;
+typedef int lws_filefd_type;
+
+struct pollfd {
+ lws_sockfd_type fd; /**< fd related to */
+ short events; /**< which POLL... events to respond to */
+ short revents; /**< which POLL... events occurred */
+};
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+
+#include <freertos/FreeRTOS.h>
+#include <freertos/event_groups.h>
+#include <string.h>
+#include "esp_wifi.h"
+#include "esp_system.h"
+#include "esp_event.h"
+#include "esp_event_loop.h"
+#include "nvs.h"
+#include "driver/gpio.h"
+#include "esp_spi_flash.h"
+#include "freertos/timers.h"
+
+#if !defined(CONFIG_FREERTOS_HZ)
+#define CONFIG_FREERTOS_HZ 100
+#endif
+
+typedef TimerHandle_t uv_timer_t;
+typedef void uv_cb_t(uv_timer_t *);
+typedef void * uv_handle_t;
+
+struct timer_mapping {
+ uv_cb_t *cb;
+ uv_timer_t *t;
+};
+
+#define UV_VERSION_MAJOR 1
+
+#define lws_uv_getloop(a, b) (NULL)
+
+static LWS_INLINE void uv_timer_init(void *l, uv_timer_t *t)
+{
+ (void)l;
+ *t = NULL;
+}
+
+extern void esp32_uvtimer_cb(TimerHandle_t t);
+
+static LWS_INLINE void uv_timer_start(uv_timer_t *t, uv_cb_t *cb, int first, int rep)
+{
+ struct timer_mapping *tm = (struct timer_mapping *)malloc(sizeof(*tm));
+
+ if (!tm)
+ return;
+
+ tm->t = t;
+ tm->cb = cb;
+
+ *t = xTimerCreate("x", pdMS_TO_TICKS(first), !!rep, tm,
+ (TimerCallbackFunction_t)esp32_uvtimer_cb);
+ xTimerStart(*t, 0);
+}
+
+static LWS_INLINE void uv_timer_stop(uv_timer_t *t)
+{
+ xTimerStop(*t, 0);
+}
+
+static LWS_INLINE void uv_close(uv_handle_t *h, void *v)
+{
+ free(pvTimerGetTimerID((uv_timer_t)h));
+ xTimerDelete(*(uv_timer_t *)h, 0);
+}
+
+/* ESP32 helper declarations */
+
+#include <mdns.h>
+#include <esp_partition.h>
+
+#define LWS_PLUGIN_STATIC
+#define LWS_MAGIC_REBOOT_TYPE_ADS 0x50001ffc
+#define LWS_MAGIC_REBOOT_TYPE_REQ_FACTORY 0xb00bcafe
+#define LWS_MAGIC_REBOOT_TYPE_FORCED_FACTORY 0xfaceb00b
+#define LWS_MAGIC_REBOOT_TYPE_FORCED_FACTORY_BUTTON 0xf0cedfac
+
+
+/* user code provides these */
+
+extern void
+lws_esp32_identify_physical_device(void);
+
+/* lws-plat-esp32 provides these */
+
+typedef void (*lws_cb_scan_done)(uint16_t count, wifi_ap_record_t *recs, void *arg);
+
+enum genled_state {
+ LWSESP32_GENLED__INIT,
+ LWSESP32_GENLED__LOST_NETWORK,
+ LWSESP32_GENLED__NO_NETWORK,
+ LWSESP32_GENLED__CONN_AP,
+ LWSESP32_GENLED__GOT_IP,
+ LWSESP32_GENLED__OK,
+};
+
+struct lws_group_member {
+ struct lws_group_member *next;
+ uint64_t last_seen;
+ char model[16];
+ char role[16];
+ char host[32];
+ char mac[20];
+ int width, height;
+ struct ip4_addr addr;
+ struct ip6_addr addrv6;
+ uint8_t flags;
+};
+
+#define LWS_SYSTEM_GROUP_MEMBER_ADD 1
+#define LWS_SYSTEM_GROUP_MEMBER_CHANGE 2
+#define LWS_SYSTEM_GROUP_MEMBER_REMOVE 3
+
+#define LWS_GROUP_FLAG_SELF 1
+
+struct lws_esp32 {
+ char sta_ip[16];
+ char sta_mask[16];
+ char sta_gw[16];
+ char serial[16];
+ char opts[16];
+ char model[16];
+ char group[16];
+ char role[16];
+ char ssid[4][64];
+ char password[4][64];
+ char active_ssid[64];
+ char access_pw[16];
+ char hostname[32];
+ char mac[20];
+ char le_dns[64];
+ char le_email[64];
+ char region;
+ char inet;
+ char conn_ap;
+
+ enum genled_state genled;
+ uint64_t genled_t;
+
+ lws_cb_scan_done scan_consumer;
+ void *scan_consumer_arg;
+ struct lws_group_member *first;
+ int extant_group_members;
+
+ char acme;
+ char upload;
+
+ volatile char button_is_down;
+};
+
+struct lws_esp32_image {
+ uint32_t romfs;
+ uint32_t romfs_len;
+ uint32_t json;
+ uint32_t json_len;
+};
+
+extern struct lws_esp32 lws_esp32;
+struct lws_vhost;
+
+extern esp_err_t
+lws_esp32_event_passthru(void *ctx, system_event_t *event);
+extern void
+lws_esp32_wlan_config(void);
+extern void
+lws_esp32_wlan_start_ap(void);
+extern void
+lws_esp32_wlan_start_station(void);
+struct lws_context_creation_info;
+extern void
+lws_esp32_set_creation_defaults(struct lws_context_creation_info *info);
+extern struct lws_context *
+lws_esp32_init(struct lws_context_creation_info *, struct lws_vhost **pvh);
+extern int
+lws_esp32_wlan_nvs_get(int retry);
+extern esp_err_t
+lws_nvs_set_str(nvs_handle handle, const char* key, const char* value);
+extern void
+lws_esp32_restart_guided(uint32_t type);
+extern const esp_partition_t *
+lws_esp_ota_get_boot_partition(void);
+extern int
+lws_esp32_get_image_info(const esp_partition_t *part, struct lws_esp32_image *i, char *json, int json_len);
+extern int
+lws_esp32_leds_network_indication(void);
+
+extern uint32_t lws_esp32_get_reboot_type(void);
+extern uint16_t lws_esp32_sine_interp(int n);
+
+/* required in external code by esp32 plat (may just return if no leds) */
+extern void lws_esp32_leds_timer_cb(TimerHandle_t th);
+#else
+typedef int lws_sockfd_type;
+typedef int lws_filefd_type;
+#endif
+
+#define lws_pollfd pollfd
+#define LWS_POLLHUP (POLLHUP|POLLERR)
+#define LWS_POLLIN (POLLIN)
+#define LWS_POLLOUT (POLLOUT)
+#endif
+
+
+#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
+/* ... */
+#define ssize_t SSIZE_T
+#endif
+
+#if defined(WIN32) && defined(LWS_HAVE__STAT32I64)
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+#if defined(LWS_HAVE_STDINT_H)
+#include <stdint.h>
+#else
+#if defined(WIN32) || defined(_WIN32)
+/* !!! >:-[ */
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int8 uint8_t;
+#else
+typedef unsigned int uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+#endif
+#endif
+
+typedef unsigned long long lws_filepos_t;
+typedef long long lws_fileofs_t;
+typedef uint32_t lws_fop_flags_t;
+
+/** struct lws_pollargs - argument structure for all external poll related calls
+ * passed in via 'in' */
+struct lws_pollargs {
+ lws_sockfd_type fd; /**< applicable socket descriptor */
+ int events; /**< the new event mask */
+ int prev_events; /**< the previous event mask */
+};
+
+struct lws_tokens;
+struct lws_token_limits;
+
+/*! \defgroup wsclose Websocket Close
+ *
+ * ##Websocket close frame control
+ *
+ * When we close a ws connection, we can send a reason code and a short
+ * UTF-8 description back with the close packet.
+ */
+///@{
+
+/*
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+/** enum lws_close_status - RFC6455 close status codes */
+enum lws_close_status {
+ LWS_CLOSE_STATUS_NOSTATUS = 0,
+ LWS_CLOSE_STATUS_NORMAL = 1000,
+ /**< 1000 indicates a normal closure, meaning that the purpose for
+ which the connection was established has been fulfilled. */
+ LWS_CLOSE_STATUS_GOINGAWAY = 1001,
+ /**< 1001 indicates that an endpoint is "going away", such as a server
+ going down or a browser having navigated away from a page. */
+ LWS_CLOSE_STATUS_PROTOCOL_ERR = 1002,
+ /**< 1002 indicates that an endpoint is terminating the connection due
+ to a protocol error. */
+ LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE = 1003,
+ /**< 1003 indicates that an endpoint is terminating the connection
+ because it has received a type of data it cannot accept (e.g., an
+ endpoint that understands only text data MAY send this if it
+ receives a binary message). */
+ LWS_CLOSE_STATUS_RESERVED = 1004,
+ /**< Reserved. The specific meaning might be defined in the future. */
+ LWS_CLOSE_STATUS_NO_STATUS = 1005,
+ /**< 1005 is a reserved value and MUST NOT be set as a status code in a
+ Close control frame by an endpoint. It is designated for use in
+ applications expecting a status code to indicate that no status
+ code was actually present. */
+ LWS_CLOSE_STATUS_ABNORMAL_CLOSE = 1006,
+ /**< 1006 is a reserved value and MUST NOT be set as a status code in a
+ Close control frame by an endpoint. It is designated for use in
+ applications expecting a status code to indicate that the
+ connection was closed abnormally, e.g., without sending or
+ receiving a Close control frame. */
+ LWS_CLOSE_STATUS_INVALID_PAYLOAD = 1007,
+ /**< 1007 indicates that an endpoint is terminating the connection
+ because it has received data within a message that was not
+ consistent with the type of the message (e.g., non-UTF-8 [RFC3629]
+ data within a text message). */
+ LWS_CLOSE_STATUS_POLICY_VIOLATION = 1008,
+ /**< 1008 indicates that an endpoint is terminating the connection
+ because it has received a message that violates its policy. This
+ is a generic status code that can be returned when there is no
+ other more suitable status code (e.g., 1003 or 1009) or if there
+ is a need to hide specific details about the policy. */
+ LWS_CLOSE_STATUS_MESSAGE_TOO_LARGE = 1009,
+ /**< 1009 indicates that an endpoint is terminating the connection
+ because it has received a message that is too big for it to
+ process. */
+ LWS_CLOSE_STATUS_EXTENSION_REQUIRED = 1010,
+ /**< 1010 indicates that an endpoint (client) is terminating the
+ connection because it has expected the server to negotiate one or
+ more extension, but the server didn't return them in the response
+ message of the WebSocket handshake. The list of extensions that
+ are needed SHOULD appear in the /reason/ part of the Close frame.
+ Note that this status code is not used by the server, because it
+ can fail the WebSocket handshake instead */
+ LWS_CLOSE_STATUS_UNEXPECTED_CONDITION = 1011,
+ /**< 1011 indicates that a server is terminating the connection because
+ it encountered an unexpected condition that prevented it from
+ fulfilling the request. */
+ LWS_CLOSE_STATUS_TLS_FAILURE = 1015,
+ /**< 1015 is a reserved value and MUST NOT be set as a status code in a
+ Close control frame by an endpoint. It is designated for use in
+ applications expecting a status code to indicate that the
+ connection was closed due to a failure to perform a TLS handshake
+ (e.g., the server certificate can't be verified). */
+
+ LWS_CLOSE_STATUS_CLIENT_TRANSACTION_DONE = 2000,
+
+ /****** add new things just above ---^ ******/
+
+ LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
+};
+
+/**
+ * lws_close_reason - Set reason and aux data to send with Close packet
+ * If you are going to return nonzero from the callback
+ * requesting the connection to close, you can optionally
+ * call this to set the reason the peer will be told if
+ * possible.
+ *
+ * \param wsi: The websocket connection to set the close reason on
+ * \param status: A valid close status from websocket standard
+ * \param buf: NULL or buffer containing up to 124 bytes of auxiliary data
+ * \param len: Length of data in \param buf to send
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_close_reason(struct lws *wsi, enum lws_close_status status,
+ unsigned char *buf, size_t len);
+
+///@}
+
+struct lws;
+struct lws_context;
+/* needed even with extensions disabled for create context */
+struct lws_extension;
+
+
+/*! \defgroup usercb User Callback
+ *
+ * ##User protocol callback
+ *
+ * The protocol callback is the primary way lws interacts with
+ * user code. For one of a list of a few dozen reasons the callback gets
+ * called at some event to be handled.
+ *
+ * All of the events can be ignored, returning 0 is taken as "OK" and returning
+ * nonzero in most cases indicates that the connection should be closed.
+ */
+///@{
+
+struct lws_ssl_info {
+ int where;
+ int ret;
+};
+
+enum lws_cert_update_state {
+ LWS_CUS_IDLE,
+ LWS_CUS_STARTING,
+ LWS_CUS_SUCCESS,
+ LWS_CUS_FAILED,
+
+ LWS_CUS_CREATE_KEYS,
+ LWS_CUS_REG,
+ LWS_CUS_AUTH,
+ LWS_CUS_CHALLENGE,
+ LWS_CUS_CREATE_REQ,
+ LWS_CUS_REQ,
+ LWS_CUS_CONFIRM,
+ LWS_CUS_ISSUE,
+};
+
+enum {
+ LWS_TLS_REQ_ELEMENT_COUNTRY,
+ LWS_TLS_REQ_ELEMENT_STATE,
+ LWS_TLS_REQ_ELEMENT_LOCALITY,
+ LWS_TLS_REQ_ELEMENT_ORGANIZATION,
+ LWS_TLS_REQ_ELEMENT_COMMON_NAME,
+ LWS_TLS_REQ_ELEMENT_EMAIL,
+
+ LWS_TLS_REQ_ELEMENT_COUNT,
+
+ LWS_TLS_SET_DIR_URL = LWS_TLS_REQ_ELEMENT_COUNT,
+ LWS_TLS_SET_AUTH_PATH,
+ LWS_TLS_SET_CERT_PATH,
+ LWS_TLS_SET_KEY_PATH,
+
+ LWS_TLS_TOTAL_COUNT
+};
+
+struct lws_acme_cert_aging_args {
+ struct lws_vhost *vh;
+ const char *element_overrides[LWS_TLS_TOTAL_COUNT]; /* NULL = use pvo */
+};
+
+/*
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+/** enum lws_callback_reasons - reason you're getting a protocol callback */
+enum lws_callback_reasons {
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to wsi and protocol binding lifecycle -----
+ */
+
+ LWS_CALLBACK_PROTOCOL_INIT = 27,
+ /**< One-time call per protocol, per-vhost using it, so it can
+ * do initial setup / allocations etc */
+
+ LWS_CALLBACK_PROTOCOL_DESTROY = 28,
+ /**< One-time call per protocol, per-vhost using it, indicating
+ * this protocol won't get used at all after this callback, the
+ * vhost is getting destroyed. Take the opportunity to
+ * deallocate everything that was allocated by the protocol. */
+
+ LWS_CALLBACK_WSI_CREATE = 29,
+ /**< outermost (earliest) wsi create notification to protocols[0] */
+
+ LWS_CALLBACK_WSI_DESTROY = 30,
+ /**< outermost (latest) wsi destroy notification to protocols[0] */
+
+ LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
+ /**< By default, all HTTP handling is done in protocols[0].
+ * However you can bind different protocols (by name) to
+ * different parts of the URL space using callback mounts. This
+ * callback occurs in the new protocol when a wsi is bound
+ * to that protocol. Any protocol allocation related to the
+ * http transaction processing should be created then.
+ * These specific callbacks are necessary because with HTTP/1.1,
+ * a single connection may perform at series of different
+ * transactions at different URLs, thus the lifetime of the
+ * protocol bind is just for one transaction, not connection. */
+
+ LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
+ /**< This is called when a transaction is unbound from a protocol.
+ * It indicates the connection completed its transaction and may
+ * do something different now. Any protocol allocation related
+ * to the http transaction processing should be destroyed. */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Server TLS -----
+ */
+
+ LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS = 21,
+ /**< if configured for
+ * including OpenSSL support, this callback allows your user code
+ * to perform extra SSL_CTX_load_verify_locations() or similar
+ * calls to direct OpenSSL where to find certificates the client
+ * can use to confirm the remote server identity. user is the
+ * OpenSSL SSL_CTX* */
+
+ LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS = 22,
+ /**< if configured for
+ * including OpenSSL support, this callback allows your user code
+ * to load extra certificates into the server which allow it to
+ * verify the validity of certificates returned by clients. user
+ * is the server's OpenSSL SSL_CTX* and in is the lws_vhost */
+
+ LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION = 23,
+ /**< if the libwebsockets vhost was created with the option
+ * LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT, then this
+ * callback is generated during OpenSSL verification of the cert
+ * sent from the client. It is sent to protocol[0] callback as
+ * no protocol has been negotiated on the connection yet.
+ * Notice that the libwebsockets context and wsi are both NULL
+ * during this callback. See
+ * http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
+ * to understand more detail about the OpenSSL callback that
+ * generates this libwebsockets callback and the meanings of the
+ * arguments passed. In this callback, user is the x509_ctx,
+ * in is the ssl pointer and len is preverify_ok
+ * Notice that this callback maintains libwebsocket return
+ * conventions, return 0 to mean the cert is OK or 1 to fail it.
+ * This also means that if you don't handle this callback then
+ * the default callback action of returning 0 allows the client
+ * certificates. */
+
+ LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY = 37,
+ /**< if configured for including OpenSSL support but no private key
+ * file has been specified (ssl_private_key_filepath is NULL), this is
+ * called to allow the user to set the private key directly via
+ * libopenssl and perform further operations if required; this might be
+ * useful in situations where the private key is not directly accessible
+ * by the OS, for example if it is stored on a smartcard.
+ * user is the server's OpenSSL SSL_CTX* */
+
+ LWS_CALLBACK_SSL_INFO = 67,
+ /**< SSL connections only. An event you registered an
+ * interest in at the vhost has occurred on a connection
+ * using the vhost. in is a pointer to a
+ * struct lws_ssl_info containing information about the
+ * event*/
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Client TLS -----
+ */
+
+ LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION = 58,
+ /**< Similar to LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION
+ * this callback is called during OpenSSL verification of the cert
+ * sent from the server to the client. It is sent to protocol[0]
+ * callback as no protocol has been negotiated on the connection yet.
+ * Notice that the wsi is set because lws_client_connect_via_info was
+ * successful.
+ *
+ * See http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
+ * to understand more detail about the OpenSSL callback that
+ * generates this libwebsockets callback and the meanings of the
+ * arguments passed. In this callback, user is the x509_ctx,
+ * in is the ssl pointer and len is preverify_ok.
+ *
+ * THIS IS NOT RECOMMENDED BUT if a cert validation error shall be
+ * overruled and cert shall be accepted as ok,
+ * X509_STORE_CTX_set_error((X509_STORE_CTX*)user, X509_V_OK); must be
+ * called and return value must be 0 to mean the cert is OK;
+ * returning 1 will fail the cert in any case.
+ *
+ * This also means that if you don't handle this callback then
+ * the default callback action of returning 0 will not accept the
+ * certificate in case of a validation error decided by the SSL lib.
+ *
+ * This is expected and secure behaviour when validating certificates.
+ *
+ * Note: LCCSCF_ALLOW_SELFSIGNED and
+ * LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK still work without this
+ * callback being implemented.
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to HTTP Server -----
+ */
+
+ LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED = 19,
+ /**< A new client has been accepted by the ws server. This
+ * callback allows setting any relevant property to it. Because this
+ * happens immediately after the instantiation of a new client,
+ * there's no websocket protocol selected yet so this callback is
+ * issued only to protocol 0. Only wsi is defined, pointing to the
+ * new client, and the return value is ignored. */
+
+ LWS_CALLBACK_HTTP = 12,
+ /**< an http request has come from a client that is not
+ * asking to upgrade the connection to a websocket
+ * one. This is a chance to serve http content,
+ * for example, to send a script to the client
+ * which will then open the websockets connection.
+ * in points to the URI path requested and
+ * lws_serve_http_file() makes it very
+ * simple to send back a file to the client.
+ * Normally after sending the file you are done
+ * with the http connection, since the rest of the
+ * activity will come by websockets from the script
+ * that was delivered by http, so you will want to
+ * return 1; to close and free up the connection. */
+
+ LWS_CALLBACK_HTTP_BODY = 13,
+ /**< the next len bytes data from the http
+ * request body HTTP connection is now available in in. */
+
+ LWS_CALLBACK_HTTP_BODY_COMPLETION = 14,
+ /**< the expected amount of http request body has been delivered */
+
+ LWS_CALLBACK_HTTP_FILE_COMPLETION = 15,
+ /**< a file requested to be sent down http link has completed. */
+
+ LWS_CALLBACK_HTTP_WRITEABLE = 16,
+ /**< you can write more down the http protocol link now. */
+
+ LWS_CALLBACK_CLOSED_HTTP = 5,
+ /**< when a HTTP (non-websocket) session ends */
+
+ LWS_CALLBACK_FILTER_HTTP_CONNECTION = 18,
+ /**< called when the request has
+ * been received and parsed from the client, but the response is
+ * not sent yet. Return non-zero to disallow the connection.
+ * user is a pointer to the connection user space allocation,
+ * in is the URI, eg, "/"
+ * In your handler you can use the public APIs
+ * lws_hdr_total_length() / lws_hdr_copy() to access all of the
+ * headers using the header enums lws_token_indexes from
+ * libwebsockets.h to check for and read the supported header
+ * presence and content before deciding to allow the http
+ * connection to proceed or to kill the connection. */
+
+ LWS_CALLBACK_ADD_HEADERS = 53,
+ /**< This gives your user code a chance to add headers to a server
+ * transaction bound to your protocol. `in` points to a
+ * `struct lws_process_html_args` describing a buffer and length
+ * you can add headers into using the normal lws apis.
+ *
+ * (see LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to add headers to
+ * a client transaction)
+ *
+ * Only `args->p` and `args->len` are valid, and `args->p` should
+ * be moved on by the amount of bytes written, if any. Eg
+ *
+ * case LWS_CALLBACK_ADD_HEADERS:
+ *
+ * struct lws_process_html_args *args =
+ * (struct lws_process_html_args *)in;
+ *
+ * if (lws_add_http_header_by_name(wsi,
+ * (unsigned char *)"set-cookie:",
+ * (unsigned char *)cookie, cookie_len,
+ * (unsigned char **)&args->p,
+ * (unsigned char *)args->p + args->max_len))
+ * return 1;
+ *
+ * break;
+ */
+
+ LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
+ /**< This gives the user code a chance to forbid an http access.
+ * `in` points to a `struct lws_process_html_args`, which
+ * describes the URL, and a bit mask describing the type of
+ * authentication required. If the callback returns nonzero,
+ * the transaction ends with HTTP_STATUS_UNAUTHORIZED. */
+
+ LWS_CALLBACK_PROCESS_HTML = 52,
+ /**< This gives your user code a chance to mangle outgoing
+ * HTML. `in` points to a `struct lws_process_html_args`
+ * which describes the buffer containing outgoing HTML.
+ * The buffer may grow up to `.max_len` (currently +128
+ * bytes per buffer).
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to HTTP Client -----
+ */
+
+ LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
+ /**< The HTTP client connection has succeeded, and is now
+ * connected to the server */
+
+ LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
+ /**< The HTTP client connection is closing */
+
+ LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
+ /**< This is generated by lws_http_client_read() used to drain
+ * incoming data. In the case the incoming data was chunked, it will
+ * be split into multiple smaller callbacks for each chunk block,
+ * removing the chunk headers. If not chunked, it will appear all in
+ * one callback. */
+
+ LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
+ /**< This simply indicates data was received on the HTTP client
+ * connection. It does NOT drain or provide the data.
+ * This exists to neatly allow a proxying type situation,
+ * where this incoming data will go out on another connection.
+ * If the outgoing connection stalls, we should stall processing
+ * the incoming data. So a handler for this in that case should
+ * simply set a flag to indicate there is incoming data ready
+ * and ask for a writeable callback on the outgoing connection.
+ * In the writable callback he can check the flag and then get
+ * and drain the waiting incoming data using lws_http_client_read().
+ * This will use callbacks to LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ
+ * to get and drain the incoming data, where it should be sent
+ * back out on the outgoing connection. */
+ LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
+ /**< The client transaction completed... at the moment this
+ * is the same as closing since transaction pipelining on
+ * client side is not yet supported. */
+
+ LWS_CALLBACK_CLIENT_HTTP_WRITEABLE = 57,
+ /**< when doing an HTTP type client connection, you can call
+ * lws_client_http_body_pending(wsi, 1) from
+ * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to get these callbacks
+ * sending the HTTP headers.
+ *
+ * From this callback, when you have sent everything, you should let
+ * lws know by calling lws_client_http_body_pending(wsi, 0)
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Websocket Server -----
+ */
+
+ LWS_CALLBACK_ESTABLISHED = 0,
+ /**< (VH) after the server completes a handshake with an incoming
+ * client. If you built the library with ssl support, in is a
+ * pointer to the ssl struct associated with the connection or NULL.
+ *
+ * b0 of len is set if the connection was made using ws-over-h2
+ */
+
+ LWS_CALLBACK_CLOSED = 4,
+ /**< when the websocket session ends */
+
+ LWS_CALLBACK_SERVER_WRITEABLE = 11,
+ /**< See LWS_CALLBACK_CLIENT_WRITEABLE */
+
+ LWS_CALLBACK_RECEIVE = 6,
+ /**< data has appeared for this server endpoint from a
+ * remote client, it can be found at *in and is
+ * len bytes long */
+
+ LWS_CALLBACK_RECEIVE_PONG = 7,
+ /**< servers receive PONG packets with this callback reason */
+
+ LWS_CALLBACK_WS_PEER_INITIATED_CLOSE = 38,
+ /**< The peer has sent an unsolicited Close WS packet. in and
+ * len are the optional close code (first 2 bytes, network
+ * order) and the optional additional information which is not
+ * defined in the standard, and may be a string or non human-readable
+ * data.
+ * If you return 0 lws will echo the close and then close the
+ * connection. If you return nonzero lws will just close the
+ * connection. */
+
+ LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION = 20,
+ /**< called when the handshake has
+ * been received and parsed from the client, but the response is
+ * not sent yet. Return non-zero to disallow the connection.
+ * user is a pointer to the connection user space allocation,
+ * in is the requested protocol name
+ * In your handler you can use the public APIs
+ * lws_hdr_total_length() / lws_hdr_copy() to access all of the
+ * headers using the header enums lws_token_indexes from
+ * libwebsockets.h to check for and read the supported header
+ * presence and content before deciding to allow the handshake
+ * to proceed or to kill the connection. */
+
+ LWS_CALLBACK_CONFIRM_EXTENSION_OKAY = 25,
+ /**< When the server handshake code
+ * sees that it does support a requested extension, before
+ * accepting the extension by additing to the list sent back to
+ * the client it gives this callback just to check that it's okay
+ * to use that extension. It calls back to the requested protocol
+ * and with in being the extension name, len is 0 and user is
+ * valid. Note though at this time the ESTABLISHED callback hasn't
+ * happened yet so if you initialize user content there, user
+ * content during this callback might not be useful for anything. */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Websocket Client -----
+ */
+
+ LWS_CALLBACK_CLIENT_CONNECTION_ERROR = 1,
+ /**< the request client connection has been unable to complete a
+ * handshake with the remote server. If in is non-NULL, you can
+ * find an error string of length len where it points to
+ *
+ * Diagnostic strings that may be returned include
+ *
+ * "getaddrinfo (ipv6) failed"
+ * "unknown address family"
+ * "getaddrinfo (ipv4) failed"
+ * "set socket opts failed"
+ * "insert wsi failed"
+ * "lws_ssl_client_connect1 failed"
+ * "lws_ssl_client_connect2 failed"
+ * "Peer hung up"
+ * "read failed"
+ * "HS: URI missing"
+ * "HS: Redirect code but no Location"
+ * "HS: URI did not parse"
+ * "HS: Redirect failed"
+ * "HS: Server did not return 200"
+ * "HS: OOM"
+ * "HS: disallowed by client filter"
+ * "HS: disallowed at ESTABLISHED"
+ * "HS: ACCEPT missing"
+ * "HS: ws upgrade response not 101"
+ * "HS: UPGRADE missing"
+ * "HS: Upgrade to something other than websocket"
+ * "HS: CONNECTION missing"
+ * "HS: UPGRADE malformed"
+ * "HS: PROTOCOL malformed"
+ * "HS: Cannot match protocol"
+ * "HS: EXT: list too big"
+ * "HS: EXT: failed setting defaults"
+ * "HS: EXT: failed parsing defaults"
+ * "HS: EXT: failed parsing options"
+ * "HS: EXT: Rejects server options"
+ * "HS: EXT: unknown ext"
+ * "HS: Accept hash wrong"
+ * "HS: Rejected by filter cb"
+ * "HS: OOM"
+ * "HS: SO_SNDBUF failed"
+ * "HS: Rejected at CLIENT_ESTABLISHED"
+ */
+
+ LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH = 2,
+ /**< this is the last chance for the client user code to examine the
+ * http headers and decide to reject the connection. If the
+ * content in the headers is interesting to the
+ * client (url, etc) it needs to copy it out at
+ * this point since it will be destroyed before
+ * the CLIENT_ESTABLISHED call */
+
+ LWS_CALLBACK_CLIENT_ESTABLISHED = 3,
+ /**< after your client connection completed the websocket upgrade
+ * handshake with the remote server */
+
+ LWS_CALLBACK_CLIENT_CLOSED = 75,
+ /**< when a client websocket session ends */
+
+ LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER = 24,
+ /**< this callback happens
+ * when a client handshake is being compiled. user is NULL,
+ * in is a char **, it's pointing to a char * which holds the
+ * next location in the header buffer where you can add
+ * headers, and len is the remaining space in the header buffer,
+ * which is typically some hundreds of bytes. So, to add a canned
+ * cookie, your handler code might look similar to:
+ *
+ * char **p = (char **)in;
+ *
+ * if (len < 100)
+ * return 1;
+ *
+ * *p += sprintf(*p, "Cookie: a=b\x0d\x0a");
+ *
+ * return 0;
+ *
+ * Notice if you add anything, you just have to take care about
+ * the CRLF on the line you added. Obviously this callback is
+ * optional, if you don't handle it everything is fine.
+ *
+ * Notice the callback is coming to protocols[0] all the time,
+ * because there is no specific protocol negotiated yet.
+ *
+ * See LWS_CALLBACK_ADD_HEADERS for adding headers to server
+ * transactions.
+ */
+
+ LWS_CALLBACK_CLIENT_RECEIVE = 8,
+ /**< data has appeared from the server for the client connection, it
+ * can be found at *in and is len bytes long */
+
+ LWS_CALLBACK_CLIENT_RECEIVE_PONG = 9,
+ /**< clients receive PONG packets with this callback reason */
+
+ LWS_CALLBACK_CLIENT_WRITEABLE = 10,
+ /**< If you call lws_callback_on_writable() on a connection, you will
+ * get one of these callbacks coming when the connection socket
+ * is able to accept another write packet without blocking.
+ * If it already was able to take another packet without blocking,
+ * you'll get this callback at the next call to the service loop
+ * function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE
+ * and servers get LWS_CALLBACK_SERVER_WRITEABLE. */
+
+ LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED = 26,
+ /**< When a ws client
+ * connection is being prepared to start a handshake to a server,
+ * each supported extension is checked with protocols[0] callback
+ * with this reason, giving the user code a chance to suppress the
+ * claim to support that extension by returning non-zero. If
+ * unhandled, by default 0 will be returned and the extension
+ * support included in the header to the server. Notice this
+ * callback comes to protocols[0]. */
+
+ LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
+ /**< Gives client connections an opportunity to adjust negotiated
+ * extension defaults. `user` is the extension name that was
+ * negotiated (eg, "permessage-deflate"). `in` points to a
+ * buffer and `len` is the buffer size. The user callback can
+ * set the buffer to a string describing options the extension
+ * should parse. Or just ignore for defaults. */
+
+
+ LWS_CALLBACK_FILTER_NETWORK_CONNECTION = 17,
+ /**< called when a client connects to
+ * the server at network level; the connection is accepted but then
+ * passed to this callback to decide whether to hang up immediately
+ * or not, based on the client IP. in contains the connection
+ * socket's descriptor. Since the client connection information is
+ * not available yet, wsi still pointing to the main server socket.
+ * Return non-zero to terminate the connection before sending or
+ * receiving anything. Because this happens immediately after the
+ * network connection from the client, there's no websocket protocol
+ * selected yet so this callback is issued only to protocol 0. */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to external poll loop integration -----
+ */
+
+ LWS_CALLBACK_GET_THREAD_ID = 31,
+ /**< lws can accept callback when writable requests from other
+ * threads, if you implement this callback and return an opaque
+ * current thread ID integer. */
+
+ /* external poll() management support */
+ LWS_CALLBACK_ADD_POLL_FD = 32,
+ /**< lws normally deals with its poll() or other event loop
+ * internally, but in the case you are integrating with another
+ * server you will need to have lws sockets share a
+ * polling array with the other server. This and the other
+ * POLL_FD related callbacks let you put your specialized
+ * poll array interface code in the callback for protocol 0, the
+ * first protocol you support, usually the HTTP protocol in the
+ * serving case.
+ * This callback happens when a socket needs to be
+ * added to the polling loop: in points to a struct
+ * lws_pollargs; the fd member of the struct is the file
+ * descriptor, and events contains the active events
+ *
+ * If you are using the internal lws polling / event loop
+ * you can just ignore these callbacks. */
+
+ LWS_CALLBACK_DEL_POLL_FD = 33,
+ /**< This callback happens when a socket descriptor
+ * needs to be removed from an external polling array. in is
+ * again the struct lws_pollargs containing the fd member
+ * to be removed. If you are using the internal polling
+ * loop, you can just ignore it. */
+
+ LWS_CALLBACK_CHANGE_MODE_POLL_FD = 34,
+ /**< This callback happens when lws wants to modify the events for
+ * a connection.
+ * in is the struct lws_pollargs with the fd to change.
+ * The new event mask is in events member and the old mask is in
+ * the prev_events member.
+ * If you are using the internal polling loop, you can just ignore
+ * it. */
+
+ LWS_CALLBACK_LOCK_POLL = 35,
+ /**< These allow the external poll changes driven
+ * by lws to participate in an external thread locking
+ * scheme around the changes, so the whole thing is threadsafe.
+ * These are called around three activities in the library,
+ * - inserting a new wsi in the wsi / fd table (len=1)
+ * - deleting a wsi from the wsi / fd table (len=1)
+ * - changing a wsi's POLLIN/OUT state (len=0)
+ * Locking and unlocking external synchronization objects when
+ * len == 1 allows external threads to be synchronized against
+ * wsi lifecycle changes if it acquires the same lock for the
+ * duration of wsi dereference from the other thread context. */
+
+ LWS_CALLBACK_UNLOCK_POLL = 36,
+ /**< See LWS_CALLBACK_LOCK_POLL, ignore if using lws internal poll */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to CGI serving -----
+ */
+
+ LWS_CALLBACK_CGI = 40,
+ /**< CGI: CGI IO events on stdin / out / err are sent here on
+ * protocols[0]. The provided `lws_callback_http_dummy()`
+ * handles this and the callback should be directed there if
+ * you use CGI. */
+
+ LWS_CALLBACK_CGI_TERMINATED = 41,
+ /**< CGI: The related CGI process ended, this is called before
+ * the wsi is closed. Used to, eg, terminate chunking.
+ * The provided `lws_callback_http_dummy()`
+ * handles this and the callback should be directed there if
+ * you use CGI. The child PID that terminated is in len. */
+
+ LWS_CALLBACK_CGI_STDIN_DATA = 42,
+ /**< CGI: Data is, to be sent to the CGI process stdin, eg from
+ * a POST body. The provided `lws_callback_http_dummy()`
+ * handles this and the callback should be directed there if
+ * you use CGI. */
+
+ LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
+ /**< CGI: no more stdin is coming. The provided
+ * `lws_callback_http_dummy()` handles this and the callback
+ * should be directed there if you use CGI. */
+
+ LWS_CALLBACK_CGI_PROCESS_ATTACH = 70,
+ /**< CGI: Sent when the CGI process is spawned for the wsi. The
+ * len parameter is the PID of the child process */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Generic Sessions -----
+ */
+
+ LWS_CALLBACK_SESSION_INFO = 54,
+ /**< This is only generated by user code using generic sessions.
+ * It's used to get a `struct lws_session_info` filled in by
+ * generic sessions with information about the logged-in user.
+ * See the messageboard sample for an example of how to use. */
+
+ LWS_CALLBACK_GS_EVENT = 55,
+ /**< Indicates an event happened to the Generic Sessions session.
+ * `in` contains a `struct lws_gs_event_args` describing the event. */
+
+ LWS_CALLBACK_HTTP_PMO = 56,
+ /**< per-mount options for this connection, called before
+ * the normal LWS_CALLBACK_HTTP when the mount has per-mount
+ * options.
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to RAW sockets -----
+ */
+
+ LWS_CALLBACK_RAW_RX = 59,
+ /**< RAW mode connection RX */
+
+ LWS_CALLBACK_RAW_CLOSE = 60,
+ /**< RAW mode connection is closing */
+
+ LWS_CALLBACK_RAW_WRITEABLE = 61,
+ /**< RAW mode connection may be written */
+
+ LWS_CALLBACK_RAW_ADOPT = 62,
+ /**< RAW mode connection was adopted (equivalent to 'wsi created') */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to RAW file handles -----
+ */
+
+ LWS_CALLBACK_RAW_ADOPT_FILE = 63,
+ /**< RAW mode file was adopted (equivalent to 'wsi created') */
+
+ LWS_CALLBACK_RAW_RX_FILE = 64,
+ /**< This is the indication the RAW mode file has something to read.
+ * This doesn't actually do the read of the file and len is always
+ * 0... your code should do the read having been informed there is
+ * something to read now. */
+
+ LWS_CALLBACK_RAW_WRITEABLE_FILE = 65,
+ /**< RAW mode file is writeable */
+
+ LWS_CALLBACK_RAW_CLOSE_FILE = 66,
+ /**< RAW mode wsi that adopted a file is closing */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to generic wsi events -----
+ */
+
+ LWS_CALLBACK_TIMER = 73,
+ /**< When the time elapsed after a call to
+ * lws_set_timer_usecs(wsi, usecs) is up, the wsi will get one of
+ * these callbacks. The deadline can be continuously extended into the
+ * future by later calls to lws_set_timer_usecs() before the deadline
+ * expires, or cancelled by lws_set_timer_usecs(wsi, -1);
+ * See the note on lws_set_timer_usecs() about which event loops are
+ * supported. */
+
+ LWS_CALLBACK_EVENT_WAIT_CANCELLED = 71,
+ /**< This is sent to every protocol of every vhost in response
+ * to lws_cancel_service() or lws_cancel_service_pt(). This
+ * callback is serialized in the lws event loop normally, even
+ * if the lws_cancel_service[_pt]() call was from a different
+ * thread. */
+
+ LWS_CALLBACK_CHILD_CLOSING = 69,
+ /**< Sent to parent to notify them a child is closing / being
+ * destroyed. in is the child wsi.
+ */
+
+ LWS_CALLBACK_CHILD_WRITE_VIA_PARENT = 68,
+ /**< Child has been marked with parent_carries_io attribute, so
+ * lws_write directs the to this callback at the parent,
+ * in is a struct lws_write_passthru containing the args
+ * the lws_write() was called with.
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to TLS certificate management -----
+ */
+
+ LWS_CALLBACK_VHOST_CERT_AGING = 72,
+ /**< When a vhost TLS cert has its expiry checked, this callback
+ * is broadcast to every protocol of every vhost in case the
+ * protocol wants to take some action with this information.
+ * \p in is a pointer to a struct lws_acme_cert_aging_args,
+ * and \p len is the number of days left before it expires, as
+ * a (ssize_t). In the struct lws_acme_cert_aging_args, vh
+ * points to the vhost the cert aging information applies to,
+ * and element_overrides[] is an optional way to update information
+ * from the pvos... NULL in an index means use the information from
+ * from the pvo for the cert renewal, non-NULL in the array index
+ * means use that pointer instead for the index. */
+
+ LWS_CALLBACK_VHOST_CERT_UPDATE = 74,
+ /**< When a vhost TLS cert is being updated, progress is
+ * reported to the vhost in question here, including completion
+ * and failure. in points to optional JSON, and len represents the
+ * connection state using enum lws_cert_update_state */
+
+
+ /****** add new things just above ---^ ******/
+
+ LWS_CALLBACK_USER = 1000,
+ /**< user code can use any including above without fear of clashes */
+};
+
+
+
+/**
+ * typedef lws_callback_function() - User server actions
+ * \param wsi: Opaque websocket instance pointer
+ * \param reason: The reason for the call
+ * \param user: Pointer to per-session user data allocated by library
+ * \param in: Pointer used for some callback reasons
+ * \param len: Length set for some callback reasons
+ *
+ * This callback is the way the user controls what is served. All the
+ * protocol detail is hidden and handled by the library.
+ *
+ * For each connection / session there is user data allocated that is
+ * pointed to by "user". You set the size of this user data area when
+ * the library is initialized with lws_create_server.
+ */
+typedef int
+lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
+ void *user, void *in, size_t len);
+
+#define LWS_CB_REASON_AUX_BF__CGI 1
+#define LWS_CB_REASON_AUX_BF__PROXY 2
+#define LWS_CB_REASON_AUX_BF__CGI_CHUNK_END 4
+#define LWS_CB_REASON_AUX_BF__CGI_HEADERS 8
+///@}
+
+struct lws_vhost;
+
+/*! \defgroup generic hash
+ * ## Generic Hash related functions
+ *
+ * Lws provides generic hash / digest accessors that abstract the ones
+ * provided by whatever OpenSSL library you are linking against.
+ *
+ * It lets you use the same code if you build against mbedtls or OpenSSL
+ * for example.
+ */
+///@{
+
+#if defined(LWS_WITH_TLS)
+
+#if defined(LWS_WITH_MBEDTLS)
+#include <mbedtls/sha1.h>
+#include <mbedtls/sha256.h>
+#include <mbedtls/sha512.h>
+#endif
+
+enum lws_genhash_types {
+ LWS_GENHASH_TYPE_SHA1,
+ LWS_GENHASH_TYPE_SHA256,
+ LWS_GENHASH_TYPE_SHA384,
+ LWS_GENHASH_TYPE_SHA512,
+};
+
+enum lws_genhmac_types {
+ LWS_GENHMAC_TYPE_SHA256,
+ LWS_GENHMAC_TYPE_SHA384,
+ LWS_GENHMAC_TYPE_SHA512,
+};
+
+#define LWS_GENHASH_LARGEST 64
+
+struct lws_genhash_ctx {
+ uint8_t type;
+#if defined(LWS_WITH_MBEDTLS)
+ union {
+ mbedtls_sha1_context sha1;
+ mbedtls_sha256_context sha256;
+ mbedtls_sha512_context sha512; /* 384 also uses this */
+ const mbedtls_md_info_t *hmac;
+ } u;
+#else
+ const EVP_MD *evp_type;
+ EVP_MD_CTX *mdctx;
+#endif
+};
+
+struct lws_genhmac_ctx {
+ uint8_t type;
+#if defined(LWS_WITH_MBEDTLS)
+ const mbedtls_md_info_t *hmac;
+ mbedtls_md_context_t ctx;
+#else
+ const EVP_MD *evp_type;
+ EVP_MD_CTX *ctx;
+#endif
+};
+
+/** lws_genhash_size() - get hash size in bytes
+ *
+ * \param type: one of LWS_GENHASH_TYPE_...
+ *
+ * Returns number of bytes in this type of hash
+ */
+LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT
+lws_genhash_size(enum lws_genhash_types type);
+
+/** lws_genhmac_size() - get hash size in bytes
+ *
+ * \param type: one of LWS_GENHASH_TYPE_...
+ *
+ * Returns number of bytes in this type of hmac
+ */
+LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT
+lws_genhmac_size(enum lws_genhmac_types type);
+
+/** lws_genhash_init() - prepare your struct lws_genhash_ctx for use
+ *
+ * \param ctx: your struct lws_genhash_ctx
+ * \param type: one of LWS_GENHASH_TYPE_...
+ *
+ * Initializes the hash context for the type you requested
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_genhash_init(struct lws_genhash_ctx *ctx, enum lws_genhash_types type);
+
+/** lws_genhash_update() - digest len bytes of the buffer starting at in
+ *
+ * \param ctx: your struct lws_genhash_ctx
+ * \param in: start of the bytes to digest
+ * \param len: count of bytes to digest
+ *
+ * Updates the state of your hash context to reflect digesting len bytes from in
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_genhash_update(struct lws_genhash_ctx *ctx, const void *in, size_t len);
+
+/** lws_genhash_destroy() - copy out the result digest and destroy the ctx
+ *
+ * \param ctx: your struct lws_genhash_ctx
+ * \param result: NULL, or where to copy the result hash
+ *
+ * Finalizes the hash and copies out the digest. Destroys any allocations such
+ * that ctx can safely go out of scope after calling this.
+ *
+ * NULL result is supported so that you can destroy the ctx cleanly on error
+ * conditions, where there is no valid result.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genhash_destroy(struct lws_genhash_ctx *ctx, void *result);
+
+/** lws_genhmac_init() - prepare your struct lws_genhmac_ctx for use
+ *
+ * \param ctx: your struct lws_genhmac_ctx
+ * \param type: one of LWS_GENHMAC_TYPE_...
+ * \param key: pointer to the start of the HMAC key
+ * \param key_len: length of the HMAC key
+ *
+ * Initializes the hash context for the type you requested
+ *
+ * If the return is nonzero, it failed and there is nothing needing to be
+ * destroyed.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_genhmac_init(struct lws_genhmac_ctx *ctx, enum lws_genhmac_types type,
+ const uint8_t *key, size_t key_len);
+
+/** lws_genhmac_update() - digest len bytes of the buffer starting at in
+ *
+ * \param ctx: your struct lws_genhmac_ctx
+ * \param in: start of the bytes to digest
+ * \param len: count of bytes to digest
+ *
+ * Updates the state of your hash context to reflect digesting len bytes from in
+ *
+ * If the return is nonzero, it failed and needs destroying.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_genhmac_update(struct lws_genhmac_ctx *ctx, const void *in, size_t len);
+
+/** lws_genhmac_destroy() - copy out the result digest and destroy the ctx
+ *
+ * \param ctx: your struct lws_genhmac_ctx
+ * \param result: NULL, or where to copy the result hash
+ *
+ * Finalizes the hash and copies out the digest. Destroys any allocations such
+ * that ctx can safely go out of scope after calling this.
+ *
+ * NULL result is supported so that you can destroy the ctx cleanly on error
+ * conditions, where there is no valid result.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genhmac_destroy(struct lws_genhmac_ctx *ctx, void *result);
+///@}
+
+/*! \defgroup generic RSA
+ * ## Generic RSA related functions
+ *
+ * Lws provides generic RSA functions that abstract the ones
+ * provided by whatever OpenSSL library you are linking against.
+ *
+ * It lets you use the same code if you build against mbedtls or OpenSSL
+ * for example.
+ */
+///@{
+
+enum enum_jwk_tok {
+ JWK_KEY_E,
+ JWK_KEY_N,
+ JWK_KEY_D,
+ JWK_KEY_P,
+ JWK_KEY_Q,
+ JWK_KEY_DP,
+ JWK_KEY_DQ,
+ JWK_KEY_QI,
+ JWK_KTY, /* also serves as count of real elements */
+ JWK_KEY,
+};
+
+#define LWS_COUNT_RSA_ELEMENTS JWK_KTY
+
+struct lws_genrsa_ctx {
+#if defined(LWS_WITH_MBEDTLS)
+ mbedtls_rsa_context *ctx;
+#else
+ BIGNUM *bn[LWS_COUNT_RSA_ELEMENTS];
+ RSA *rsa;
+#endif
+};
+
+struct lws_genrsa_element {
+ uint8_t *buf;
+ uint16_t len;
+};
+
+struct lws_genrsa_elements {
+ struct lws_genrsa_element e[LWS_COUNT_RSA_ELEMENTS];
+};
+
+/** lws_jwk_destroy_genrsa_elements() - Free allocations in genrsa_elements
+ *
+ * \param el: your struct lws_genrsa_elements
+ *
+ * This is a helper for user code making use of struct lws_genrsa_elements
+ * where the elements are allocated on the heap, it frees any non-NULL
+ * buf element and sets the buf to NULL.
+ *
+ * NB: lws_genrsa_public_... apis do not need this as they take care of the key
+ * creation and destruction themselves.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_jwk_destroy_genrsa_elements(struct lws_genrsa_elements *el);
+
+/** lws_genrsa_public_decrypt_create() - Create RSA public decrypt context
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param el: struct prepared with key element data
+ *
+ * Creates an RSA context with a public key associated with it, formed from
+ * the key elements in \p el.
+ *
+ * Returns 0 for OK or nonzero for error.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_create(struct lws_genrsa_ctx *ctx, struct lws_genrsa_elements *el);
+
+/** lws_genrsa_new_keypair() - Create new RSA keypair
+ *
+ * \param context: your struct lws_context (may be used for RNG)
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param el: struct to get the new key element data allocated into it
+ * \param bits: key size, eg, 4096
+ *
+ * Creates a new RSA context and generates a new keypair into it, with \p bits
+ * bits.
+ *
+ * Returns 0 for OK or nonzero for error.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_new_keypair(struct lws_context *context, struct lws_genrsa_ctx *ctx,
+ struct lws_genrsa_elements *el, int bits);
+
+/** lws_genrsa_public_decrypt() - Perform RSA public decryption
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param in: encrypted input
+ * \param in_len: length of encrypted input
+ * \param out: decrypted output
+ * \param out_max: size of output buffer
+ *
+ * Performs the decryption.
+ *
+ * Returns <0 for error, or length of decrypted data.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_public_decrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ size_t in_len, uint8_t *out, size_t out_max);
+
+/** lws_genrsa_public_verify() - Perform RSA public verification
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param in: unencrypted payload (usually a recomputed hash)
+ * \param hash_type: one of LWS_GENHASH_TYPE_
+ * \param sig: pointer to the signature we received with the payload
+ * \param sig_len: length of the signature we are checking in bytes
+ *
+ * Returns <0 for error, or 0 if signature matches the payload + key.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_public_verify(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ enum lws_genhash_types hash_type,
+ const uint8_t *sig, size_t sig_len);
+
+/** lws_genrsa_public_sign() - Create RSA signature
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param in: precomputed hash
+ * \param hash_type: one of LWS_GENHASH_TYPE_
+ * \param sig: pointer to buffer to take signature
+ * \param sig_len: length of the buffer (must be >= length of key N)
+ *
+ * Returns <0 for error, or 0 for success.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_public_sign(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ enum lws_genhash_types hash_type, uint8_t *sig,
+ size_t sig_len);
+
+/** lws_genrsa_public_decrypt_destroy() - Destroy RSA public decrypt context
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ *
+ * Destroys any allocations related to \p ctx.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_genrsa_destroy(struct lws_genrsa_ctx *ctx);
+
+/** lws_genrsa_render_pkey_asn1() - Exports public or private key to ASN1/DER
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param _private: 0 = public part only, 1 = all parts of the key
+ * \param pkey_asn1: pointer to buffer to take the ASN1
+ * \param pkey_asn1_len: max size of the pkey_asn1_len
+ *
+ * Returns length of pkey_asn1 written, or -1 for error.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_render_pkey_asn1(struct lws_genrsa_ctx *ctx, int _private,
+ uint8_t *pkey_asn1, size_t pkey_asn1_len);
+///@}
+
+/*! \defgroup jwk JSON Web Keys
+ * ## JSON Web Keys API
+ *
+ * Lws provides an API to parse JSON Web Keys into a struct lws_genrsa_elements.
+ *
+ * "oct" and "RSA" type keys are supported. For "oct" keys, they are held in
+ * the "e" member of the struct lws_genrsa_elements.
+ *
+ * Keys elements are allocated on the heap. You must destroy the allocations
+ * in the struct lws_genrsa_elements by calling
+ * lws_jwk_destroy_genrsa_elements() when you are finished with it.
+ */
+///@{
+
+struct lws_jwk {
+ char keytype[5]; /**< "oct" or "RSA" */
+ struct lws_genrsa_elements el; /**< OCTet key is in el.e */
+};
+
+/** lws_jwk_import() - Create a JSON Web key from the textual representation
+ *
+ * \param s: the JWK object to create
+ * \param in: a single JWK JSON stanza in utf-8
+ * \param len: the length of the JWK JSON stanza in bytes
+ *
+ * Creates an lws_jwk struct filled with data from the JSON representation.
+ * "oct" and "rsa" key types are supported.
+ *
+ * For "oct" type keys, it is loaded into el.e.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jwk_import(struct lws_jwk *s, const char *in, size_t len);
+
+/** lws_jwk_destroy() - Destroy a JSON Web key
+ *
+ * \param s: the JWK object to destroy
+ *
+ * All allocations in the lws_jwk are destroyed
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_jwk_destroy(struct lws_jwk *s);
+
+/** lws_jwk_export() - Export a JSON Web key to a textual representation
+ *
+ * \param s: the JWK object to export
+ * \param _private: 0 = just export public parts, 1 = export everything
+ * \param p: the buffer to write the exported JWK to
+ * \param len: the length of the buffer \p p in bytes
+ *
+ * Returns length of the used part of the buffer if OK, or -1 for error.
+ *
+ * Serializes the content of the JWK into a char buffer.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jwk_export(struct lws_jwk *s, int _private, char *p, size_t len);
+
+/** lws_jwk_load() - Import a JSON Web key from a file
+ *
+ * \param s: the JWK object to load into
+ * \param filename: filename to load from
+ *
+ * Returns 0 for OK or -1 for failure
+ */
+LWS_VISIBLE int
+lws_jwk_load(struct lws_jwk *s, const char *filename);
+
+/** lws_jwk_save() - Export a JSON Web key to a file
+ *
+ * \param s: the JWK object to save from
+ * \param filename: filename to save to
+ *
+ * Returns 0 for OK or -1 for failure
+ */
+LWS_VISIBLE int
+lws_jwk_save(struct lws_jwk *s, const char *filename);
+
+/** lws_jwk_rfc7638_fingerprint() - jwk to RFC7638 compliant fingerprint
+ *
+ * \param s: the JWK object to fingerprint
+ * \param digest32: buffer to take 32-byte digest
+ *
+ * Returns 0 for OK or -1 for failure
+ */
+LWS_VISIBLE int
+lws_jwk_rfc7638_fingerprint(struct lws_jwk *s, char *digest32);
+///@}
+
+
+/*! \defgroup jws JSON Web Signature
+ * ## JSON Web Signature API
+ *
+ * Lws provides an API to check and create RFC7515 JSON Web Signatures
+ *
+ * SHA256/384/512 HMAC, and RSA 256/384/512 are supported.
+ *
+ * The API uses your TLS library crypto, but works exactly the same no matter
+ * what you TLS backend is.
+ */
+///@{
+
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_confirm_sig(const char *in, size_t len, struct lws_jwk *jwk);
+
+/**
+ * lws_jws_sign_from_b64() - add b64 sig to b64 hdr + payload
+ *
+ * \param b64_hdr: protected header encoded in b64, may be NULL
+ * \param hdr_len: bytes in b64 coding of protected header
+ * \param b64_pay: payload encoded in b64
+ * \param pay_len: bytes in b64 coding of payload
+ * \param b64_sig: buffer to write the b64 encoded signature into
+ * \param sig_len: max bytes we can write at b64_sig
+ * \param hash_type: one of LWS_GENHASH_TYPE_SHA[256|384|512]
+ * \param jwk: the struct lws_jwk containing the signing key
+ *
+ * This adds a b64-coded JWS signature of the b64-encoded protected header
+ * and b64-encoded payload, at \p b64_sig. The signature will be as large
+ * as the N element of the RSA key when the RSA key is used, eg, 512 bytes for
+ * a 4096-bit key, and then b64-encoding on top.
+ *
+ * In some special cases, there is only payload to sign and no header, in that
+ * case \p b64_hdr may be NULL, and only the payload will be hashed before
+ * signing.
+ *
+ * Returns the length of the encoded signature written to \p b64_sig, or -1.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_sign_from_b64(const char *b64_hdr, size_t hdr_len, const char *b64_pay,
+ size_t pay_len, char *b64_sig, size_t sig_len,
+ enum lws_genhash_types hash_type, struct lws_jwk *jwk);
+
+/**
+ * lws_jws_create_packet() - add b64 sig to b64 hdr + payload
+ *
+ * \param jwk: the struct lws_jwk containing the signing key
+ * \param payload: unencoded payload JSON
+ * \param len: length of unencoded payload JSON
+ * \param nonce: Nonse string to include in protected header
+ * \param out: buffer to take signed packet
+ * \param out_len: size of \p out buffer
+ *
+ * This creates a "flattened" JWS packet from the jwk and the plaintext
+ * payload, and signs it. The packet is written into \p out.
+ *
+ * This does the whole packet assembly and signing, calling through to
+ * lws_jws_sign_from_b64() as part of the process.
+ *
+ * Returns the length written to \p out, or -1.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_create_packet(struct lws_jwk *jwk, const char *payload, size_t len,
+ const char *nonce, char *out, size_t out_len);
+
+/**
+ * lws_jws_base64_enc() - encode input data into b64url data
+ *
+ * \param in: the incoming plaintext
+ * \param in_len: the length of the incoming plaintext in bytes
+ * \param out: the buffer to store the b64url encoded data to
+ * \param out_max: the length of \p out in bytes
+ *
+ * Returns either -1 if problems, or the number of bytes written to \p out.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_base64_enc(const char *in, size_t in_len, char *out, size_t out_max);
+///@}
+#endif
+
+/*! \defgroup extensions Extension related functions
+ * ##Extension releated functions
+ *
+ * Ws defines optional extensions, lws provides the ability to implement these
+ * in user code if so desired.
+ *
+ * We provide one extensions permessage-deflate.
+ */
+///@{
+
+/*
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+enum lws_extension_callback_reasons {
+ LWS_EXT_CB_CONSTRUCT = 4,
+ LWS_EXT_CB_CLIENT_CONSTRUCT = 5,
+ LWS_EXT_CB_DESTROY = 8,
+ LWS_EXT_CB_PACKET_TX_PRESEND = 12,
+ LWS_EXT_CB_PAYLOAD_TX = 21,
+ LWS_EXT_CB_PAYLOAD_RX = 22,
+ LWS_EXT_CB_OPTION_DEFAULT = 23,
+ LWS_EXT_CB_OPTION_SET = 24,
+ LWS_EXT_CB_OPTION_CONFIRM = 25,
+ LWS_EXT_CB_NAMED_OPTION_SET = 26,
+
+ /****** add new things just above ---^ ******/
+};
+
+/** enum lws_ext_options_types */
+enum lws_ext_options_types {
+ EXTARG_NONE, /**< does not take an argument */
+ EXTARG_DEC, /**< requires a decimal argument */
+ EXTARG_OPT_DEC /**< may have an optional decimal argument */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility */
+};
+
+/** struct lws_ext_options - Option arguments to the extension. These are
+ * used in the negotiation at ws upgrade time.
+ * The helper function lws_ext_parse_options()
+ * uses these to generate callbacks */
+struct lws_ext_options {
+ const char *name; /**< Option name, eg, "server_no_context_takeover" */
+ enum lws_ext_options_types type; /**< What kind of args the option can take */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility */
+};
+
+/** struct lws_ext_option_arg */
+struct lws_ext_option_arg {
+ const char *option_name; /**< may be NULL, option_index used then */
+ int option_index; /**< argument ordinal to use if option_name missing */
+ const char *start; /**< value */
+ int len; /**< length of value */
+};
+
+/**
+ * typedef lws_extension_callback_function() - Hooks to allow extensions to operate
+ * \param context: Websockets context
+ * \param ext: This extension
+ * \param wsi: Opaque websocket instance pointer
+ * \param reason: The reason for the call
+ * \param user: Pointer to ptr to per-session user data allocated by library
+ * \param in: Pointer used for some callback reasons
+ * \param len: Length set for some callback reasons
+ *
+ * Each extension that is active on a particular connection receives
+ * callbacks during the connection lifetime to allow the extension to
+ * operate on websocket data and manage itself.
+ *
+ * Libwebsockets takes care of allocating and freeing "user" memory for
+ * each active extension on each connection. That is what is pointed to
+ * by the user parameter.
+ *
+ * LWS_EXT_CB_CONSTRUCT: called when the server has decided to
+ * select this extension from the list provided by the client,
+ * just before the server will send back the handshake accepting
+ * the connection with this extension active. This gives the
+ * extension a chance to initialize its connection context found
+ * in user.
+ *
+ * LWS_EXT_CB_CLIENT_CONSTRUCT: same as LWS_EXT_CB_CONSTRUCT
+ * but called when client is instantiating this extension. Some
+ * extensions will work the same on client and server side and then
+ * you can just merge handlers for both CONSTRUCTS.
+ *
+ * LWS_EXT_CB_DESTROY: called when the connection the extension was
+ * being used on is about to be closed and deallocated. It's the
+ * last chance for the extension to deallocate anything it has
+ * allocated in the user data (pointed to by user) before the
+ * user data is deleted. This same callback is used whether you
+ * are in client or server instantiation context.
+ *
+ * LWS_EXT_CB_PACKET_TX_PRESEND: this works the same way as
+ * LWS_EXT_CB_PACKET_RX_PREPARSE above, except it gives the
+ * extension a chance to change websocket data just before it will
+ * be sent out. Using the same lws_token pointer scheme in in,
+ * the extension can change the buffer and the length to be
+ * transmitted how it likes. Again if it wants to grow the
+ * buffer safely, it should copy the data into its own buffer and
+ * set the lws_tokens token pointer to it.
+ *
+ * LWS_EXT_CB_ARGS_VALIDATE:
+ */
+typedef int
+lws_extension_callback_function(struct lws_context *context,
+ const struct lws_extension *ext, struct lws *wsi,
+ enum lws_extension_callback_reasons reason,
+ void *user, void *in, size_t len);
+
+/** struct lws_extension - An extension we support */
+struct lws_extension {
+ const char *name; /**< Formal extension name, eg, "permessage-deflate" */
+ lws_extension_callback_function *callback; /**< Service callback */
+ const char *client_offer; /**< String containing exts and options client offers */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility */
+};
+
+/**
+ * lws_set_extension_option(): set extension option if possible
+ *
+ * \param wsi: websocket connection
+ * \param ext_name: name of ext, like "permessage-deflate"
+ * \param opt_name: name of option, like "rx_buf_size"
+ * \param opt_val: value to set option to
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_set_extension_option(struct lws *wsi, const char *ext_name,
+ const char *opt_name, const char *opt_val);
+
+/**
+ * lws_ext_parse_options() - deal with parsing negotiated extension options
+ *
+ * \param ext: related extension struct
+ * \param wsi: websocket connection
+ * \param ext_user: per-connection extension private data
+ * \param opts: list of supported options
+ * \param o: option string to parse
+ * \param len: length
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
+ void *ext_user, const struct lws_ext_options *opts,
+ const char *o, int len);
+
+/** lws_extension_callback_pm_deflate() - extension for RFC7692
+ *
+ * \param context: lws context
+ * \param ext: related lws_extension struct
+ * \param wsi: websocket connection
+ * \param reason: incoming callback reason
+ * \param user: per-connection extension private data
+ * \param in: pointer parameter
+ * \param len: length parameter
+ *
+ * Built-in callback implementing RFC7692 permessage-deflate
+ */
+LWS_EXTERN
+int lws_extension_callback_pm_deflate(
+ struct lws_context *context, const struct lws_extension *ext,
+ struct lws *wsi, enum lws_extension_callback_reasons reason,
+ void *user, void *in, size_t len);
+
+/*
+ * The internal exts are part of the public abi
+ * If we add more extensions, publish the callback here ------v
+ */
+///@}
+
+/*! \defgroup Protocols-and-Plugins Protocols and Plugins
+ * \ingroup lwsapi
+ *
+ * ##Protocol and protocol plugin -related apis
+ *
+ * Protocols bind ws protocol names to a custom callback specific to that
+ * protocol implementaion.
+ *
+ * A list of protocols can be passed in at context creation time, but it is
+ * also legal to leave that NULL and add the protocols and their callback code
+ * using plugins.
+ *
+ * Plugins are much preferable compared to cut and pasting code into an
+ * application each time, since they can be used standalone.
+ */
+///@{
+/** struct lws_protocols - List of protocols and handlers client or server
+ * supports. */
+
+struct lws_protocols {
+ const char *name;
+ /**< Protocol name that must match the one given in the client
+ * Javascript new WebSocket(url, 'protocol') name. */
+ lws_callback_function *callback;
+ /**< The service callback used for this protocol. It allows the
+ * service action for an entire protocol to be encapsulated in
+ * the protocol-specific callback */
+ size_t per_session_data_size;
+ /**< Each new connection using this protocol gets
+ * this much memory allocated on connection establishment and
+ * freed on connection takedown. A pointer to this per-connection
+ * allocation is passed into the callback in the 'user' parameter */
+ size_t rx_buffer_size;
+ /**< lws allocates this much space for rx data and informs callback
+ * when something came. Due to rx flow control, the callback may not
+ * be able to consume it all without having to return to the event
+ * loop. That is supported in lws.
+ *
+ * If .tx_packet_size is 0, this also controls how much may be sent at
+ * once for backwards compatibility.
+ */
+ unsigned int id;
+ /**< ignored by lws, but useful to contain user information bound
+ * to the selected protocol. For example if this protocol was
+ * called "myprotocol-v2", you might set id to 2, and the user
+ * code that acts differently according to the version can do so by
+ * switch (wsi->protocol->id), user code might use some bits as
+ * capability flags based on selected protocol version, etc. */
+ void *user; /**< ignored by lws, but user code can pass a pointer
+ here it can later access from the protocol callback */
+ size_t tx_packet_size;
+ /**< 0 indicates restrict send() size to .rx_buffer_size for backwards-
+ * compatibility.
+ * If greater than zero, a single send() is restricted to this amount
+ * and any remainder is buffered by lws and sent afterwards also in
+ * these size chunks. Since that is expensive, it's preferable
+ * to restrict one fragment you are trying to send to match this
+ * size.
+ */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility */
+};
+
+/**
+ * lws_vhost_name_to_protocol() - get vhost's protocol object from its name
+ *
+ * \param vh: vhost to search
+ * \param name: protocol name
+ *
+ * Returns NULL or a pointer to the vhost's protocol of the requested name
+ */
+LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
+lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name);
+
+/**
+ * lws_get_protocol() - Returns a protocol pointer from a websocket
+ * connection.
+ * \param wsi: pointer to struct websocket you want to know the protocol of
+ *
+ *
+ * Some apis can act on all live connections of a given protocol,
+ * this is how you can get a pointer to the active protocol if needed.
+ */
+LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
+lws_get_protocol(struct lws *wsi);
+
+/** lws_protocol_get() - deprecated: use lws_get_protocol */
+LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
+lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED;
+
+/**
+ * lws_protocol_vh_priv_zalloc() - Allocate and zero down a protocol's per-vhost
+ * storage
+ * \param vhost: vhost the instance is related to
+ * \param prot: protocol the instance is related to
+ * \param size: bytes to allocate
+ *
+ * Protocols often find it useful to allocate a per-vhost struct, this is a
+ * helper to be called in the per-vhost init LWS_CALLBACK_PROTOCOL_INIT
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, const struct lws_protocols *prot,
+ int size);
+
+/**
+ * lws_protocol_vh_priv_get() - retreive a protocol's per-vhost storage
+ *
+ * \param vhost: vhost the instance is related to
+ * \param prot: protocol the instance is related to
+ *
+ * Recover a pointer to the allocated per-vhost storage for the protocol created
+ * by lws_protocol_vh_priv_zalloc() earlier
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *prot);
+
+/**
+ * lws_adjust_protocol_psds - change a vhost protocol's per session data size
+ *
+ * \param wsi: a connection with the protocol to change
+ * \param new_size: the new size of the per session data size for the protocol
+ *
+ * Returns user_space for the wsi, after allocating
+ *
+ * This should not be used except to initalize a vhost protocol's per session
+ * data size one time, before any connections are accepted.
+ *
+ * Sometimes the protocol wraps another protocol and needs to discover and set
+ * its per session data size at runtime.
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_adjust_protocol_psds(struct lws *wsi, size_t new_size);
+
+/**
+ * lws_finalize_startup() - drop initial process privileges
+ *
+ * \param context: lws context
+ *
+ * This is called after the end of the vhost protocol initializations, but
+ * you may choose to call it earlier
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_finalize_startup(struct lws_context *context);
+
+/**
+ * lws_pvo_search() - helper to find a named pvo in a linked-list
+ *
+ * \param pvo: the first pvo in the linked-list
+ * \param name: the name of the pvo to return if found
+ *
+ * Returns NULL, or a pointer to the name pvo in the linked-list
+ */
+LWS_VISIBLE LWS_EXTERN const struct lws_protocol_vhost_options *
+lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_protocol_init(struct lws_context *context);
+
+#ifdef LWS_WITH_PLUGINS
+
+/* PLUGINS implies LIBUV */
+
+#define LWS_PLUGIN_API_MAGIC 180
+
+/** struct lws_plugin_capability - how a plugin introduces itself to lws */
+struct lws_plugin_capability {
+ unsigned int api_magic; /**< caller fills this in, plugin fills rest */
+ const struct lws_protocols *protocols; /**< array of supported protocols provided by plugin */
+ int count_protocols; /**< how many protocols */
+ const struct lws_extension *extensions; /**< array of extensions provided by plugin */
+ int count_extensions; /**< how many extensions */
+};
+
+typedef int (*lws_plugin_init_func)(struct lws_context *,
+ struct lws_plugin_capability *);
+typedef int (*lws_plugin_destroy_func)(struct lws_context *);
+
+/** struct lws_plugin */
+struct lws_plugin {
+ struct lws_plugin *list; /**< linked list */
+#if (UV_VERSION_MAJOR > 0)
+ uv_lib_t lib; /**< shared library pointer */
+#else
+ void *l; /**< so we can compile on ancient libuv */
+#endif
+ char name[64]; /**< name of the plugin */
+ struct lws_plugin_capability caps; /**< plugin capabilities */
+};
+
+#endif
+
+///@}
+
+
+/*! \defgroup generic-sessions plugin: generic-sessions
+ * \ingroup Protocols-and-Plugins
+ *
+ * ##Plugin Generic-sessions related
+ *
+ * generic-sessions plugin provides a reusable, generic session and login /
+ * register / forgot password framework including email verification.
+ */
+///@{
+
+#define LWSGS_EMAIL_CONTENT_SIZE 16384
+/**< Maximum size of email we might send */
+
+/* SHA-1 binary and hexified versions */
+/** typedef struct lwsgw_hash_bin */
+typedef struct { unsigned char bin[20]; /**< binary representation of hash */} lwsgw_hash_bin;
+/** typedef struct lwsgw_hash */
+typedef struct { char id[41]; /**< ascii hex representation of hash */ } lwsgw_hash;
+
+/** enum lwsgs_auth_bits */
+enum lwsgs_auth_bits {
+ LWSGS_AUTH_LOGGED_IN = 1, /**< user is logged in as somebody */
+ LWSGS_AUTH_ADMIN = 2, /**< logged in as the admin user */
+ LWSGS_AUTH_VERIFIED = 4, /**< user has verified his email */
+ LWSGS_AUTH_FORGOT_FLOW = 8, /**< he just completed "forgot password" flow */
+};
+
+/** struct lws_session_info - information about user session status */
+struct lws_session_info {
+ char username[32]; /**< username logged in as, or empty string */
+ char email[100]; /**< email address associated with login, or empty string */
+ char ip[72]; /**< ip address session was started from */
+ unsigned int mask; /**< access rights mask associated with session
+ * see enum lwsgs_auth_bits */
+ char session[42]; /**< session id string, usable as opaque uid when not logged in */
+};
+
+/** enum lws_gs_event */
+enum lws_gs_event {
+ LWSGSE_CREATED, /**< a new user was created */
+ LWSGSE_DELETED /**< an existing user was deleted */
+};
+
+/** struct lws_gs_event_args */
+struct lws_gs_event_args {
+ enum lws_gs_event event; /**< which event happened */
+ const char *username; /**< which username the event happened to */
+ const char *email; /**< the email address of that user */
+};
+
+///@}
+
+
+/*! \defgroup context-and-vhost context and vhost related functions
+ * ##Context and Vhost releated functions
+ * \ingroup lwsapi
+ *
+ *
+ * LWS requires that there is one context, in which you may define multiple
+ * vhosts. Each vhost is a virtual host, with either its own listen port
+ * or sharing an existing one. Each vhost has its own SSL context that can
+ * be set up individually or left disabled.
+ *
+ * If you don't care about multiple "site" support, you can ignore it and
+ * lws will create a single default vhost at context creation time.
+ */
+///@{
+
+/*
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+
+/** enum lws_context_options - context and vhost options */
+enum lws_context_options {
+ LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT = (1 << 1) |
+ (1 << 12),
+ /**< (VH) Don't allow the connection unless the client has a
+ * client cert that we recognize; provides
+ * LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT */
+ LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME = (1 << 2),
+ /**< (CTX) Don't try to get the server's hostname */
+ LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT = (1 << 3) |
+ (1 << 12),
+ /**< (VH) Allow non-SSL (plaintext) connections on the same
+ * port as SSL is listening... undermines the security of SSL;
+ * provides LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT */
+ LWS_SERVER_OPTION_LIBEV = (1 << 4),
+ /**< (CTX) Use libev event loop */
+ LWS_SERVER_OPTION_DISABLE_IPV6 = (1 << 5),
+ /**< (VH) Disable IPV6 support */
+ LWS_SERVER_OPTION_DISABLE_OS_CA_CERTS = (1 << 6),
+ /**< (VH) Don't load OS CA certs, you will need to load your
+ * own CA cert(s) */
+ LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED = (1 << 7),
+ /**< (VH) Accept connections with no valid Cert (eg, selfsigned) */
+ LWS_SERVER_OPTION_VALIDATE_UTF8 = (1 << 8),
+ /**< (VH) Check UT-8 correctness */
+ LWS_SERVER_OPTION_SSL_ECDH = (1 << 9) |
+ (1 << 12),
+ /**< (VH) initialize ECDH ciphers */
+ LWS_SERVER_OPTION_LIBUV = (1 << 10),
+ /**< (CTX) Use libuv event loop */
+ LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS = (1 << 11) |
+ (1 << 12),
+ /**< (VH) Use http redirect to force http to https
+ * (deprecated: use mount redirection) */
+ LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT = (1 << 12),
+ /**< (CTX) Initialize the SSL library at all */
+ LWS_SERVER_OPTION_EXPLICIT_VHOSTS = (1 << 13),
+ /**< (CTX) Only create the context when calling context
+ * create api, implies user code will create its own vhosts */
+ LWS_SERVER_OPTION_UNIX_SOCK = (1 << 14),
+ /**< (VH) Use Unix socket */
+ LWS_SERVER_OPTION_STS = (1 << 15),
+ /**< (VH) Send Strict Transport Security header, making
+ * clients subsequently go to https even if user asked for http */
+ LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY = (1 << 16),
+ /**< (VH) Enable LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE to take effect */
+ LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE = (1 << 17),
+ /**< (VH) if set, only ipv6 allowed on the vhost */
+ LWS_SERVER_OPTION_UV_NO_SIGSEGV_SIGFPE_SPIN = (1 << 18),
+ /**< (CTX) Libuv only: Do not spin on SIGSEGV / SIGFPE. A segfault
+ * normally makes the lib spin so you can attach a debugger to it
+ * even if it happened without a debugger in place. You can disable
+ * that by giving this option.
+ */
+ LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN = (1 << 19),
+ /**< For backwards-compatibility reasons, by default
+ * lws prepends "http://" to the origin you give in the client
+ * connection info struct. If you give this flag when you create
+ * the context, only the string you give in the client connect
+ * info for .origin (if any) will be used directly.
+ */
+ LWS_SERVER_OPTION_FALLBACK_TO_RAW = (1 << 20),
+ /**< (VH) if invalid http is coming in the first line, */
+ LWS_SERVER_OPTION_LIBEVENT = (1 << 21),
+ /**< (CTX) Use libevent event loop */
+ LWS_SERVER_OPTION_ONLY_RAW = (1 << 22),
+ /**< (VH) All connections to this vhost / port are RAW as soon as
+ * the connection is accepted, no HTTP is going to be coming.
+ */
+ LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE = (1 << 23),
+ /**< (VH) Set to allow multiple listen sockets on one interface +
+ * address + port. The default is to strictly allow only one
+ * listen socket at a time. This is automatically selected if you
+ * have multiple service threads.
+ */
+ LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX = (1 << 24),
+ /**< (VH) Force setting up the vhost SSL_CTX, even though the user
+ * code doesn't explicitly provide a cert in the info struct. It
+ * implies the user code is going to provide a cert at the
+ * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS callback, which
+ * provides the vhost SSL_CTX * in the user parameter.
+ */
+ LWS_SERVER_OPTION_SKIP_PROTOCOL_INIT = (1 << 25),
+ /**< (VH) You probably don't want this. It forces this vhost to not
+ * call LWS_CALLBACK_PROTOCOL_INIT on its protocols. It's used in the
+ * special case of a temporary vhost bound to a single protocol.
+ */
+ LWS_SERVER_OPTION_IGNORE_MISSING_CERT = (1 << 26),
+ /**< (VH) Don't fail if the vhost TLS cert or key are missing, just
+ * continue. The vhost won't be able to serve anything, but if for
+ * example the ACME plugin was configured to fetch a cert, this lets
+ * you bootstrap your vhost from having no cert to start with.
+ */
+
+ /****** add new things just above ---^ ******/
+};
+
+#define lws_check_opt(c, f) (((c) & (f)) == (f))
+
+struct lws_plat_file_ops;
+
+/** struct lws_context_creation_info - parameters to create context and /or vhost with
+ *
+ * This is also used to create vhosts.... if LWS_SERVER_OPTION_EXPLICIT_VHOSTS
+ * is not given, then for backwards compatibility one vhost is created at
+ * context-creation time using the info from this struct.
+ *
+ * If LWS_SERVER_OPTION_EXPLICIT_VHOSTS is given, then no vhosts are created
+ * at the same time as the context, they are expected to be created afterwards.
+ */
+struct lws_context_creation_info {
+ int port;
+ /**< VHOST: Port to listen on. Use CONTEXT_PORT_NO_LISTEN to suppress
+ * listening for a client. Use CONTEXT_PORT_NO_LISTEN_SERVER if you are
+ * writing a server but you are using \ref sock-adopt instead of the
+ * built-in listener.
+ *
+ * You can also set port to 0, in which case the kernel will pick
+ * a random port that is not already in use. You can find out what
+ * port the vhost is listening on using lws_get_vhost_listen_port() */
+ const char *iface;
+ /**< VHOST: NULL to bind the listen socket to all interfaces, or the
+ * interface name, eg, "eth2"
+ * If options specifies LWS_SERVER_OPTION_UNIX_SOCK, this member is
+ * the pathname of a UNIX domain socket. you can use the UNIX domain
+ * sockets in abstract namespace, by prepending an at symbol to the
+ * socket name. */
+ const struct lws_protocols *protocols;
+ /**< VHOST: Array of structures listing supported protocols and a protocol-
+ * specific callback for each one. The list is ended with an
+ * entry that has a NULL callback pointer. */
+ const struct lws_extension *extensions;
+ /**< VHOST: NULL or array of lws_extension structs listing the
+ * extensions this context supports. */
+ const struct lws_token_limits *token_limits;
+ /**< CONTEXT: NULL or struct lws_token_limits pointer which is initialized
+ * with a token length limit for each possible WSI_TOKEN_ */
+ const char *ssl_private_key_password;
+ /**< VHOST: NULL or the passphrase needed for the private key. (For
+ * backwards compatibility, this can also be used to pass the client
+ * cert passphrase when setting up a vhost client SSL context, but it is
+ * preferred to use .client_ssl_private_key_password for that.) */
+ const char *ssl_cert_filepath;
+ /**< VHOST: If libwebsockets was compiled to use ssl, and you want
+ * to listen using SSL, set to the filepath to fetch the
+ * server cert from, otherwise NULL for unencrypted. (For backwards
+ * compatibility, this can also be used to pass the client certificate
+ * when setting up a vhost client SSL context, but it is preferred to
+ * use .client_ssl_cert_filepath for that.) */
+ const char *ssl_private_key_filepath;
+ /**< VHOST: filepath to private key if wanting SSL mode;
+ * if this is set to NULL but ssl_cert_filepath is set, the
+ * OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY callback is called
+ * to allow setting of the private key directly via openSSL
+ * library calls. (For backwards compatibility, this can also be used
+ * to pass the client cert private key filepath when setting up a
+ * vhost client SSL context, but it is preferred to use
+ * .client_ssl_private_key_filepath for that.) */
+ const char *ssl_ca_filepath;
+ /**< VHOST: CA certificate filepath or NULL. (For backwards
+ * compatibility, this can also be used to pass the client CA
+ * filepath when setting up a vhost client SSL context,
+ * but it is preferred to use .client_ssl_ca_filepath for that.) */
+ const char *ssl_cipher_list;
+ /**< VHOST: List of valid ciphers to use (eg,
+ * "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL"
+ * or you can leave it as NULL to get "DEFAULT" (For backwards
+ * compatibility, this can also be used to pass the client cipher
+ * list when setting up a vhost client SSL context,
+ * but it is preferred to use .client_ssl_cipher_list for that.)*/
+ const char *http_proxy_address;
+ /**< VHOST: If non-NULL, attempts to proxy via the given address.
+ * If proxy auth is required, use format "username:password\@server:port" */
+ unsigned int http_proxy_port;
+ /**< VHOST: If http_proxy_address was non-NULL, uses this port */
+ int gid;
+ /**< CONTEXT: group id to change to after setting listen socket, or -1. */
+ int uid;
+ /**< CONTEXT: user id to change to after setting listen socket, or -1. */
+ unsigned int options;
+ /**< VHOST + CONTEXT: 0, or LWS_SERVER_OPTION_... bitfields */
+ void *user;
+ /**< VHOST + CONTEXT: optional user pointer that will be associated
+ * with the context when creating the context (and can be retrieved by
+ * lws_context_user(context), or with the vhost when creating the vhost
+ * (and can be retrieved by lws_vhost_user(vhost)). You will need to
+ * use LWS_SERVER_OPTION_EXPLICIT_VHOSTS and create the vhost separately
+ * if you care about giving the context and vhost different user pointer
+ * values.
+ */
+ int ka_time;
+ /**< CONTEXT: 0 for no TCP keepalive, otherwise apply this keepalive
+ * timeout to all libwebsocket sockets, client or server */
+ int ka_probes;
+ /**< CONTEXT: if ka_time was nonzero, after the timeout expires how many
+ * times to try to get a response from the peer before giving up
+ * and killing the connection */
+ int ka_interval;
+ /**< CONTEXT: if ka_time was nonzero, how long to wait before each ka_probes
+ * attempt */
+#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
+ SSL_CTX *provided_client_ssl_ctx;
+ /**< CONTEXT: If non-null, swap out libwebsockets ssl
+ * implementation for the one provided by provided_ssl_ctx.
+ * Libwebsockets no longer is responsible for freeing the context
+ * if this option is selected. */
+#else /* maintain structure layout either way */
+ void *provided_client_ssl_ctx; /**< dummy if ssl disabled */
+#endif
+
+ short max_http_header_data;
+ /**< CONTEXT: The max amount of header payload that can be handled
+ * in an http request (unrecognized header payload is dropped) */
+ short max_http_header_pool;
+ /**< CONTEXT: The max number of connections with http headers that
+ * can be processed simultaneously (the corresponding memory is
+ * allocated and deallocated dynamically as needed). If the pool is
+ * fully busy new incoming connections must wait for accept until one
+ * becomes free. 0 = allow as many ah as number of availble fds for
+ * the process */
+
+ unsigned int count_threads;
+ /**< CONTEXT: how many contexts to create in an array, 0 = 1 */
+ unsigned int fd_limit_per_thread;
+ /**< CONTEXT: nonzero means restrict each service thread to this
+ * many fds, 0 means the default which is divide the process fd
+ * limit by the number of threads. */
+ unsigned int timeout_secs;
+ /**< VHOST: various processes involving network roundtrips in the
+ * library are protected from hanging forever by timeouts. If
+ * nonzero, this member lets you set the timeout used in seconds.
+ * Otherwise a default timeout is used. */
+ const char *ecdh_curve;
+ /**< VHOST: if NULL, defaults to initializing server with "prime256v1" */
+ const char *vhost_name;
+ /**< VHOST: name of vhost, must match external DNS name used to
+ * access the site, like "warmcat.com" as it's used to match
+ * Host: header and / or SNI name for SSL. */
+ const char * const *plugin_dirs;
+ /**< CONTEXT: NULL, or NULL-terminated array of directories to
+ * scan for lws protocol plugins at context creation time */
+ const struct lws_protocol_vhost_options *pvo;
+ /**< VHOST: pointer to optional linked list of per-vhost
+ * options made accessible to protocols */
+ int keepalive_timeout;
+ /**< VHOST: (default = 0 = 5s) seconds to allow remote
+ * client to hold on to an idle HTTP/1.1 connection */
+ const char *log_filepath;
+ /**< VHOST: filepath to append logs to... this is opened before
+ * any dropping of initial privileges */
+ const struct lws_http_mount *mounts;
+ /**< VHOST: optional linked list of mounts for this vhost */
+ const char *server_string;
+ /**< CONTEXT: string used in HTTP headers to identify server
+ * software, if NULL, "libwebsockets". */
+ unsigned int pt_serv_buf_size;
+ /**< CONTEXT: 0 = default of 4096. This buffer is used by
+ * various service related features including file serving, it
+ * defines the max chunk of file that can be sent at once.
+ * At the risk of lws having to buffer failed large sends, it
+ * can be increased to, eg, 128KiB to improve throughput. */
+ unsigned int max_http_header_data2;
+ /**< CONTEXT: if max_http_header_data is 0 and this
+ * is nonzero, this will be used in place of the default. It's
+ * like this for compatibility with the original short version,
+ * this is unsigned int length. */
+ long ssl_options_set;
+ /**< VHOST: Any bits set here will be set as SSL options */
+ long ssl_options_clear;
+ /**< VHOST: Any bits set here will be cleared as SSL options */
+ unsigned short ws_ping_pong_interval;
+ /**< CONTEXT: 0 for none, else interval in seconds between sending
+ * PINGs on idle websocket connections. When the PING is sent,
+ * the PONG must come within the normal timeout_secs timeout period
+ * or the connection will be dropped.
+ * Any RX or TX traffic on the connection restarts the interval timer,
+ * so a connection which always sends or receives something at intervals
+ * less than the interval given here will never send PINGs / expect
+ * PONGs. Conversely as soon as the ws connection is established, an
+ * idle connection will do the PING / PONG roundtrip as soon as
+ * ws_ping_pong_interval seconds has passed without traffic
+ */
+ const struct lws_protocol_vhost_options *headers;
+ /**< VHOST: pointer to optional linked list of per-vhost
+ * canned headers that are added to server responses */
+
+ const struct lws_protocol_vhost_options *reject_service_keywords;
+ /**< CONTEXT: Optional list of keywords and rejection codes + text.
+ *
+ * The keywords are checked for existing in the user agent string.
+ *
+ * Eg, "badrobot" "404 Not Found"
+ */
+ void *external_baggage_free_on_destroy;
+ /**< CONTEXT: NULL, or pointer to something externally malloc'd, that
+ * should be freed when the context is destroyed. This allows you to
+ * automatically sync the freeing action to the context destruction
+ * action, so there is no need for an external free() if the context
+ * succeeded to create.
+ */
+
+ const char *client_ssl_private_key_password;
+ /**< VHOST: Client SSL context init: NULL or the passphrase needed
+ * for the private key */
+ const char *client_ssl_cert_filepath;
+ /**< VHOST: Client SSL context init:T he certificate the client
+ * should present to the peer on connection */
+ const char *client_ssl_private_key_filepath;
+ /**< VHOST: Client SSL context init: filepath to client private key
+ * if this is set to NULL but client_ssl_cert_filepath is set, you
+ * can handle the LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS
+ * callback of protocols[0] to allow setting of the private key directly
+ * via openSSL library calls */
+ const char *client_ssl_ca_filepath;
+ /**< VHOST: Client SSL context init: CA certificate filepath or NULL */
+ const char *client_ssl_cipher_list;
+ /**< VHOST: Client SSL context init: List of valid ciphers to use (eg,
+ * "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL"
+ * or you can leave it as NULL to get "DEFAULT" */
+
+ const struct lws_plat_file_ops *fops;
+ /**< CONTEXT: NULL, or pointer to an array of fops structs, terminated
+ * by a sentinel with NULL .open.
+ *
+ * If NULL, lws provides just the platform file operations struct for
+ * backwards compatibility.
+ */
+ int simultaneous_ssl_restriction;
+ /**< CONTEXT: 0 (no limit) or limit of simultaneous SSL sessions possible.*/
+ const char *socks_proxy_address;
+ /**< VHOST: If non-NULL, attempts to proxy via the given address.
+ * If proxy auth is required, use format "username:password\@server:port" */
+ unsigned int socks_proxy_port;
+ /**< VHOST: If socks_proxy_address was non-NULL, uses this port */
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+ cap_value_t caps[4];
+ /**< CONTEXT: array holding Linux capabilities you want to
+ * continue to be available to the server after it transitions
+ * to a noprivileged user. Usually none are needed but for, eg,
+ * .bind_iface, CAP_NET_RAW is required. This gives you a way
+ * to still have the capability but drop root.
+ */
+ char count_caps;
+ /**< CONTEXT: count of Linux capabilities in .caps[]. 0 means
+ * no capabilities will be inherited from root (the default) */
+#endif
+ int bind_iface;
+ /**< VHOST: nonzero to strictly bind sockets to the interface name in
+ * .iface (eg, "eth2"), using SO_BIND_TO_DEVICE.
+ *
+ * Requires SO_BINDTODEVICE support from your OS and CAP_NET_RAW
+ * capability.
+ *
+ * Notice that common things like access network interface IP from
+ * your local machine use your lo / loopback interface and will be
+ * disallowed by this.
+ */
+ int ssl_info_event_mask;
+ /**< VHOST: mask of ssl events to be reported on LWS_CALLBACK_SSL_INFO
+ * callback for connections on this vhost. The mask values are of
+ * the form SSL_CB_ALERT, defined in openssl/ssl.h. The default of
+ * 0 means no info events will be reported.
+ */
+ unsigned int timeout_secs_ah_idle;
+ /**< VHOST: seconds to allow a client to hold an ah without using it.
+ * 0 defaults to 10s. */
+ unsigned short ip_limit_ah;
+ /**< CONTEXT: max number of ah a single IP may use simultaneously
+ * 0 is no limit. This is a soft limit: if the limit is
+ * reached, connections from that IP will wait in the ah
+ * waiting list and not be able to acquire an ah until
+ * a connection belonging to the IP relinquishes one it
+ * already has.
+ */
+ unsigned short ip_limit_wsi;
+ /**< CONTEXT: max number of wsi a single IP may use simultaneously.
+ * 0 is no limit. This is a hard limit, connections from
+ * the same IP will simply be dropped once it acquires the
+ * amount of simultaneous wsi / accepted connections
+ * given here.
+ */
+ uint32_t http2_settings[7];
+ /**< VHOST: if http2_settings[0] is nonzero, the values given in
+ * http2_settings[1]..[6] are used instead of the lws
+ * platform default values.
+ * Just leave all at 0 if you don't care.
+ */
+ const char *error_document_404;
+ /**< VHOST: If non-NULL, when asked to serve a non-existent file,
+ * lws attempts to server this url path instead. Eg,
+ * "/404.html" */
+ const char *alpn;
+ /**< CONTEXT: If non-NULL, default list of advertised alpn, comma-
+ * separated
+ *
+ * VHOST: If non-NULL, per-vhost list of advertised alpn, comma-
+ * separated
+ */
+ void **foreign_loops;
+ /**< CONTEXT: This is ignored if the context is not being started with
+ * an event loop, ie, .options has a flag like
+ * LWS_SERVER_OPTION_LIBUV.
+ *
+ * NULL indicates lws should start its own even loop for
+ * each service thread, and deal with closing the loops
+ * when the context is destroyed.
+ *
+ * Non-NULL means it points to an array of external
+ * ("foreign") event loops that are to be used in turn for
+ * each service thread. In the default case of 1 service
+ * thread, it can just point to one foreign event loop.
+ */
+ void (*signal_cb)(void *event_lib_handle, int signum);
+ /**< CONTEXT: NULL: default signal handling. Otherwise this receives
+ * the signal handler callback. event_lib_handle is the
+ * native event library signal handle, eg uv_signal_t *
+ * for libuv.
+ */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility
+ *
+ * The below is to ensure later library versions with new
+ * members added above will see 0 (default) even if the app
+ * was not built against the newer headers.
+ */
+ struct lws_context **pcontext;
+ /**< CONTEXT: if non-NULL, at the end of context destroy processing,
+ * the pointer pointed to by pcontext is written with NULL. You can
+ * use this to let foreign event loops know that lws context destruction
+ * is fully completed.
+ */
+
+ void *_unused[4]; /**< dummy */
+};
+
+/**
+ * lws_create_context() - Create the websocket handler
+ * \param info: pointer to struct with parameters
+ *
+ * This function creates the listening socket (if serving) and takes care
+ * of all initialization in one step.
+ *
+ * If option LWS_SERVER_OPTION_EXPLICIT_VHOSTS is given, no vhost is
+ * created; you're expected to create your own vhosts afterwards using
+ * lws_create_vhost(). Otherwise a vhost named "default" is also created
+ * using the information in the vhost-related members, for compatibility.
+ *
+ * After initialization, it returns a struct lws_context * that
+ * represents this server. After calling, user code needs to take care
+ * of calling lws_service() with the context pointer to get the
+ * server's sockets serviced. This must be done in the same process
+ * context as the initialization call.
+ *
+ * The protocol callback functions are called for a handful of events
+ * including http requests coming in, websocket connections becoming
+ * established, and data arriving; it's also called periodically to allow
+ * async transmission.
+ *
+ * HTTP requests are sent always to the FIRST protocol in protocol, since
+ * at that time websocket protocol has not been negotiated. Other
+ * protocols after the first one never see any HTTP callback activity.
+ *
+ * The server created is a simple http server by default; part of the
+ * websocket standard is upgrading this http connection to a websocket one.
+ *
+ * This allows the same server to provide files like scripts and favicon /
+ * images or whatever over http and dynamic data over websockets all in
+ * one place; they're all handled in the user callback.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_context *
+lws_create_context(const struct lws_context_creation_info *info);
+
+
+/**
+ * lws_context_destroy() - Destroy the websocket context
+ * \param context: Websocket context
+ *
+ * This function closes any active connections and then frees the
+ * context. After calling this, any further use of the context is
+ * undefined.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_context_destroy(struct lws_context *context);
+
+typedef int (*lws_reload_func)(void);
+
+/**
+ * lws_context_deprecate() - Deprecate the websocket context
+ *
+ * \param context: Websocket context
+ * \param cb: Callback notified when old context listen sockets are closed
+ *
+ * This function is used on an existing context before superceding it
+ * with a new context.
+ *
+ * It closes any listen sockets in the context, so new connections are
+ * not possible.
+ *
+ * And it marks the context to be deleted when the number of active
+ * connections into it falls to zero.
+ *
+ * Otherwise if you attach the deprecated context to the replacement
+ * context when it has been created using lws_context_attach_deprecated()
+ * both any deprecated and the new context will service their connections.
+ *
+ * This is aimed at allowing seamless configuration reloads.
+ *
+ * The callback cb will be called after the listen sockets are actually
+ * closed and may be reopened. In the callback the new context should be
+ * configured and created. (With libuv, socket close happens async after
+ * more loop events).
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_context_deprecate(struct lws_context *context, lws_reload_func cb);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_context_is_deprecated(struct lws_context *context);
+
+/**
+ * lws_set_proxy() - Setups proxy to lws_context.
+ * \param vhost: pointer to struct lws_vhost you want set proxy for
+ * \param proxy: pointer to c string containing proxy in format address:port
+ *
+ * Returns 0 if proxy string was parsed and proxy was setup.
+ * Returns -1 if proxy is NULL or has incorrect format.
+ *
+ * This is only required if your OS does not provide the http_proxy
+ * environment variable (eg, OSX)
+ *
+ * IMPORTANT! You should call this function right after creation of the
+ * lws_context and before call to connect. If you call this
+ * function after connect behavior is undefined.
+ * This function will override proxy settings made on lws_context
+ * creation with genenv() call.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_set_proxy(struct lws_vhost *vhost, const char *proxy);
+
+/**
+ * lws_set_socks() - Setup socks to lws_context.
+ * \param vhost: pointer to struct lws_vhost you want set socks for
+ * \param socks: pointer to c string containing socks in format address:port
+ *
+ * Returns 0 if socks string was parsed and socks was setup.
+ * Returns -1 if socks is NULL or has incorrect format.
+ *
+ * This is only required if your OS does not provide the socks_proxy
+ * environment variable (eg, OSX)
+ *
+ * IMPORTANT! You should call this function right after creation of the
+ * lws_context and before call to connect. If you call this
+ * function after connect behavior is undefined.
+ * This function will override proxy settings made on lws_context
+ * creation with genenv() call.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_set_socks(struct lws_vhost *vhost, const char *socks);
+
+struct lws_vhost;
+
+/**
+ * lws_create_vhost() - Create a vhost (virtual server context)
+ * \param context: pointer to result of lws_create_context()
+ * \param info: pointer to struct with parameters
+ *
+ * This function creates a virtual server (vhost) using the vhost-related
+ * members of the info struct. You can create many vhosts inside one context
+ * if you created the context with the option LWS_SERVER_OPTION_EXPLICIT_VHOSTS
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_vhost *
+lws_create_vhost(struct lws_context *context,
+ const struct lws_context_creation_info *info);
+
+/**
+ * lws_vhost_destroy() - Destroy a vhost (virtual server context)
+ *
+ * \param vh: pointer to result of lws_create_vhost()
+ *
+ * This function destroys a vhost. Normally, if you just want to exit,
+ * then lws_destroy_context() will take care of everything. If you want
+ * to destroy an individual vhost and all connections and allocations, you
+ * can do it with this.
+ *
+ * If the vhost has a listen sockets shared by other vhosts, it will be given
+ * to one of the vhosts sharing it rather than closed.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_vhost_destroy(struct lws_vhost *vh);
+
+/**
+ * lwsws_get_config_globals() - Parse a JSON server config file
+ * \param info: pointer to struct with parameters
+ * \param d: filepath of the config file
+ * \param config_strings: storage for the config strings extracted from JSON,
+ * the pointer is incremented as strings are stored
+ * \param len: pointer to the remaining length left in config_strings
+ * the value is decremented as strings are stored
+ *
+ * This function prepares a n lws_context_creation_info struct with global
+ * settings from a file d.
+ *
+ * Requires CMake option LWS_WITH_LEJP_CONF to have been enabled
+ */
+LWS_VISIBLE LWS_EXTERN int
+lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d,
+ char **config_strings, int *len);
+
+/**
+ * lwsws_get_config_vhosts() - Create vhosts from a JSON server config file
+ * \param context: pointer to result of lws_create_context()
+ * \param info: pointer to struct with parameters
+ * \param d: filepath of the config file
+ * \param config_strings: storage for the config strings extracted from JSON,
+ * the pointer is incremented as strings are stored
+ * \param len: pointer to the remaining length left in config_strings
+ * the value is decremented as strings are stored
+ *
+ * This function creates vhosts into a context according to the settings in
+ *JSON files found in directory d.
+ *
+ * Requires CMake option LWS_WITH_LEJP_CONF to have been enabled
+ */
+LWS_VISIBLE LWS_EXTERN int
+lwsws_get_config_vhosts(struct lws_context *context,
+ struct lws_context_creation_info *info, const char *d,
+ char **config_strings, int *len);
+
+/** lws_vhost_get() - \deprecated deprecated: use lws_get_vhost() */
+LWS_VISIBLE LWS_EXTERN struct lws_vhost *
+lws_vhost_get(struct lws *wsi) LWS_WARN_DEPRECATED;
+
+/**
+ * lws_get_vhost() - return the vhost a wsi belongs to
+ *
+ * \param wsi: which connection
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_vhost *
+lws_get_vhost(struct lws *wsi);
+
+/**
+ * lws_get_vhost_name() - returns the name of a vhost
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_vhost_name(struct lws_vhost *vhost);
+
+/**
+ * lws_get_vhost_port() - returns the port a vhost listens on, or -1
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_get_vhost_port(struct lws_vhost *vhost);
+
+/**
+ * lws_get_vhost_user() - returns the user pointer for the vhost
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_get_vhost_user(struct lws_vhost *vhost);
+
+/**
+ * lws_get_vhost_iface() - returns the binding for the vhost listen socket
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_vhost_iface(struct lws_vhost *vhost);
+
+/**
+ * lws_json_dump_vhost() - describe vhost state and stats in JSON
+ *
+ * \param vh: the vhost
+ * \param buf: buffer to fill with JSON
+ * \param len: max length of buf
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len);
+
+/**
+ * lws_json_dump_context() - describe context state and stats in JSON
+ *
+ * \param context: the context
+ * \param buf: buffer to fill with JSON
+ * \param len: max length of buf
+ * \param hide_vhosts: nonzero to not provide per-vhost mount etc information
+ *
+ * Generates a JSON description of vhost state into buf
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_json_dump_context(const struct lws_context *context, char *buf, int len,
+ int hide_vhosts);
+
+/**
+ * lws_vhost_user() - get the user data associated with the vhost
+ * \param vhost: Websocket vhost
+ *
+ * This returns the optional user pointer that can be attached to
+ * a vhost when it was created. Lws never dereferences this pointer, it only
+ * sets it when the vhost is created, and returns it using this api.
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_vhost_user(struct lws_vhost *vhost);
+
+/**
+ * lws_context_user() - get the user data associated with the context
+ * \param context: Websocket context
+ *
+ * This returns the optional user allocation that can be attached to
+ * the context the sockets live in at context_create time. It's a way
+ * to let all sockets serviced in the same context share data without
+ * using globals statics in the user code.
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_context_user(struct lws_context *context);
+
+/*! \defgroup vhost-mounts Vhost mounts and options
+ * \ingroup context-and-vhost-creation
+ *
+ * ##Vhost mounts and options
+ */
+///@{
+/** struct lws_protocol_vhost_options - linked list of per-vhost protocol
+ * name=value options
+ *
+ * This provides a general way to attach a linked-list of name=value pairs,
+ * which can also have an optional child link-list using the options member.
+ */
+struct lws_protocol_vhost_options {
+ const struct lws_protocol_vhost_options *next; /**< linked list */
+ const struct lws_protocol_vhost_options *options; /**< child linked-list of more options for this node */
+ const char *name; /**< name of name=value pair */
+ const char *value; /**< value of name=value pair */
+};
+
+/** enum lws_mount_protocols
+ * This specifies the mount protocol for a mountpoint, whether it is to be
+ * served from a filesystem, or it is a cgi etc.
+ */
+enum lws_mount_protocols {
+ LWSMPRO_HTTP = 0, /**< http reverse proxy */
+ LWSMPRO_HTTPS = 1, /**< https reverse proxy */
+ LWSMPRO_FILE = 2, /**< serve from filesystem directory */
+ LWSMPRO_CGI = 3, /**< pass to CGI to handle */
+ LWSMPRO_REDIR_HTTP = 4, /**< redirect to http:// url */
+ LWSMPRO_REDIR_HTTPS = 5, /**< redirect to https:// url */
+ LWSMPRO_CALLBACK = 6, /**< hand by named protocol's callback */
+};
+
+/** struct lws_http_mount
+ *
+ * arguments for mounting something in a vhost's url namespace
+ */
+struct lws_http_mount {
+ const struct lws_http_mount *mount_next;
+ /**< pointer to next struct lws_http_mount */
+ const char *mountpoint;
+ /**< mountpoint in http pathspace, eg, "/" */
+ const char *origin;
+ /**< path to be mounted, eg, "/var/www/warmcat.com" */
+ const char *def;
+ /**< default target, eg, "index.html" */
+ const char *protocol;
+ /**<"protocol-name" to handle mount */
+
+ const struct lws_protocol_vhost_options *cgienv;
+ /**< optional linked-list of cgi options. These are created
+ * as environment variables for the cgi process
+ */
+ const struct lws_protocol_vhost_options *extra_mimetypes;
+ /**< optional linked-list of mimetype mappings */
+ const struct lws_protocol_vhost_options *interpret;
+ /**< optional linked-list of files to be interpreted */
+
+ int cgi_timeout;
+ /**< seconds cgi is allowed to live, if cgi://mount type */
+ int cache_max_age;
+ /**< max-age for reuse of client cache of files, seconds */
+ unsigned int auth_mask;
+ /**< bits set here must be set for authorized client session */
+
+ unsigned int cache_reusable:1; /**< set if client cache may reuse this */
+ unsigned int cache_revalidate:1; /**< set if client cache should revalidate on use */
+ unsigned int cache_intermediaries:1; /**< set if intermediaries are allowed to cache */
+
+ unsigned char origin_protocol; /**< one of enum lws_mount_protocols */
+ unsigned char mountpoint_len; /**< length of mountpoint string */
+
+ const char *basic_auth_login_file;
+ /**<NULL, or filepath to use to check basic auth logins against */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility
+ *
+ * The below is to ensure later library versions with new
+ * members added above will see 0 (default) even if the app
+ * was not built against the newer headers.
+ */
+
+ void *_unused[2]; /**< dummy */
+};
+///@}
+///@}
+
+/*! \defgroup client Client related functions
+ * ##Client releated functions
+ * \ingroup lwsapi
+ *
+ * */
+///@{
+
+/** enum lws_client_connect_ssl_connection_flags - flags that may be used
+ * with struct lws_client_connect_info ssl_connection member to control if
+ * and how SSL checks apply to the client connection being created
+ */
+
+enum lws_client_connect_ssl_connection_flags {
+ LCCSCF_USE_SSL = (1 << 0),
+ LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
+ LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
+ LCCSCF_ALLOW_EXPIRED = (1 << 3),
+
+ LCCSCF_PIPELINE = (1 << 16),
+ /**< Serialize / pipeline multiple client connections
+ * on a single connection where possible.
+ *
+ * HTTP/1.0: possible if Keep-Alive: yes sent by server
+ * HTTP/1.1: always possible... uses pipelining
+ * HTTP/2: always possible... uses parallel streams
+ * */
+};
+
+/** struct lws_client_connect_info - parameters to connect with when using
+ * lws_client_connect_via_info() */
+
+struct lws_client_connect_info {
+ struct lws_context *context;
+ /**< lws context to create connection in */
+ const char *address;
+ /**< remote address to connect to */
+ int port;
+ /**< remote port to connect to */
+ int ssl_connection;
+ /**< 0, or a combination of LCCSCF_ flags */
+ const char *path;
+ /**< uri path */
+ const char *host;
+ /**< content of host header */
+ const char *origin;
+ /**< content of origin header */
+ const char *protocol;
+ /**< list of ws protocols we could accept */
+ int ietf_version_or_minus_one;
+ /**< deprecated: currently leave at 0 or -1 */
+ void *userdata;
+ /**< if non-NULL, use this as wsi user_data instead of malloc it */
+ const void *client_exts;
+ /**< UNUSED... provide in info.extensions at context creation time */
+ const char *method;
+ /**< if non-NULL, do this http method instead of ws[s] upgrade.
+ * use "GET" to be a simple http client connection. "RAW" gets
+ * you a connected socket that lws itself will leave alone once
+ * connected. */
+ struct lws *parent_wsi;
+ /**< if another wsi is responsible for this connection, give it here.
+ * this is used to make sure if the parent closes so do any
+ * child connections first. */
+ const char *uri_replace_from;
+ /**< if non-NULL, when this string is found in URIs in
+ * text/html content-encoding, it's replaced with uri_replace_to */
+ const char *uri_replace_to;
+ /**< see uri_replace_from */
+ struct lws_vhost *vhost;
+ /**< vhost to bind to (used to determine related SSL_CTX) */
+ struct lws **pwsi;
+ /**< if not NULL, store the new wsi here early in the connection
+ * process. Although we return the new wsi, the call to create the
+ * client connection does progress the connection somewhat and may
+ * meet an error that will result in the connection being scrubbed and
+ * NULL returned. While the wsi exists though, he may process a
+ * callback like CLIENT_CONNECTION_ERROR with his wsi: this gives the
+ * user callback a way to identify which wsi it is that faced the error
+ * even before the new wsi is returned and even if ultimately no wsi
+ * is returned.
+ */
+ const char *iface;
+ /**< NULL to allow routing on any interface, or interface name or IP
+ * to bind the socket to */
+ const char *local_protocol_name;
+ /**< NULL: .protocol is used both to select the local protocol handler
+ * to bind to and as the list of remote ws protocols we could
+ * accept.
+ * non-NULL: this protocol name is used to bind the connection to
+ * the local protocol handler. .protocol is used for the
+ * list of remote ws protocols we could accept */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility
+ *
+ * The below is to ensure later library versions with new
+ * members added above will see 0 (default) even if the app
+ * was not built against the newer headers.
+ */
+ const char *alpn;
+ /* NULL: allow lws default ALPN list, from vhost if present or from
+ * list of roles built into lws
+ * non-NULL: require one from provided comma-separated list of alpn
+ * tokens
+ */
+
+ void *_unused[4]; /**< dummy */
+};
+
+/**
+ * lws_client_connect_via_info() - Connect to another websocket server
+ * \param ccinfo: pointer to lws_client_connect_info struct
+ *
+ * This function creates a connection to a remote server using the
+ * information provided in ccinfo.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_client_connect_via_info(struct lws_client_connect_info * ccinfo);
+
+/**
+ * lws_client_connect() - Connect to another websocket server
+ * \deprecated DEPRECATED use lws_client_connect_via_info
+ * \param clients: Websocket context
+ * \param address: Remote server address, eg, "myserver.com"
+ * \param port: Port to connect to on the remote server, eg, 80
+ * \param ssl_connection: 0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self
+ * signed certs
+ * \param path: Websocket path on server
+ * \param host: Hostname on server
+ * \param origin: Socket origin name
+ * \param protocol: Comma-separated list of protocols being asked for from
+ * the server, or just one. The server will pick the one it
+ * likes best. If you don't want to specify a protocol, which is
+ * legal, use NULL here.
+ * \param ietf_version_or_minus_one: -1 to ask to connect using the default, latest
+ * protocol supported, or the specific protocol ordinal
+ *
+ * This function creates a connection to a remote server
+ */
+/* deprecated, use lws_client_connect_via_info() */
+LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
+lws_client_connect(struct lws_context *clients, const char *address,
+ int port, int ssl_connection, const char *path,
+ const char *host, const char *origin, const char *protocol,
+ int ietf_version_or_minus_one) LWS_WARN_DEPRECATED;
+/* deprecated, use lws_client_connect_via_info() */
+/**
+ * lws_client_connect_extended() - Connect to another websocket server
+ * \deprecated DEPRECATED use lws_client_connect_via_info
+ * \param clients: Websocket context
+ * \param address: Remote server address, eg, "myserver.com"
+ * \param port: Port to connect to on the remote server, eg, 80
+ * \param ssl_connection: 0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self
+ * signed certs
+ * \param path: Websocket path on server
+ * \param host: Hostname on server
+ * \param origin: Socket origin name
+ * \param protocol: Comma-separated list of protocols being asked for from
+ * the server, or just one. The server will pick the one it
+ * likes best.
+ * \param ietf_version_or_minus_one: -1 to ask to connect using the default, latest
+ * protocol supported, or the specific protocol ordinal
+ * \param userdata: Pre-allocated user data
+ *
+ * This function creates a connection to a remote server
+ */
+LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
+lws_client_connect_extended(struct lws_context *clients, const char *address,
+ int port, int ssl_connection, const char *path,
+ const char *host, const char *origin,
+ const char *protocol, int ietf_version_or_minus_one,
+ void *userdata) LWS_WARN_DEPRECATED;
+
+/**
+ * lws_init_vhost_client_ssl() - also enable client SSL on an existing vhost
+ *
+ * \param info: client ssl related info
+ * \param vhost: which vhost to initialize client ssl operations on
+ *
+ * You only need to call this if you plan on using SSL client connections on
+ * the vhost. For non-SSL client connections, it's not necessary to call this.
+ *
+ * The following members of info are used during the call
+ *
+ * - options must have LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT set,
+ * otherwise the call does nothing
+ * - provided_client_ssl_ctx must be NULL to get a generated client
+ * ssl context, otherwise you can pass a prepared one in by setting it
+ * - ssl_cipher_list may be NULL or set to the client valid cipher list
+ * - ssl_ca_filepath may be NULL or client cert filepath
+ * - ssl_cert_filepath may be NULL or client cert filepath
+ * - ssl_private_key_filepath may be NULL or client cert private key
+ *
+ * You must create your vhost explicitly if you want to use this, so you have
+ * a pointer to the vhost. Create the context first with the option flag
+ * LWS_SERVER_OPTION_EXPLICIT_VHOSTS and then call lws_create_vhost() with
+ * the same info struct.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_init_vhost_client_ssl(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost);
+/**
+ * lws_http_client_read() - consume waiting received http client data
+ *
+ * \param wsi: client connection
+ * \param buf: pointer to buffer pointer - fill with pointer to your buffer
+ * \param len: pointer to chunk length - fill with max length of buffer
+ *
+ * This is called when the user code is notified client http data has arrived.
+ * The user code may choose to delay calling it to consume the data, for example
+ * waiting until an onward connection is writeable.
+ *
+ * For non-chunked connections, up to len bytes of buf are filled with the
+ * received content. len is set to the actual amount filled before return.
+ *
+ * For chunked connections, the linear buffer content contains the chunking
+ * headers and it cannot be passed in one lump. Instead, this function will
+ * call back LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ with in pointing to the
+ * chunk start and len set to the chunk length. There will be as many calls
+ * as there are chunks or partial chunks in the buffer.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_http_client_read(struct lws *wsi, char **buf, int *len);
+
+/**
+ * lws_http_client_http_response() - get last HTTP response code
+ *
+ * \param wsi: client connection
+ *
+ * Returns the last server response code, eg, 200 for client http connections.
+ *
+ * You should capture this during the LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP
+ * callback, because after that the memory reserved for storing the related
+ * headers is freed and this value is lost.
+ */
+LWS_VISIBLE LWS_EXTERN unsigned int
+lws_http_client_http_response(struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_client_http_body_pending(struct lws *wsi, int something_left_to_send);
+
+/**
+ * lws_client_http_body_pending() - control if client connection neeeds to send body
+ *
+ * \param wsi: client connection
+ * \param something_left_to_send: nonzero if need to send more body, 0 (default)
+ * if nothing more to send
+ *
+ * If you will send payload data with your HTTP client connection, eg, for POST,
+ * when you set the related http headers in
+ * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER callback you should also call
+ * this API with something_left_to_send nonzero, and call
+ * lws_callback_on_writable(wsi);
+ *
+ * After sending the headers, lws will call your callback with
+ * LWS_CALLBACK_CLIENT_HTTP_WRITEABLE reason when writable. You can send the
+ * next part of the http body payload, calling lws_callback_on_writable(wsi);
+ * if there is more to come, or lws_client_http_body_pending(wsi, 0); to
+ * let lws know the last part is sent and the connection can move on.
+ */
+
+///@}
+
+/** \defgroup service Built-in service loop entry
+ *
+ * ##Built-in service loop entry
+ *
+ * If you're not using libev / libuv, these apis are needed to enter the poll()
+ * wait in lws and service any connections with pending events.
+ */
+///@{
+
+/**
+ * lws_service() - Service any pending websocket activity
+ * \param context: Websocket context
+ * \param timeout_ms: Timeout for poll; 0 means return immediately if nothing needed
+ * service otherwise block and service immediately, returning
+ * after the timeout if nothing needed service.
+ *
+ * This function deals with any pending websocket traffic, for three
+ * kinds of event. It handles these events on both server and client
+ * types of connection the same.
+ *
+ * 1) Accept new connections to our context's server
+ *
+ * 2) Call the receive callback for incoming frame data received by
+ * server or client connections.
+ *
+ * You need to call this service function periodically to all the above
+ * functions to happen; if your application is single-threaded you can
+ * just call it in your main event loop.
+ *
+ * Alternatively you can fork a new process that asynchronously handles
+ * calling this service in a loop. In that case you are happy if this
+ * call blocks your thread until it needs to take care of something and
+ * would call it with a large nonzero timeout. Your loop then takes no
+ * CPU while there is nothing happening.
+ *
+ * If you are calling it in a single-threaded app, you don't want it to
+ * wait around blocking other things in your loop from happening, so you
+ * would call it with a timeout_ms of 0, so it returns immediately if
+ * nothing is pending, or as soon as it services whatever was pending.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_service(struct lws_context *context, int timeout_ms);
+
+/**
+ * lws_service_tsi() - Service any pending websocket activity
+ *
+ * \param context: Websocket context
+ * \param timeout_ms: Timeout for poll; 0 means return immediately if nothing needed
+ * service otherwise block and service immediately, returning
+ * after the timeout if nothing needed service.
+ * \param tsi: Thread service index, starting at 0
+ *
+ * Same as lws_service(), but for a specific thread service index. Only needed
+ * if you are spawning multiple service threads.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
+
+/**
+ * lws_cancel_service_pt() - Cancel servicing of pending socket activity
+ * on one thread
+ * \param wsi: Cancel service on the thread this wsi is serviced by
+ *
+ * Same as lws_cancel_service(), but targets a single service thread, the one
+ * the wsi belongs to. You probably want to use lws_cancel_service() instead.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_cancel_service_pt(struct lws *wsi);
+
+/**
+ * lws_cancel_service() - Cancel wait for new pending socket activity
+ * \param context: Websocket context
+ *
+ * This function creates an immediate "synchronous interrupt" to the lws poll()
+ * wait or event loop. As soon as possible in the serialzed service sequencing,
+ * a LWS_CALLBACK_EVENT_WAIT_CANCELLED callback is sent to every protocol on
+ * every vhost.
+ *
+ * lws_cancel_service() may be called from another thread while the context
+ * exists, and its effect will be immediately serialized.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_cancel_service(struct lws_context *context);
+
+/**
+ * lws_service_fd() - Service polled socket with something waiting
+ * \param context: Websocket context
+ * \param pollfd: The pollfd entry describing the socket fd and which events
+ * happened, or NULL to tell lws to do only timeout servicing.
+ *
+ * This function takes a pollfd that has POLLIN or POLLOUT activity and
+ * services it according to the state of the associated
+ * struct lws.
+ *
+ * The one call deals with all "service" that might happen on a socket
+ * including listen accepts, http files as well as websocket protocol.
+ *
+ * If a pollfd says it has something, you can just pass it to
+ * lws_service_fd() whether it is a socket handled by lws or not.
+ * If it sees it is a lws socket, the traffic will be handled and
+ * pollfd->revents will be zeroed now.
+ *
+ * If the socket is foreign to lws, it leaves revents alone. So you can
+ * see if you should service yourself by checking the pollfd revents
+ * after letting lws try to service it.
+ *
+ * You should also call this with pollfd = NULL to just allow the
+ * once-per-second global timeout checks; if less than a second since the last
+ * check it returns immediately then.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd);
+
+/**
+ * lws_service_fd_tsi() - Service polled socket in specific service thread
+ * \param context: Websocket context
+ * \param pollfd: The pollfd entry describing the socket fd and which events
+ * happened.
+ * \param tsi: thread service index
+ *
+ * Same as lws_service_fd() but used with multiple service threads
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
+ int tsi);
+
+/**
+ * lws_service_adjust_timeout() - Check for any connection needing forced service
+ * \param context: Websocket context
+ * \param timeout_ms: The original poll timeout value. You can just set this
+ * to 1 if you don't really have a poll timeout.
+ * \param tsi: thread service index
+ *
+ * Under some conditions connections may need service even though there is no
+ * pending network action on them, this is "forced service". For default
+ * poll() and libuv / libev, the library takes care of calling this and
+ * dealing with it for you. But for external poll() integration, you need
+ * access to the apis.
+ *
+ * If anybody needs "forced service", returned timeout is zero. In that case,
+ * you can call lws_service_tsi() with a timeout of -1 to only service
+ * guys who need forced service.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi);
+
+/* Backwards compatibility */
+#define lws_plat_service_tsi lws_service_tsi
+
+LWS_VISIBLE LWS_EXTERN int
+lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd);
+
+///@}
+
+/*! \defgroup http HTTP
+
+ Modules related to handling HTTP
+*/
+//@{
+
+/*! \defgroup httpft HTTP File transfer
+ * \ingroup http
+
+ APIs for sending local files in response to HTTP requests
+*/
+//@{
+
+/**
+ * lws_get_mimetype() - Determine mimetype to use from filename
+ *
+ * \param file: filename
+ * \param m: NULL, or mount context
+ *
+ * This uses a canned list of known filetypes first, if no match and m is
+ * non-NULL, then tries a list of per-mount file suffix to mimtype mappings.
+ *
+ * Returns either NULL or a pointer to the mimetype matching the file.
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_mimetype(const char *file, const struct lws_http_mount *m);
+
+/**
+ * lws_serve_http_file() - Send a file back to the client using http
+ * \param wsi: Websocket instance (available from user callback)
+ * \param file: The file to issue over http
+ * \param content_type: The http content type, eg, text/html
+ * \param other_headers: NULL or pointer to header string
+ * \param other_headers_len: length of the other headers if non-NULL
+ *
+ * This function is intended to be called from the callback in response
+ * to http requests from the client. It allows the callback to issue
+ * local files down the http link in a single step.
+ *
+ * Returning <0 indicates error and the wsi should be closed. Returning
+ * >0 indicates the file was completely sent and
+ * lws_http_transaction_completed() called on the wsi (and close if != 0)
+ * ==0 indicates the file transfer is started and needs more service later,
+ * the wsi should be left alone.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
+ const char *other_headers, int other_headers_len);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_serve_http_file_fragment(struct lws *wsi);
+//@}
+
+
+enum http_status {
+ HTTP_STATUS_CONTINUE = 100,
+
+ HTTP_STATUS_OK = 200,
+ HTTP_STATUS_NO_CONTENT = 204,
+ HTTP_STATUS_PARTIAL_CONTENT = 206,
+
+ HTTP_STATUS_MOVED_PERMANENTLY = 301,
+ HTTP_STATUS_FOUND = 302,
+ HTTP_STATUS_SEE_OTHER = 303,
+ HTTP_STATUS_NOT_MODIFIED = 304,
+
+ HTTP_STATUS_BAD_REQUEST = 400,
+ HTTP_STATUS_UNAUTHORIZED,
+ HTTP_STATUS_PAYMENT_REQUIRED,
+ HTTP_STATUS_FORBIDDEN,
+ HTTP_STATUS_NOT_FOUND,
+ HTTP_STATUS_METHOD_NOT_ALLOWED,
+ HTTP_STATUS_NOT_ACCEPTABLE,
+ HTTP_STATUS_PROXY_AUTH_REQUIRED,
+ HTTP_STATUS_REQUEST_TIMEOUT,
+ HTTP_STATUS_CONFLICT,
+ HTTP_STATUS_GONE,
+ HTTP_STATUS_LENGTH_REQUIRED,
+ HTTP_STATUS_PRECONDITION_FAILED,
+ HTTP_STATUS_REQ_ENTITY_TOO_LARGE,
+ HTTP_STATUS_REQ_URI_TOO_LONG,
+ HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE,
+ HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE,
+ HTTP_STATUS_EXPECTATION_FAILED,
+
+ HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
+ HTTP_STATUS_NOT_IMPLEMENTED,
+ HTTP_STATUS_BAD_GATEWAY,
+ HTTP_STATUS_SERVICE_UNAVAILABLE,
+ HTTP_STATUS_GATEWAY_TIMEOUT,
+ HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED,
+};
+/*! \defgroup html-chunked-substitution HTML Chunked Substitution
+ * \ingroup http
+ *
+ * ##HTML chunked Substitution
+ *
+ * APIs for receiving chunks of text, replacing a set of variable names via
+ * a callback, and then prepending and appending HTML chunked encoding
+ * headers.
+ */
+//@{
+
+struct lws_process_html_args {
+ char *p; /**< pointer to the buffer containing the data */
+ int len; /**< length of the original data at p */
+ int max_len; /**< maximum length we can grow the data to */
+ int final; /**< set if this is the last chunk of the file */
+ int chunked; /**< 0 == unchunked, 1 == produce chunk headers (incompatible with HTTP/2) */
+};
+
+typedef const char *(*lws_process_html_state_cb)(void *data, int index);
+
+struct lws_process_html_state {
+ char *start; /**< pointer to start of match */
+ char swallow[16]; /**< matched character buffer */
+ int pos; /**< position in match */
+ void *data; /**< opaque pointer */
+ const char * const *vars; /**< list of variable names */
+ int count_vars; /**< count of variable names */
+
+ lws_process_html_state_cb replace; /**< called on match to perform substitution */
+};
+
+/*! lws_chunked_html_process() - generic chunked substitution
+ * \param args: buffer to process using chunked encoding
+ * \param s: current processing state
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_chunked_html_process(struct lws_process_html_args *args,
+ struct lws_process_html_state *s);
+//@}
+
+/** \defgroup HTTP-headers-read HTTP headers: read
+ * \ingroup http
+ *
+ * ##HTTP header releated functions
+ *
+ * In lws the client http headers are temporarily stored in a pool, only for the
+ * duration of the http part of the handshake. It's because in most cases,
+ * the header content is ignored for the whole rest of the connection lifetime
+ * and would then just be taking up space needlessly.
+ *
+ * During LWS_CALLBACK_HTTP when the URI path is delivered is the last time
+ * the http headers are still allocated, you can use these apis then to
+ * look at and copy out interesting header content (cookies, etc)
+ *
+ * Notice that the header total length reported does not include a terminating
+ * '\0', however you must allocate for it when using the _copy apis. So the
+ * length reported for a header containing "123" is 3, but you must provide
+ * a buffer of length 4 so that "123\0" may be copied into it, or the copy
+ * will fail with a nonzero return code.
+ *
+ * In the special case of URL arguments, like ?x=1&y=2, the arguments are
+ * stored in a token named for the method, eg, WSI_TOKEN_GET_URI if it
+ * was a GET or WSI_TOKEN_POST_URI if POST. You can check the total
+ * length to confirm the method.
+ *
+ * For URL arguments, each argument is stored urldecoded in a "fragment", so
+ * you can use the fragment-aware api lws_hdr_copy_fragment() to access each
+ * argument in turn: the fragments contain urldecoded strings like x=1 or y=2.
+ *
+ * As a convenience, lws has an api that will find the fragment with a
+ * given name= part, lws_get_urlarg_by_name().
+ */
+///@{
+
+/** struct lws_tokens
+ * you need these to look at headers that have been parsed if using the
+ * LWS_CALLBACK_FILTER_CONNECTION callback. If a header from the enum
+ * list below is absent, .token = NULL and len = 0. Otherwise .token
+ * points to .len chars containing that header content.
+ */
+struct lws_tokens {
+ char *token; /**< pointer to start of the token */
+ int len; /**< length of the token's value */
+};
+
+/* enum lws_token_indexes
+ * these have to be kept in sync with lextable.h / minilex.c
+ *
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+enum lws_token_indexes {
+ WSI_TOKEN_GET_URI = 0,
+ WSI_TOKEN_POST_URI = 1,
+ WSI_TOKEN_OPTIONS_URI = 2,
+ WSI_TOKEN_HOST = 3,
+ WSI_TOKEN_CONNECTION = 4,
+ WSI_TOKEN_UPGRADE = 5,
+ WSI_TOKEN_ORIGIN = 6,
+ WSI_TOKEN_DRAFT = 7,
+ WSI_TOKEN_CHALLENGE = 8,
+ WSI_TOKEN_EXTENSIONS = 9,
+ WSI_TOKEN_KEY1 = 10,
+ WSI_TOKEN_KEY2 = 11,
+ WSI_TOKEN_PROTOCOL = 12,
+ WSI_TOKEN_ACCEPT = 13,
+ WSI_TOKEN_NONCE = 14,
+ WSI_TOKEN_HTTP = 15,
+ WSI_TOKEN_HTTP2_SETTINGS = 16,
+ WSI_TOKEN_HTTP_ACCEPT = 17,
+ WSI_TOKEN_HTTP_AC_REQUEST_HEADERS = 18,
+ WSI_TOKEN_HTTP_IF_MODIFIED_SINCE = 19,
+ WSI_TOKEN_HTTP_IF_NONE_MATCH = 20,
+ WSI_TOKEN_HTTP_ACCEPT_ENCODING = 21,
+ WSI_TOKEN_HTTP_ACCEPT_LANGUAGE = 22,
+ WSI_TOKEN_HTTP_PRAGMA = 23,
+ WSI_TOKEN_HTTP_CACHE_CONTROL = 24,
+ WSI_TOKEN_HTTP_AUTHORIZATION = 25,
+ WSI_TOKEN_HTTP_COOKIE = 26,
+ WSI_TOKEN_HTTP_CONTENT_LENGTH = 27,
+ WSI_TOKEN_HTTP_CONTENT_TYPE = 28,
+ WSI_TOKEN_HTTP_DATE = 29,
+ WSI_TOKEN_HTTP_RANGE = 30,
+ WSI_TOKEN_HTTP_REFERER = 31,
+ WSI_TOKEN_KEY = 32,
+ WSI_TOKEN_VERSION = 33,
+ WSI_TOKEN_SWORIGIN = 34,
+
+ WSI_TOKEN_HTTP_COLON_AUTHORITY = 35,
+ WSI_TOKEN_HTTP_COLON_METHOD = 36,
+ WSI_TOKEN_HTTP_COLON_PATH = 37,
+ WSI_TOKEN_HTTP_COLON_SCHEME = 38,
+ WSI_TOKEN_HTTP_COLON_STATUS = 39,
+
+ WSI_TOKEN_HTTP_ACCEPT_CHARSET = 40,
+ WSI_TOKEN_HTTP_ACCEPT_RANGES = 41,
+ WSI_TOKEN_HTTP_ACCESS_CONTROL_ALLOW_ORIGIN = 42,
+ WSI_TOKEN_HTTP_AGE = 43,
+ WSI_TOKEN_HTTP_ALLOW = 44,
+ WSI_TOKEN_HTTP_CONTENT_DISPOSITION = 45,
+ WSI_TOKEN_HTTP_CONTENT_ENCODING = 46,
+ WSI_TOKEN_HTTP_CONTENT_LANGUAGE = 47,
+ WSI_TOKEN_HTTP_CONTENT_LOCATION = 48,
+ WSI_TOKEN_HTTP_CONTENT_RANGE = 49,
+ WSI_TOKEN_HTTP_ETAG = 50,
+ WSI_TOKEN_HTTP_EXPECT = 51,
+ WSI_TOKEN_HTTP_EXPIRES = 52,
+ WSI_TOKEN_HTTP_FROM = 53,
+ WSI_TOKEN_HTTP_IF_MATCH = 54,
+ WSI_TOKEN_HTTP_IF_RANGE = 55,
+ WSI_TOKEN_HTTP_IF_UNMODIFIED_SINCE = 56,
+ WSI_TOKEN_HTTP_LAST_MODIFIED = 57,
+ WSI_TOKEN_HTTP_LINK = 58,
+ WSI_TOKEN_HTTP_LOCATION = 59,
+ WSI_TOKEN_HTTP_MAX_FORWARDS = 60,
+ WSI_TOKEN_HTTP_PROXY_AUTHENTICATE = 61,
+ WSI_TOKEN_HTTP_PROXY_AUTHORIZATION = 62,
+ WSI_TOKEN_HTTP_REFRESH = 63,
+ WSI_TOKEN_HTTP_RETRY_AFTER = 64,
+ WSI_TOKEN_HTTP_SERVER = 65,
+ WSI_TOKEN_HTTP_SET_COOKIE = 66,
+ WSI_TOKEN_HTTP_STRICT_TRANSPORT_SECURITY = 67,
+ WSI_TOKEN_HTTP_TRANSFER_ENCODING = 68,
+ WSI_TOKEN_HTTP_USER_AGENT = 69,
+ WSI_TOKEN_HTTP_VARY = 70,
+ WSI_TOKEN_HTTP_VIA = 71,
+ WSI_TOKEN_HTTP_WWW_AUTHENTICATE = 72,
+
+ WSI_TOKEN_PATCH_URI = 73,
+ WSI_TOKEN_PUT_URI = 74,
+ WSI_TOKEN_DELETE_URI = 75,
+
+ WSI_TOKEN_HTTP_URI_ARGS = 76,
+ WSI_TOKEN_PROXY = 77,
+ WSI_TOKEN_HTTP_X_REAL_IP = 78,
+ WSI_TOKEN_HTTP1_0 = 79,
+ WSI_TOKEN_X_FORWARDED_FOR = 80,
+ WSI_TOKEN_CONNECT = 81,
+ WSI_TOKEN_HEAD_URI = 82,
+ WSI_TOKEN_TE = 83,
+ WSI_TOKEN_REPLAY_NONCE = 84,
+ WSI_TOKEN_COLON_PROTOCOL = 85,
+ WSI_TOKEN_X_AUTH_TOKEN = 86,
+
+ /****** add new things just above ---^ ******/
+
+ /* use token storage to stash these internally, not for
+ * user use */
+
+ _WSI_TOKEN_CLIENT_SENT_PROTOCOLS,
+ _WSI_TOKEN_CLIENT_PEER_ADDRESS,
+ _WSI_TOKEN_CLIENT_URI,
+ _WSI_TOKEN_CLIENT_HOST,
+ _WSI_TOKEN_CLIENT_ORIGIN,
+ _WSI_TOKEN_CLIENT_METHOD,
+ _WSI_TOKEN_CLIENT_IFACE,
+ _WSI_TOKEN_CLIENT_ALPN,
+
+ /* always last real token index*/
+ WSI_TOKEN_COUNT,
+
+ /* parser state additions, no storage associated */
+ WSI_TOKEN_NAME_PART,
+ WSI_TOKEN_SKIPPING,
+ WSI_TOKEN_SKIPPING_SAW_CR,
+ WSI_PARSING_COMPLETE,
+ WSI_INIT_TOKEN_MUXURL,
+};
+
+struct lws_token_limits {
+ unsigned short token_limit[WSI_TOKEN_COUNT]; /**< max chars for this token */
+};
+
+/**
+ * lws_token_to_string() - returns a textual representation of a hdr token index
+ *
+ * \param token: token index
+ */
+LWS_VISIBLE LWS_EXTERN const unsigned char *
+lws_token_to_string(enum lws_token_indexes token);
+
+/**
+ * lws_hdr_total_length: report length of all fragments of a header totalled up
+ * The returned length does not include the space for a
+ * terminating '\0'
+ *
+ * \param wsi: websocket connection
+ * \param h: which header index we are interested in
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h);
+
+/**
+ * lws_hdr_fragment_length: report length of a single fragment of a header
+ * The returned length does not include the space for a
+ * terminating '\0'
+ *
+ * \param wsi: websocket connection
+ * \param h: which header index we are interested in
+ * \param frag_idx: which fragment of h we want to get the length of
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx);
+
+/**
+ * lws_hdr_copy() - copy a single fragment of the given header to a buffer
+ * The buffer length len must include space for an additional
+ * terminating '\0', or it will fail returning -1.
+ *
+ * \param wsi: websocket connection
+ * \param dest: destination buffer
+ * \param len: length of destination buffer
+ * \param h: which header index we are interested in
+ *
+ * copies the whole, aggregated header, even if it was delivered in
+ * several actual headers piece by piece
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h);
+
+/**
+ * lws_hdr_copy_fragment() - copy a single fragment of the given header to a buffer
+ * The buffer length len must include space for an additional
+ * terminating '\0', or it will fail returning -1.
+ * If the requested fragment index is not present, it fails
+ * returning -1.
+ *
+ * \param wsi: websocket connection
+ * \param dest: destination buffer
+ * \param len: length of destination buffer
+ * \param h: which header index we are interested in
+ * \param frag_idx: which fragment of h we want to copy
+ *
+ * Normally this is only useful
+ * to parse URI arguments like ?x=1&y=2, token index WSI_TOKEN_HTTP_URI_ARGS
+ * fragment 0 will contain "x=1" and fragment 1 "y=2"
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len,
+ enum lws_token_indexes h, int frag_idx);
+
+/**
+ * lws_get_urlarg_by_name() - return pointer to arg value if present
+ * \param wsi: the connection to check
+ * \param name: the arg name, like "token="
+ * \param buf: the buffer to receive the urlarg (including the name= part)
+ * \param len: the length of the buffer to receive the urlarg
+ *
+ * Returns NULL if not found or a pointer inside buf to just after the
+ * name= part.
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len);
+///@}
+
+/*! \defgroup HTTP-headers-create HTTP headers: create
+ *
+ * ## HTTP headers: Create
+ *
+ * These apis allow you to create HTTP response headers in a way compatible with
+ * both HTTP/1.x and HTTP/2.
+ *
+ * They each append to a buffer taking care about the buffer end, which is
+ * passed in as a pointer. When data is written to the buffer, the current
+ * position p is updated accordingly.
+ *
+ * All of these apis are LWS_WARN_UNUSED_RESULT as they can run out of space
+ * and fail with nonzero return.
+ */
+///@{
+
+#define LWSAHH_CODE_MASK ((1 << 16) - 1)
+#define LWSAHH_FLAG_NO_SERVER_NAME (1 << 30)
+
+/**
+ * lws_add_http_header_status() - add the HTTP response status code
+ *
+ * \param wsi: the connection to check
+ * \param code: an HTTP code like 200, 404 etc (see enum http_status)
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Adds the initial response code, so should be called first.
+ *
+ * Code may additionally take OR'd flags:
+ *
+ * LWSAHH_FLAG_NO_SERVER_NAME: don't apply server name header this time
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_add_http_header_status(struct lws *wsi,
+ unsigned int code, unsigned char **p,
+ unsigned char *end);
+/**
+ * lws_add_http_header_by_name() - append named header and value
+ *
+ * \param wsi: the connection to check
+ * \param name: the hdr name, like "my-header"
+ * \param value: the value after the = for this header
+ * \param length: the length of the value
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Appends name: value to the headers
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
+ const unsigned char *value, int length,
+ unsigned char **p, unsigned char *end);
+/**
+ * lws_add_http_header_by_token() - append given header and value
+ *
+ * \param wsi: the connection to check
+ * \param token: the token index for the hdr
+ * \param value: the value after the = for this header
+ * \param length: the length of the value
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Appends name=value to the headers, but is able to take advantage of better
+ * HTTP/2 coding mechanisms where possible.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
+ const unsigned char *value, int length,
+ unsigned char **p, unsigned char *end);
+/**
+ * lws_add_http_header_content_length() - append content-length helper
+ *
+ * \param wsi: the connection to check
+ * \param content_length: the content length to use
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Appends content-length: content_length to the headers
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_add_http_header_content_length(struct lws *wsi,
+ lws_filepos_t content_length,
+ unsigned char **p, unsigned char *end);
+/**
+ * lws_finalize_http_header() - terminate header block
+ *
+ * \param wsi: the connection to check
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Indicates no more headers will be added
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_finalize_http_header(struct lws *wsi, unsigned char **p,
+ unsigned char *end);
+
+/**
+ * lws_finalize_write_http_header() - Helper finializing and writing http headers
+ *
+ * \param wsi: the connection to check
+ * \param start: pointer to the start of headers in the buffer, eg &buf[LWS_PRE]
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Terminates the headers correctly accoring to the protocol in use (h1 / h2)
+ * and writes the headers. Returns nonzero for error.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_finalize_write_http_header(struct lws *wsi, unsigned char *start,
+ unsigned char **p, unsigned char *end);
+
+#define LWS_ILLEGAL_HTTP_CONTENT_LEN ((lws_filepos_t)-1ll)
+
+/**
+ * lws_add_http_common_headers() - Helper preparing common http headers
+ *
+ * \param wsi: the connection to check
+ * \param code: an HTTP code like 200, 404 etc (see enum http_status)
+ * \param content_type: the content type, like "text/html"
+ * \param content_len: the content length, in bytes
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Adds the initial response code, so should be called first.
+ *
+ * Code may additionally take OR'd flags:
+ *
+ * LWSAHH_FLAG_NO_SERVER_NAME: don't apply server name header this time
+ *
+ * This helper just calls public apis to simplify adding headers that are
+ * commonly needed. If it doesn't fit your case, or you want to add additional
+ * headers just call the public apis directly yourself for what you want.
+ *
+ * You can miss out the content length header by providing the constant
+ * LWS_ILLEGAL_HTTP_CONTENT_LEN for the content_len.
+ *
+ * It does not call lws_finalize_http_header(), to allow you to add further
+ * headers after calling this. You will need to call that yourself at the end.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_add_http_common_headers(struct lws *wsi, unsigned int code,
+ const char *content_type, lws_filepos_t content_len,
+ unsigned char **p, unsigned char *end);
+///@}
+
+/** \defgroup form-parsing Form Parsing
+ * \ingroup http
+ * ##POSTed form parsing functions
+ *
+ * These lws_spa (stateful post arguments) apis let you parse and urldecode
+ * POSTed form arguments, both using simple urlencoded and multipart transfer
+ * encoding.
+ *
+ * It's capable of handling file uploads as well a named input parsing,
+ * and the apis are the same for both form upload styles.
+ *
+ * You feed it a list of parameter names and it creates pointers to the
+ * urldecoded arguments: file upload parameters pass the file data in chunks to
+ * a user-supplied callback as they come.
+ *
+ * Since it's stateful, it handles the incoming data needing more than one
+ * POST_BODY callback and has no limit on uploaded file size.
+ */
+///@{
+
+/** enum lws_spa_fileupload_states */
+enum lws_spa_fileupload_states {
+ LWS_UFS_CONTENT,
+ /**< a chunk of file content has arrived */
+ LWS_UFS_FINAL_CONTENT,
+ /**< the last chunk (possibly zero length) of file content has arrived */
+ LWS_UFS_OPEN
+ /**< a new file is starting to arrive */
+};
+
+/**
+ * lws_spa_fileupload_cb() - callback to receive file upload data
+ *
+ * \param data: opt_data pointer set in lws_spa_create
+ * \param name: name of the form field being uploaded
+ * \param filename: original filename from client
+ * \param buf: start of data to receive
+ * \param len: length of data to receive
+ * \param state: information about how this call relates to file
+ *
+ * Notice name and filename shouldn't be trusted, as they are passed from
+ * HTTP provided by the client.
+ */
+typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
+ const char *filename, char *buf, int len,
+ enum lws_spa_fileupload_states state);
+
+/** struct lws_spa - opaque urldecode parser capable of handling multipart
+ * and file uploads */
+struct lws_spa;
+
+/**
+ * lws_spa_create() - create urldecode parser
+ *
+ * \param wsi: lws connection (used to find Content Type)
+ * \param param_names: array of form parameter names, like "username"
+ * \param count_params: count of param_names
+ * \param max_storage: total amount of form parameter values we can store
+ * \param opt_cb: NULL, or callback to receive file upload data.
+ * \param opt_data: NULL, or user pointer provided to opt_cb.
+ *
+ * Creates a urldecode parser and initializes it.
+ *
+ * opt_cb can be NULL if you just want normal name=value parsing, however
+ * if one or more entries in your form are bulk data (file transfer), you
+ * can provide this callback and filter on the name callback parameter to
+ * treat that urldecoded data separately. The callback should return -1
+ * in case of fatal error, and 0 if OK.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_spa *
+lws_spa_create(struct lws *wsi, const char * const *param_names,
+ int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
+ void *opt_data);
+
+/**
+ * lws_spa_process() - parses a chunk of input data
+ *
+ * \param spa: the parser object previously created
+ * \param in: incoming, urlencoded data
+ * \param len: count of bytes valid at \param in
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_spa_process(struct lws_spa *spa, const char *in, int len);
+
+/**
+ * lws_spa_finalize() - indicate incoming data completed
+ *
+ * \param spa: the parser object previously created
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_spa_finalize(struct lws_spa *spa);
+
+/**
+ * lws_spa_get_length() - return length of parameter value
+ *
+ * \param spa: the parser object previously created
+ * \param n: parameter ordinal to return length of value for
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_spa_get_length(struct lws_spa *spa, int n);
+
+/**
+ * lws_spa_get_string() - return pointer to parameter value
+ * \param spa: the parser object previously created
+ * \param n: parameter ordinal to return pointer to value for
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_spa_get_string(struct lws_spa *spa, int n);
+
+/**
+ * lws_spa_destroy() - destroy parser object
+ *
+ * \param spa: the parser object previously created
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_spa_destroy(struct lws_spa *spa);
+///@}
+
+/*! \defgroup urlendec Urlencode and Urldecode
+ * \ingroup http
+ *
+ * ##HTML chunked Substitution
+ *
+ * APIs for receiving chunks of text, replacing a set of variable names via
+ * a callback, and then prepending and appending HTML chunked encoding
+ * headers.
+ */
+//@{
+
+/**
+ * lws_urlencode() - like strncpy but with urlencoding
+ *
+ * \param escaped: output buffer
+ * \param string: input buffer ('/0' terminated)
+ * \param len: output buffer max length
+ *
+ * Because urlencoding expands the output string, it's not
+ * possible to do it in-place, ie, with escaped == string
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_urlencode(char *escaped, const char *string, int len);
+
+/*
+ * URLDECODE 1 / 2
+ *
+ * This simple urldecode only operates until the first '\0' and requires the
+ * data to exist all at once
+ */
+/**
+ * lws_urldecode() - like strncpy but with urldecoding
+ *
+ * \param string: output buffer
+ * \param escaped: input buffer ('\0' terminated)
+ * \param len: output buffer max length
+ *
+ * This is only useful for '\0' terminated strings
+ *
+ * Since urldecoding only shrinks the output string, it is possible to
+ * do it in-place, ie, string == escaped
+ *
+ * Returns 0 if completed OK or nonzero for urldecode violation (non-hex chars
+ * where hex required, etc)
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_urldecode(char *string, const char *escaped, int len);
+///@}
+/**
+ * lws_return_http_status() - Return simple http status
+ * \param wsi: Websocket instance (available from user callback)
+ * \param code: Status index, eg, 404
+ * \param html_body: User-readable HTML description < 1KB, or NULL
+ *
+ * Helper to report HTTP errors back to the client cleanly and
+ * consistently
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_return_http_status(struct lws *wsi, unsigned int code,
+ const char *html_body);
+
+/**
+ * lws_http_redirect() - write http redirect out on wsi
+ *
+ * \param wsi: websocket connection
+ * \param code: HTTP response code (eg, 301)
+ * \param loc: where to redirect to
+ * \param len: length of loc
+ * \param p: pointer current position in buffer (updated as we write)
+ * \param end: pointer to end of buffer
+ *
+ * Returns amount written, or < 0 indicating fatal write failure.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
+ unsigned char **p, unsigned char *end);
+
+/**
+ * lws_http_transaction_completed() - wait for new http transaction or close
+ * \param wsi: websocket connection
+ *
+ * Returns 1 if the HTTP connection must close now
+ * Returns 0 and resets connection to wait for new HTTP header /
+ * transaction if possible
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_http_transaction_completed(struct lws *wsi);
+///@}
+
+/*! \defgroup pur Sanitize / purify SQL and JSON helpers
+ *
+ * ##Sanitize / purify SQL and JSON helpers
+ *
+ * APIs for escaping untrusted JSON and SQL safely before use
+ */
+//@{
+
+/**
+ * lws_sql_purify() - like strncpy but with escaping for sql quotes
+ *
+ * \param escaped: output buffer
+ * \param string: input buffer ('/0' terminated)
+ * \param len: output buffer max length
+ *
+ * Because escaping expands the output string, it's not
+ * possible to do it in-place, ie, with escaped == string
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_sql_purify(char *escaped, const char *string, int len);
+
+/**
+ * lws_json_purify() - like strncpy but with escaping for json chars
+ *
+ * \param escaped: output buffer
+ * \param string: input buffer ('/0' terminated)
+ * \param len: output buffer max length
+ *
+ * Because escaping expands the output string, it's not
+ * possible to do it in-place, ie, with escaped == string
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_json_purify(char *escaped, const char *string, int len);
+
+/**
+ * lws_filename_purify_inplace() - replace scary filename chars with underscore
+ *
+ * \param filename: filename to be purified
+ *
+ * Replace scary characters in the filename (it should not be a path)
+ * with underscore, so it's safe to use.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_filename_purify_inplace(char *filename);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
+ int len);
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_write_file(const char *filename, void *buf, int len);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_read_file(const char *filename, void *buf, int len);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_recommended_rsa_bits(void);
+///@}
+
+/*! \defgroup uv libuv helpers
+ *
+ * ##libuv helpers
+ *
+ * APIs specific to libuv event loop itegration
+ */
+///@{
+#ifdef LWS_WITH_LIBUV
+/*
+ * Any direct libuv allocations in lws protocol handlers must participate in the
+ * lws reference counting scheme. Two apis are provided:
+ *
+ * - lws_libuv_static_refcount_add(handle, context) to mark the handle with
+ * a pointer to the context and increment the global uv object counter
+ *
+ * - lws_libuv_static_refcount_del() which should be used as the close callback
+ * for your own libuv objects declared in the protocol scope.
+ *
+ * Using the apis allows lws to detach itself from a libuv loop completely
+ * cleanly and at the moment all of its libuv objects have completed close.
+ */
+
+LWS_VISIBLE LWS_EXTERN uv_loop_t *
+lws_uv_getloop(struct lws_context *context, int tsi);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_libuv_static_refcount_add(uv_handle_t *, struct lws_context *context);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_libuv_static_refcount_del(uv_handle_t *);
+
+#endif /* LWS_WITH_LIBUV */
+
+#if defined(LWS_WITH_ESP32)
+#define lws_libuv_static_refcount_add(_a, _b)
+#define lws_libuv_static_refcount_del NULL
+#endif
+///@}
+
+
+/*! \defgroup timeout Connection timeouts
+
+ APIs related to setting connection timeouts
+*/
+//@{
+
+/*
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+enum pending_timeout {
+ NO_PENDING_TIMEOUT = 0,
+ PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE = 1,
+ PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE = 2,
+ PENDING_TIMEOUT_ESTABLISH_WITH_SERVER = 3,
+ PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE = 4,
+ PENDING_TIMEOUT_AWAITING_PING = 5,
+ PENDING_TIMEOUT_CLOSE_ACK = 6,
+ PENDING_TIMEOUT_UNUSED1 = 7,
+ PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE = 8,
+ PENDING_TIMEOUT_SSL_ACCEPT = 9,
+ PENDING_TIMEOUT_HTTP_CONTENT = 10,
+ PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND = 11,
+ PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE = 12,
+ PENDING_TIMEOUT_SHUTDOWN_FLUSH = 13,
+ PENDING_TIMEOUT_CGI = 14,
+ PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE = 15,
+ PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING = 16,
+ PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG = 17,
+ PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD = 18,
+ PENDING_TIMEOUT_AWAITING_SOCKS_GREETING_REPLY = 19,
+ PENDING_TIMEOUT_AWAITING_SOCKS_CONNECT_REPLY = 20,
+ PENDING_TIMEOUT_AWAITING_SOCKS_AUTH_REPLY = 21,
+ PENDING_TIMEOUT_KILLED_BY_SSL_INFO = 22,
+ PENDING_TIMEOUT_KILLED_BY_PARENT = 23,
+ PENDING_TIMEOUT_CLOSE_SEND = 24,
+ PENDING_TIMEOUT_HOLDING_AH = 25,
+ PENDING_TIMEOUT_UDP_IDLE = 26,
+ PENDING_TIMEOUT_CLIENT_CONN_IDLE = 27,
+ PENDING_TIMEOUT_LAGGING = 28,
+
+ /****** add new things just above ---^ ******/
+
+ PENDING_TIMEOUT_USER_REASON_BASE = 1000
+};
+
+#define LWS_TO_KILL_ASYNC -1
+/**< If LWS_TO_KILL_ASYNC is given as the timeout sec in a lws_set_timeout()
+ * call, then the connection is marked to be killed at the next timeout
+ * check. This is how you should force-close the wsi being serviced if
+ * you are doing it outside the callback (where you should close by nonzero
+ * return).
+ */
+#define LWS_TO_KILL_SYNC -2
+/**< If LWS_TO_KILL_SYNC is given as the timeout sec in a lws_set_timeout()
+ * call, then the connection is closed before returning (which may delete
+ * the wsi). This should only be used where the wsi being closed is not the
+ * wsi currently being serviced.
+ */
+/**
+ * lws_set_timeout() - marks the wsi as subject to a timeout
+ *
+ * You will not need this unless you are doing something special
+ *
+ * \param wsi: Websocket connection instance
+ * \param reason: timeout reason
+ * \param secs: how many seconds. You may set to LWS_TO_KILL_ASYNC to
+ * force the connection to timeout at the next opportunity, or
+ * LWS_TO_KILL_SYNC to close it synchronously if you know the
+ * wsi is not the one currently being serviced.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
+
+#define LWS_SET_TIMER_USEC_CANCEL ((lws_usec_t)-1ll)
+#define LWS_USEC_PER_SEC (1000000ll)
+
+/**
+ * lws_set_timer_usecs() - schedules a callback on the wsi in the future
+ *
+ * \param wsi: Websocket connection instance
+ * \param usecs: LWS_SET_TIMER_USEC_CANCEL removes any existing scheduled
+ * callback, otherwise number of microseconds in the future
+ * the callback will occur at.
+ *
+ * NOTE: event loop support for this:
+ *
+ * default poll() loop: yes
+ * libuv event loop: yes
+ * libev: not implemented (patch welcome)
+ * libevent: not implemented (patch welcome)
+ *
+ * After the deadline expires, the wsi will get a callback of type
+ * LWS_CALLBACK_TIMER and the timer is exhausted. The deadline may be
+ * continuously deferred by further calls to lws_set_timer_usecs() with a later
+ * deadline, or cancelled by lws_set_timer_usecs(wsi, -1).
+ *
+ * If the timer should repeat, lws_set_timer_usecs() must be called again from
+ * LWS_CALLBACK_TIMER.
+ *
+ * Accuracy depends on the platform and the load on the event loop or system...
+ * all that's guaranteed is the callback will come after the requested wait
+ * period.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs);
+
+/*
+ * lws_timed_callback_vh_protocol() - calls back a protocol on a vhost after
+ * the specified delay
+ *
+ * \param vh: the vhost to call back
+ * \param protocol: the protocol to call back
+ * \param reason: callback reason
+ * \param secs: how many seconds in the future to do the callback. Set to
+ * -1 to cancel the timer callback.
+ *
+ * Callback the specified protocol with a fake wsi pointing to the specified
+ * vhost and protocol, with the specified reason, at the specified time in the
+ * future.
+ *
+ * Returns 0 if OK.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_timed_callback_vh_protocol(struct lws_vhost *vh,
+ const struct lws_protocols *prot,
+ int reason, int secs);
+///@}
+
+/*! \defgroup sending-data Sending data
+
+ APIs related to writing data on a connection
+*/
+//@{
+#if !defined(LWS_SIZEOFPTR)
+#define LWS_SIZEOFPTR ((int)sizeof (void *))
+#endif
+
+#if defined(__x86_64__)
+#define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
+#else
+#define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
+#endif
+#define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? \
+ ((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
+/* last 2 is for lws-meta */
+#define LWS_PRE _LWS_PAD(4 + 10 + 2)
+/* used prior to 1.7 and retained for backward compatibility */
+#define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
+#define LWS_SEND_BUFFER_POST_PADDING 0
+
+#define LWS_WRITE_RAW LWS_WRITE_HTTP
+
+/*
+ * NOTE: These public enums are part of the abi. If you want to add one,
+ * add it at where specified so existing users are unaffected.
+ */
+enum lws_write_protocol {
+ LWS_WRITE_TEXT = 0,
+ /**< Send a ws TEXT message,the pointer must have LWS_PRE valid
+ * memory behind it. The receiver expects only valid utf-8 in the
+ * payload */
+ LWS_WRITE_BINARY = 1,
+ /**< Send a ws BINARY message, the pointer must have LWS_PRE valid
+ * memory behind it. Any sequence of bytes is valid */
+ LWS_WRITE_CONTINUATION = 2,
+ /**< Continue a previous ws message, the pointer must have LWS_PRE valid
+ * memory behind it */
+ LWS_WRITE_HTTP = 3,
+ /**< Send HTTP content */
+
+ /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
+ LWS_WRITE_PING = 5,
+ LWS_WRITE_PONG = 6,
+
+ /* Same as write_http but we know this write ends the transaction */
+ LWS_WRITE_HTTP_FINAL = 7,
+
+ /* HTTP2 */
+
+ LWS_WRITE_HTTP_HEADERS = 8,
+ /**< Send http headers (http2 encodes this payload and LWS_WRITE_HTTP
+ * payload differently, http 1.x links also handle this correctly. so
+ * to be compatible with both in the future,header response part should
+ * be sent using this regardless of http version expected)
+ */
+ LWS_WRITE_HTTP_HEADERS_CONTINUATION = 9,
+ /**< Continuation of http/2 headers
+ */
+
+ /****** add new things just above ---^ ******/
+
+ /* flags */
+
+ LWS_WRITE_NO_FIN = 0x40,
+ /**< This part of the message is not the end of the message */
+
+ LWS_WRITE_H2_STREAM_END = 0x80,
+ /**< Flag indicates this packet should go out with STREAM_END if h2
+ * STREAM_END is allowed on DATA or HEADERS.
+ */
+
+ LWS_WRITE_CLIENT_IGNORE_XOR_MASK = 0x80
+ /**< client packet payload goes out on wire unmunged
+ * only useful for security tests since normal servers cannot
+ * decode the content if used */
+};
+
+/* used with LWS_CALLBACK_CHILD_WRITE_VIA_PARENT */
+
+struct lws_write_passthru {
+ struct lws *wsi;
+ unsigned char *buf;
+ size_t len;
+ enum lws_write_protocol wp;
+};
+
+
+/**
+ * lws_write() - Apply protocol then write data to client
+ * \param wsi: Websocket instance (available from user callback)
+ * \param buf: The data to send. For data being sent on a websocket
+ * connection (ie, not default http), this buffer MUST have
+ * LWS_PRE bytes valid BEFORE the pointer.
+ * This is so the protocol header data can be added in-situ.
+ * \param len: Count of the data bytes in the payload starting from buf
+ * \param protocol: Use LWS_WRITE_HTTP to reply to an http connection, and one
+ * of LWS_WRITE_BINARY or LWS_WRITE_TEXT to send appropriate
+ * data on a websockets connection. Remember to allow the extra
+ * bytes before and after buf if LWS_WRITE_BINARY or LWS_WRITE_TEXT
+ * are used.
+ *
+ * This function provides the way to issue data back to the client
+ * for both http and websocket protocols.
+ *
+ * IMPORTANT NOTICE!
+ *
+ * When sending with websocket protocol
+ *
+ * LWS_WRITE_TEXT,
+ * LWS_WRITE_BINARY,
+ * LWS_WRITE_CONTINUATION,
+ * LWS_WRITE_PING,
+ * LWS_WRITE_PONG
+ *
+ * the send buffer has to have LWS_PRE bytes valid BEFORE
+ * the buffer pointer you pass to lws_write().
+ *
+ * This allows us to add protocol info before and after the data, and send as
+ * one packet on the network without payload copying, for maximum efficiency.
+ *
+ * So for example you need this kind of code to use lws_write with a
+ * 128-byte payload
+ *
+ * char buf[LWS_PRE + 128];
+ *
+ * // fill your part of the buffer... for example here it's all zeros
+ * memset(&buf[LWS_PRE], 0, 128);
+ *
+ * lws_write(wsi, &buf[LWS_PRE], 128, LWS_WRITE_TEXT);
+ *
+ * When sending HTTP, with
+ *
+ * LWS_WRITE_HTTP,
+ * LWS_WRITE_HTTP_HEADERS
+ * LWS_WRITE_HTTP_FINAL
+ *
+ * there is no protocol data prepended, and don't need to take care about the
+ * LWS_PRE bytes valid before the buffer pointer.
+ *
+ * LWS_PRE is at least the frame nonce + 2 header + 8 length
+ * LWS_SEND_BUFFER_POST_PADDING is deprecated, it's now 0 and can be left off.
+ * The example apps no longer use it.
+ *
+ * Pad LWS_PRE to the CPU word size, so that word references
+ * to the address immediately after the padding won't cause an unaligned access
+ * error. Sometimes for performance reasons the recommended padding is even
+ * larger than sizeof(void *).
+ *
+ * In the case of sending using websocket protocol, be sure to allocate
+ * valid storage before and after buf as explained above. This scheme
+ * allows maximum efficiency of sending data and protocol in a single
+ * packet while not burdening the user code with any protocol knowledge.
+ *
+ * Return may be -1 for a fatal error needing connection close, or the
+ * number of bytes sent.
+ *
+ * Truncated Writes
+ * ================
+ *
+ * The OS may not accept everything you asked to write on the connection.
+ *
+ * Posix defines POLLOUT indication from poll() to show that the connection
+ * will accept more write data, but it doesn't specifiy how much. It may just
+ * accept one byte of whatever you wanted to send.
+ *
+ * LWS will buffer the remainder automatically, and send it out autonomously.
+ *
+ * During that time, WRITABLE callbacks will be suppressed.
+ *
+ * This is to handle corner cases where unexpectedly the OS refuses what we
+ * usually expect it to accept. You should try to send in chunks that are
+ * almost always accepted in order to avoid the inefficiency of the buffering.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_write(struct lws *wsi, unsigned char *buf, size_t len,
+ enum lws_write_protocol protocol);
+
+/* helper for case where buffer may be const */
+#define lws_write_http(wsi, buf, len) \
+ lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
+
+/* helper for multi-frame ws message flags */
+static LWS_INLINE int
+lws_write_ws_flags(int initial, int is_start, int is_end)
+{
+ int r;
+
+ if (is_start)
+ r = initial;
+ else
+ r = LWS_WRITE_CONTINUATION;
+
+ if (!is_end)
+ r |= LWS_WRITE_NO_FIN;
+
+ return r;
+}
+///@}
+
+/** \defgroup callback-when-writeable Callback when writeable
+ *
+ * ##Callback When Writeable
+ *
+ * lws can only write data on a connection when it is able to accept more
+ * data without blocking.
+ *
+ * So a basic requirement is we should only use the lws_write() apis when the
+ * connection we want to write on says that he can accept more data.
+ *
+ * When lws cannot complete your send at the time, it will buffer the data
+ * and send it in the background, suppressing any further WRITEABLE callbacks
+ * on that connection until it completes. So it is important to write new
+ * things in a new writeable callback.
+ *
+ * These apis reflect the various ways we can indicate we would like to be
+ * called back when one or more connections is writeable.
+ */
+///@{
+
+/**
+ * lws_callback_on_writable() - Request a callback when this socket
+ * becomes able to be written to without
+ * blocking
+ *
+ * \param wsi: Websocket connection instance to get callback for
+ *
+ * - Which: only this wsi
+ * - When: when the individual connection becomes writeable
+ * - What: LWS_CALLBACK_*_WRITEABLE
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_on_writable(struct lws *wsi);
+
+/**
+ * lws_callback_on_writable_all_protocol() - Request a callback for all
+ * connections using the given protocol when it
+ * becomes possible to write to each socket without
+ * blocking in turn.
+ *
+ * \param context: lws_context
+ * \param protocol: Protocol whose connections will get callbacks
+ *
+ * - Which: connections using this protocol on ANY VHOST
+ * - When: when the individual connection becomes writeable
+ * - What: LWS_CALLBACK_*_WRITEABLE
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_on_writable_all_protocol(const struct lws_context *context,
+ const struct lws_protocols *protocol);
+
+/**
+ * lws_callback_on_writable_all_protocol_vhost() - Request a callback for
+ * all connections on same vhost using the given protocol
+ * when it becomes possible to write to each socket without
+ * blocking in turn.
+ *
+ * \param vhost: Only consider connections on this lws_vhost
+ * \param protocol: Protocol whose connections will get callbacks
+ *
+ * - Which: connections using this protocol on GIVEN VHOST ONLY
+ * - When: when the individual connection becomes writeable
+ * - What: LWS_CALLBACK_*_WRITEABLE
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
+ const struct lws_protocols *protocol);
+
+/**
+ * lws_callback_all_protocol() - Callback all connections using
+ * the given protocol with the given reason
+ *
+ * \param context: lws_context
+ * \param protocol: Protocol whose connections will get callbacks
+ * \param reason: Callback reason index
+ *
+ * - Which: connections using this protocol on ALL VHOSTS
+ * - When: before returning
+ * - What: reason
+ *
+ * This isn't normally what you want... normally any update of connection-
+ * specific information can wait until a network-related callback like rx,
+ * writable, or close.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_all_protocol(struct lws_context *context,
+ const struct lws_protocols *protocol, int reason);
+
+/**
+ * lws_callback_all_protocol_vhost() - Callback all connections using
+ * the given protocol with the given reason. This is
+ * deprecated since v2.4: use lws_callback_all_protocol_vhost_args
+ *
+ * \param vh: Vhost whose connections will get callbacks
+ * \param protocol: Which protocol to match. NULL means all.
+ * \param reason: Callback reason index
+ *
+ * - Which: connections using this protocol on GIVEN VHOST ONLY
+ * - When: now
+ * - What: reason
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_all_protocol_vhost(struct lws_vhost *vh,
+ const struct lws_protocols *protocol, int reason)
+LWS_WARN_DEPRECATED;
+
+/**
+ * lws_callback_all_protocol_vhost_args() - Callback all connections using
+ * the given protocol with the given reason and args
+ *
+ * \param vh: Vhost whose connections will get callbacks
+ * \param protocol: Which protocol to match. NULL means all.
+ * \param reason: Callback reason index
+ * \param argp: Callback "in" parameter
+ * \param len: Callback "len" parameter
+ *
+ * - Which: connections using this protocol on GIVEN VHOST ONLY
+ * - When: now
+ * - What: reason
+ */
+LWS_VISIBLE int
+lws_callback_all_protocol_vhost_args(struct lws_vhost *vh,
+ const struct lws_protocols *protocol, int reason,
+ void *argp, size_t len);
+
+/**
+ * lws_callback_vhost_protocols() - Callback all protocols enabled on a vhost
+ * with the given reason
+ *
+ * \param wsi: wsi whose vhost will get callbacks
+ * \param reason: Callback reason index
+ * \param in: in argument to callback
+ * \param len: len argument to callback
+ *
+ * - Which: connections using this protocol on same VHOST as wsi ONLY
+ * - When: now
+ * - What: reason
+ *
+ * This is deprecated since v2.5, use lws_callback_vhost_protocols_vhost()
+ * which takes the pointer to the vhost directly without using or needing the
+ * wsi.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len)
+LWS_WARN_DEPRECATED;
+
+/**
+ * lws_callback_vhost_protocols_vhost() - Callback all protocols enabled on a vhost
+ * with the given reason
+ *
+ * \param vh: vhost that will get callbacks
+ * \param reason: Callback reason index
+ * \param in: in argument to callback
+ * \param len: len argument to callback
+ *
+ * - Which: connections using this protocol on same VHOST as wsi ONLY
+ * - When: now
+ * - What: reason
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_vhost_protocols_vhost(struct lws_vhost *vh, int reason, void *in,
+ size_t len);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
+ void *user, void *in, size_t len);
+
+/**
+ * lws_get_socket_fd() - returns the socket file descriptor
+ *
+ * This is needed to use sendto() on UDP raw sockets
+ *
+ * \param wsi: Websocket connection instance
+ */
+LWS_VISIBLE LWS_EXTERN lws_sockfd_type
+lws_get_socket_fd(struct lws *wsi);
+
+/**
+ * lws_get_peer_write_allowance() - get the amount of data writeable to peer
+ * if known
+ *
+ * \param wsi: Websocket connection instance
+ *
+ * if the protocol does not have any guidance, returns -1. Currently only
+ * http2 connections get send window information from this API. But your code
+ * should use it so it can work properly with any protocol.
+ *
+ * If nonzero return is the amount of payload data the peer or intermediary has
+ * reported it has buffer space for. That has NO relationship with the amount
+ * of buffer space your OS can accept on this connection for a write action.
+ *
+ * This number represents the maximum you could send to the peer or intermediary
+ * on this connection right now without the protocol complaining.
+ *
+ * lws manages accounting for send window updates and payload writes
+ * automatically, so this number reflects the situation at the peer or
+ * intermediary dynamically.
+ */
+LWS_VISIBLE LWS_EXTERN lws_fileofs_t
+lws_get_peer_write_allowance(struct lws *wsi);
+///@}
+
+enum {
+ /*
+ * Flags for enable and disable rxflow with reason bitmap and with
+ * backwards-compatible single bool
+ */
+ LWS_RXFLOW_REASON_USER_BOOL = (1 << 0),
+ LWS_RXFLOW_REASON_HTTP_RXBUFFER = (1 << 6),
+ LWS_RXFLOW_REASON_H2_PPS_PENDING = (1 << 7),
+
+ LWS_RXFLOW_REASON_APPLIES = (1 << 14),
+ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT = (1 << 13),
+ LWS_RXFLOW_REASON_APPLIES_ENABLE = LWS_RXFLOW_REASON_APPLIES |
+ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT,
+ LWS_RXFLOW_REASON_APPLIES_DISABLE = LWS_RXFLOW_REASON_APPLIES,
+ LWS_RXFLOW_REASON_FLAG_PROCESS_NOW = (1 << 12),
+
+};
+
+/**
+ * lws_rx_flow_control() - Enable and disable socket servicing for
+ * received packets.
+ *
+ * If the output side of a server process becomes choked, this allows flow
+ * control for the input side.
+ *
+ * \param wsi: Websocket connection instance to get callback for
+ * \param enable: 0 = disable read servicing for this connection, 1 = enable
+ *
+ * If you need more than one additive reason for rxflow control, you can give
+ * iLWS_RXFLOW_REASON_APPLIES_ENABLE or _DISABLE together with one or more of
+ * b5..b0 set to idicate which bits to enable or disable. If any bits are
+ * enabled, rx on the connection is suppressed.
+ *
+ * LWS_RXFLOW_REASON_FLAG_PROCESS_NOW flag may also be given to force any change
+ * in rxflowbstatus to benapplied immediately, this should be used when you are
+ * changing a wsi flow control state from outside a callback on that wsi.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_rx_flow_control(struct lws *wsi, int enable);
+
+/**
+ * lws_rx_flow_allow_all_protocol() - Allow all connections with this protocol to receive
+ *
+ * When the user server code realizes it can accept more input, it can
+ * call this to have the RX flow restriction removed from all connections using
+ * the given protocol.
+ * \param context: lws_context
+ * \param protocol: all connections using this protocol will be allowed to receive
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_rx_flow_allow_all_protocol(const struct lws_context *context,
+ const struct lws_protocols *protocol);
+
+/**
+ * lws_remaining_packet_payload() - Bytes to come before "overall"
+ * rx fragment is complete
+ * \param wsi: Websocket instance (available from user callback)
+ *
+ * This tracks how many bytes are left in the current ws fragment, according
+ * to the ws length given in the fragment header.
+ *
+ * If the message was in a single fragment, and there is no compression, this
+ * is the same as "how much data is left to read for this message".
+ *
+ * However, if the message is being sent in multiple fragments, this will
+ * reflect the unread amount of the current **fragment**, not the message. With
+ * ws, it is legal to not know the length of the message before it completes.
+ *
+ * Additionally if the message is sent via the negotiated permessage-deflate
+ * extension, this number only tells the amount of **compressed** data left to
+ * be read, since that is the only information available at the ws layer.
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_remaining_packet_payload(struct lws *wsi);
+
+
+/** \defgroup sock-adopt Socket adoption helpers
+ * ##Socket adoption helpers
+ *
+ * When integrating with an external app with its own event loop, these can
+ * be used to accept connections from someone else's listening socket.
+ *
+ * When using lws own event loop, these are not needed.
+ */
+///@{
+
+/**
+ * lws_adopt_socket() - adopt foreign socket as if listen socket accepted it
+ * for the default vhost of context.
+ *
+ * \param context: lws context
+ * \param accept_fd: fd of already-accepted socket to adopt
+ *
+ * Either returns new wsi bound to accept_fd, or closes accept_fd and
+ * returns NULL, having cleaned up any new wsi pieces.
+ *
+ * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
+ * to ws or just serve http.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd);
+/**
+ * lws_adopt_socket_vhost() - adopt foreign socket as if listen socket accepted it
+ * for vhost
+ *
+ * \param vh: lws vhost
+ * \param accept_fd: fd of already-accepted socket to adopt
+ *
+ * Either returns new wsi bound to accept_fd, or closes accept_fd and
+ * returns NULL, having cleaned up any new wsi pieces.
+ *
+ * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
+ * to ws or just serve http.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd);
+
+typedef enum {
+ LWS_ADOPT_RAW_FILE_DESC = 0, /* convenience constant */
+ LWS_ADOPT_HTTP = 1, /* flag: absent implies RAW */
+ LWS_ADOPT_SOCKET = 2, /* flag: absent implies file descr */
+ LWS_ADOPT_ALLOW_SSL = 4, /* flag: if set requires LWS_ADOPT_SOCKET */
+ LWS_ADOPT_WS_PARENTIO = 8, /* flag: ws mode parent handles IO
+ * if given must be only flag
+ * wsi put directly into ws mode */
+ LWS_ADOPT_FLAG_UDP = 16, /* flag: socket is UDP */
+
+ LWS_ADOPT_RAW_SOCKET_UDP = LWS_ADOPT_SOCKET | LWS_ADOPT_FLAG_UDP,
+} lws_adoption_type;
+
+typedef union {
+ lws_sockfd_type sockfd;
+ lws_filefd_type filefd;
+} lws_sock_file_fd_type;
+
+#if !defined(LWS_WITH_ESP32)
+struct lws_udp {
+ struct sockaddr sa;
+ socklen_t salen;
+
+ struct sockaddr sa_pending;
+ socklen_t salen_pending;
+};
+#endif
+
+/*
+* lws_adopt_descriptor_vhost() - adopt foreign socket or file descriptor
+* if socket descriptor, should already have been accepted from listen socket
+*
+* \param vhost: lws vhost
+* \param type: OR-ed combinations of lws_adoption_type flags
+* \param fd: union with either .sockfd or .filefd set
+* \param vh_prot_name: NULL or vh protocol name to bind raw connection to
+* \param parent: NULL or struct lws to attach new_wsi to as a child
+*
+* Either returns new wsi bound to accept_fd, or closes accept_fd and
+* returns NULL, having cleaned up any new wsi pieces.
+*
+* If LWS_ADOPT_SOCKET is set, LWS adopts the socket in http serving mode, it's
+* ready to accept an upgrade to ws or just serve http.
+*
+* parent may be NULL, if given it should be an existing wsi that will become the
+* parent of the new wsi created by this call.
+*/
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
+ lws_sock_file_fd_type fd, const char *vh_prot_name,
+ struct lws *parent);
+
+/**
+ * lws_adopt_socket_readbuf() - adopt foreign socket and first rx as if listen socket accepted it
+ * for the default vhost of context.
+ * \param context: lws context
+ * \param accept_fd: fd of already-accepted socket to adopt
+ * \param readbuf: NULL or pointer to data that must be drained before reading from
+ * accept_fd
+ * \param len: The length of the data held at \param readbuf
+ *
+ * Either returns new wsi bound to accept_fd, or closes accept_fd and
+ * returns NULL, having cleaned up any new wsi pieces.
+ *
+ * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
+ * to ws or just serve http.
+ *
+ * If your external code did not already read from the socket, you can use
+ * lws_adopt_socket() instead.
+ *
+ * This api is guaranteed to use the data at \param readbuf first, before reading from
+ * the socket.
+ *
+ * readbuf is limited to the size of the ah rx buf, currently 2048 bytes.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
+ const char *readbuf, size_t len);
+/**
+ * lws_adopt_socket_vhost_readbuf() - adopt foreign socket and first rx as if listen socket
+ * accepted it for vhost.
+ * \param vhost: lws vhost
+ * \param accept_fd: fd of already-accepted socket to adopt
+ * \param readbuf: NULL or pointer to data that must be drained before reading from
+ * accept_fd
+ * \param len: The length of the data held at \param readbuf
+ *
+ * Either returns new wsi bound to accept_fd, or closes accept_fd and
+ * returns NULL, having cleaned up any new wsi pieces.
+ *
+ * LWS adopts the socket in http serving mode, it's ready to accept an upgrade
+ * to ws or just serve http.
+ *
+ * If your external code did not already read from the socket, you can use
+ * lws_adopt_socket() instead.
+ *
+ * This api is guaranteed to use the data at \param readbuf first, before reading from
+ * the socket.
+ *
+ * readbuf is limited to the size of the ah rx buf, currently 2048 bytes.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost, lws_sockfd_type accept_fd,
+ const char *readbuf, size_t len);
+
+#define LWS_CAUDP_BIND 1
+
+/**
+ * lws_create_adopt_udp() - create, bind and adopt a UDP socket
+ *
+ * \param vhost: lws vhost
+ * \param port: UDP port to bind to, -1 means unbound
+ * \param flags: 0 or LWS_CAUDP_NO_BIND
+ * \param protocol_name: Name of protocol on vhost to bind wsi to
+ * \param parent_wsi: NULL or parent wsi new wsi will be a child of
+ *
+ * Either returns new wsi bound to accept_fd, or closes accept_fd and
+ * returns NULL, having cleaned up any new wsi pieces.
+ * */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_create_adopt_udp(struct lws_vhost *vhost, int port, int flags,
+ const char *protocol_name, struct lws *parent_wsi);
+///@}
+
+/** \defgroup net Network related helper APIs
+ * ##Network related helper APIs
+ *
+ * These wrap miscellaneous useful network-related functions
+ */
+///@{
+
+/**
+ * lws_canonical_hostname() - returns this host's hostname
+ *
+ * This is typically used by client code to fill in the host parameter
+ * when making a client connection. You can only call it after the context
+ * has been created.
+ *
+ * \param context: Websocket context
+ */
+LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
+lws_canonical_hostname(struct lws_context *context);
+
+/**
+ * lws_get_peer_addresses() - Get client address information
+ * \param wsi: Local struct lws associated with
+ * \param fd: Connection socket descriptor
+ * \param name: Buffer to take client address name
+ * \param name_len: Length of client address name buffer
+ * \param rip: Buffer to take client address IP dotted quad
+ * \param rip_len: Length of client address IP buffer
+ *
+ * This function fills in name and rip with the name and IP of
+ * the client connected with socket descriptor fd. Names may be
+ * truncated if there is not enough room. If either cannot be
+ * determined, they will be returned as valid zero-length strings.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
+ int name_len, char *rip, int rip_len);
+
+/**
+ * lws_get_peer_simple() - Get client address information without RDNS
+ *
+ * \param wsi: Local struct lws associated with
+ * \param name: Buffer to take client address name
+ * \param namelen: Length of client address name buffer
+ *
+ * This provides a 123.123.123.123 type IP address in name from the
+ * peer that has connected to wsi
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_peer_simple(struct lws *wsi, char *name, int namelen);
+
+
+#define LWS_ITOSA_NOT_EXIST -1
+#define LWS_ITOSA_NOT_USABLE -2
+#define LWS_ITOSA_USABLE 0
+#if !defined(LWS_WITH_ESP32)
+/**
+ * lws_interface_to_sa() - Convert interface name or IP to sockaddr struct
+ *
+ * \param ipv6: Allow IPV6 addresses
+ * \param ifname: Interface name or IP
+ * \param addr: struct sockaddr_in * to be written
+ * \param addrlen: Length of addr
+ *
+ * This converts a textual network interface name to a sockaddr usable by
+ * other network functions.
+ *
+ * If the network interface doesn't exist, it will return LWS_ITOSA_NOT_EXIST.
+ *
+ * If the network interface is not usable, eg ethernet cable is removed, it
+ * may logically exist but not have any IP address. As such it will return
+ * LWS_ITOSA_NOT_USABLE.
+ *
+ * If the network interface exists and is usable, it will return
+ * LWS_ITOSA_USABLE.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
+ size_t addrlen);
+///@}
+#endif
+
+/** \defgroup misc Miscellaneous APIs
+* ##Miscellaneous APIs
+*
+* Various APIs outside of other categories
+*/
+///@{
+
+/**
+ * lws_start_foreach_ll(): linkedlist iterator helper start
+ *
+ * \param type: type of iteration, eg, struct xyz *
+ * \param it: iterator var name to create
+ * \param start: start of list
+ *
+ * This helper creates an iterator and starts a while (it) {
+ * loop. The iterator runs through the linked list starting at start and
+ * ends when it gets a NULL.
+ * The while loop should be terminated using lws_start_foreach_ll().
+ */
+#define lws_start_foreach_ll(type, it, start)\
+{ \
+ type it = start; \
+ while (it) {
+
+/**
+ * lws_end_foreach_ll(): linkedlist iterator helper end
+ *
+ * \param it: same iterator var name given when starting
+ * \param nxt: member name in the iterator pointing to next list element
+ *
+ * This helper is the partner for lws_start_foreach_ll() that ends the
+ * while loop.
+ */
+
+#define lws_end_foreach_ll(it, nxt) \
+ it = it->nxt; \
+ } \
+}
+
+/**
+ * lws_start_foreach_llp(): linkedlist pointer iterator helper start
+ *
+ * \param type: type of iteration, eg, struct xyz **
+ * \param it: iterator var name to create
+ * \param start: start of list
+ *
+ * This helper creates an iterator and starts a while (it) {
+ * loop. The iterator runs through the linked list starting at the
+ * address of start and ends when it gets a NULL.
+ * The while loop should be terminated using lws_start_foreach_llp().
+ *
+ * This helper variant iterates using a pointer to the previous linked-list
+ * element. That allows you to easily delete list members by rewriting the
+ * previous pointer to the element's next pointer.
+ */
+#define lws_start_foreach_llp(type, it, start)\
+{ \
+ type it = &(start); \
+ while (*(it)) {
+
+#define lws_start_foreach_llp_safe(type, it, start, nxt)\
+{ \
+ type it = &(start); \
+ type next; \
+ while (*(it)) { \
+ next = &((*(it))->nxt); \
+
+/**
+ * lws_end_foreach_llp(): linkedlist pointer iterator helper end
+ *
+ * \param it: same iterator var name given when starting
+ * \param nxt: member name in the iterator pointing to next list element
+ *
+ * This helper is the partner for lws_start_foreach_llp() that ends the
+ * while loop.
+ */
+
+#define lws_end_foreach_llp(it, nxt) \
+ it = &(*(it))->nxt; \
+ } \
+}
+
+#define lws_end_foreach_llp_safe(it) \
+ it = next; \
+ } \
+}
+
+#define lws_ll_fwd_insert(\
+ ___new_object, /* pointer to new object */ \
+ ___m_list, /* member for next list object ptr */ \
+ ___list_head /* list head */ \
+ ) {\
+ ___new_object->___m_list = ___list_head; \
+ ___list_head = ___new_object; \
+ }
+
+#define lws_ll_fwd_remove(\
+ ___type, /* type of listed object */ \
+ ___m_list, /* member for next list object ptr */ \
+ ___target, /* object to remove from list */ \
+ ___list_head /* list head */ \
+ ) { \
+ lws_start_foreach_llp(___type **, ___ppss, ___list_head) { \
+ if (*___ppss == ___target) { \
+ *___ppss = ___target->___m_list; \
+ break; \
+ } \
+ } lws_end_foreach_llp(___ppss, ___m_list); \
+ }
+
+/*
+ * doubly linked-list
+ */
+
+struct lws_dll { /* abstract */
+ struct lws_dll *prev;
+ struct lws_dll *next;
+};
+
+/*
+ * these all point to the composed list objects... you have to use the
+ * lws_container_of() helper to recover the start of the containing struct
+ */
+
+LWS_VISIBLE LWS_EXTERN void
+lws_dll_add_front(struct lws_dll *d, struct lws_dll *phead);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_dll_remove(struct lws_dll *d);
+
+struct lws_dll_lws { /* typed as struct lws * */
+ struct lws_dll_lws *prev;
+ struct lws_dll_lws *next;
+};
+
+#define lws_dll_is_null(___dll) (!(___dll)->prev && !(___dll)->next)
+
+static LWS_INLINE void
+lws_dll_lws_add_front(struct lws_dll_lws *_a, struct lws_dll_lws *_head)
+{
+ lws_dll_add_front((struct lws_dll *)_a, (struct lws_dll *)_head);
+}
+
+static LWS_INLINE void
+lws_dll_lws_remove(struct lws_dll_lws *_a)
+{
+ lws_dll_remove((struct lws_dll *)_a);
+}
+
+/*
+ * these are safe against the current container object getting deleted,
+ * since the hold his next in a temp and go to that next. ___tmp is
+ * the temp.
+ */
+
+#define lws_start_foreach_dll_safe(___type, ___it, ___tmp, ___start) \
+{ \
+ ___type ___it = ___start; \
+ while (___it) { \
+ ___type ___tmp = (___it)->next;
+
+#define lws_end_foreach_dll_safe(___it, ___tmp) \
+ ___it = ___tmp; \
+ } \
+}
+
+#define lws_start_foreach_dll(___type, ___it, ___start) \
+{ \
+ ___type ___it = ___start; \
+ while (___it) {
+
+#define lws_end_foreach_dll(___it) \
+ ___it = (___it)->next; \
+ } \
+}
+
+struct lws_buflist;
+
+/**
+ * lws_buflist_append_segment(): add buffer to buflist at head
+ *
+ * \param head: list head
+ * \param buf: buffer to stash
+ * \param len: length of buffer to stash
+ *
+ * Returns -1 on OOM, 1 if this was the first segment on the list, and 0 if
+ * it was a subsequent segment.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
+ size_t len);
+/**
+ * lws_buflist_next_segment_len(): number of bytes left in current segment
+ *
+ * \param head: list head
+ * \param buf: if non-NULL, *buf is written with the address of the start of
+ * the remaining data in the segment
+ *
+ * Returns the number of bytes left in the current segment. 0 indicates
+ * that the buflist is empty (there are no segments on the buflist).
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf);
+/**
+ * lws_buflist_use_segment(): remove len bytes from the current segment
+ *
+ * \param head: list head
+ * \param len: number of bytes to mark as used
+ *
+ * If len is less than the remaining length of the current segment, the position
+ * in the current segment is simply advanced and it returns.
+ *
+ * If len uses up the remaining length of the current segment, then the segment
+ * is deleted and the list head moves to the next segment if any.
+ *
+ * Returns the number of bytes left in the current segment. 0 indicates
+ * that the buflist is empty (there are no segments on the buflist).
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_buflist_use_segment(struct lws_buflist **head, size_t len);
+/**
+ * lws_buflist_destroy_all_segments(): free all segments on the list
+ *
+ * \param head: list head
+ *
+ * This frees everything on the list unconditionally. *head is always
+ * NULL after this.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_buflist_destroy_all_segments(struct lws_buflist **head);
+
+void
+lws_buflist_describe(struct lws_buflist **head, void *id);
+
+/**
+ * lws_ptr_diff(): helper to report distance between pointers as an int
+ *
+ * \param head: the pointer with the larger address
+ * \param tail: the pointer with the smaller address
+ *
+ * This helper gives you an int representing the number of bytes further
+ * forward the first pointer is compared to the second pointer.
+ */
+#define lws_ptr_diff(head, tail) \
+ ((int)((char *)(head) - (char *)(tail)))
+
+/**
+ * lws_snprintf(): snprintf that truncates the returned length too
+ *
+ * \param str: destination buffer
+ * \param size: bytes left in destination buffer
+ * \param format: format string
+ * \param ...: args for format
+ *
+ * This lets you correctly truncate buffers by concatenating lengths, if you
+ * reach the limit the reported length doesn't exceed the limit.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
+
+/**
+ * lws_strncpy(): strncpy that guarantees NUL on truncated copy
+ *
+ * \param dest: destination buffer
+ * \param src: source buffer
+ * \param size: bytes left in destination buffer
+ *
+ * This lets you correctly truncate buffers by concatenating lengths, if you
+ * reach the limit the reported length doesn't exceed the limit.
+ */
+LWS_VISIBLE LWS_EXTERN char *
+lws_strncpy(char *dest, const char *src, size_t size);
+
+/**
+ * lws_get_random(): fill a buffer with platform random data
+ *
+ * \param context: the lws context
+ * \param buf: buffer to fill
+ * \param len: how much to fill
+ *
+ * This is intended to be called from the LWS_CALLBACK_RECEIVE callback if
+ * it's interested to see if the frame it's dealing with was sent in binary
+ * mode.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_get_random(struct lws_context *context, void *buf, int len);
+/**
+ * lws_daemonize(): make current process run in the background
+ *
+ * \param _lock_path: the filepath to write the lock file
+ *
+ * Spawn lws as a background process, taking care of various things
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_daemonize(const char *_lock_path);
+/**
+ * lws_get_library_version(): return string describing the version of lws
+ *
+ * On unix, also includes the git describe
+ */
+LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
+lws_get_library_version(void);
+
+/**
+ * lws_wsi_user() - get the user data associated with the connection
+ * \param wsi: lws connection
+ *
+ * Not normally needed since it's passed into the callback
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_wsi_user(struct lws *wsi);
+
+/**
+ * lws_wsi_set_user() - set the user data associated with the client connection
+ * \param wsi: lws connection
+ * \param user: user data
+ *
+ * By default lws allocates this and it's not legal to externally set it
+ * yourself. However client connections may have it set externally when the
+ * connection is created... if so, this api can be used to modify it at
+ * runtime additionally.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_set_wsi_user(struct lws *wsi, void *user);
+
+/**
+ * lws_parse_uri: cut up prot:/ads:port/path into pieces
+ * Notice it does so by dropping '\0' into input string
+ * and the leading / on the path is consequently lost
+ *
+ * \param p: incoming uri string.. will get written to
+ * \param prot: result pointer for protocol part (https://)
+ * \param ads: result pointer for address part
+ * \param port: result pointer for port part
+ * \param path: result pointer for path part
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
+ const char **path);
+/**
+ * lws_cmdline_option(): simple commandline parser
+ *
+ * \param argc: count of argument strings
+ * \param argv: argument strings
+ * \param val: string to find
+ *
+ * Returns NULL if the string \p val is not found in the arguments.
+ *
+ * If it is found, then it returns a pointer to the next character after \p val.
+ * So if \p val is "-d", then for the commandlines "myapp -d15" and
+ * "myapp -d 15", in both cases the return will point to the "15".
+ *
+ * In the case there is no argument, like "myapp -d", the return will
+ * either point to the '\\0' at the end of -d, or to the start of the
+ * next argument, ie, will be non-NULL.
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_cmdline_option(int argc, const char **argv, const char *val);
+
+/**
+ * lws_now_secs(): return seconds since 1970-1-1
+ */
+LWS_VISIBLE LWS_EXTERN unsigned long
+lws_now_secs(void);
+
+/**
+ * lws_compare_time_t(): return relationship between two time_t
+ *
+ * \param context: struct lws_context
+ * \param t1: time_t 1
+ * \param t2: time_t 2
+ *
+ * returns <0 if t2 > t1; >0 if t1 > t2; or == 0 if t1 == t2.
+ *
+ * This is aware of clock discontiguities that may have affected either t1 or
+ * t2 and adapts the comparison for them.
+ *
+ * For the discontiguity detection to work, you must avoid any arithmetic on
+ * the times being compared. For example to have a timeout that triggers
+ * 15s from when it was set, store the time it was set and compare like
+ * `if (lws_compare_time_t(context, now, set_time) > 15)`
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_compare_time_t(struct lws_context *context, time_t t1, time_t t2);
+
+/**
+ * lws_get_context - Allow getting lws_context from a Websocket connection
+ * instance
+ *
+ * With this function, users can access context in the callback function.
+ * Otherwise users may have to declare context as a global variable.
+ *
+ * \param wsi: Websocket connection instance
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
+lws_get_context(const struct lws *wsi);
+
+/**
+ * lws_get_vhost_listen_port - Find out the port number a vhost is listening on
+ *
+ * In the case you passed 0 for the port number at context creation time, you
+ * can discover the port number that was actually chosen for the vhost using
+ * this api.
+ *
+ * \param vhost: Vhost to get listen port from
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_get_vhost_listen_port(struct lws_vhost *vhost);
+
+/**
+ * lws_get_count_threads(): how many service threads the context uses
+ *
+ * \param context: the lws context
+ *
+ * By default this is always 1, if you asked for more than lws can handle it
+ * will clip the number of threads. So you can use this to find out how many
+ * threads are actually in use.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_get_count_threads(struct lws_context *context);
+
+/**
+ * lws_get_parent() - get parent wsi or NULL
+ * \param wsi: lws connection
+ *
+ * Specialized wsi like cgi stdin/out/err are associated to a parent wsi,
+ * this allows you to get their parent.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
+lws_get_parent(const struct lws *wsi);
+
+/**
+ * lws_get_child() - get child wsi or NULL
+ * \param wsi: lws connection
+ *
+ * Allows you to find a related wsi from the parent wsi.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
+lws_get_child(const struct lws *wsi);
+
+/**
+ * lws_get_udp() - get wsi's udp struct
+ *
+ * \param wsi: lws connection
+ *
+ * Returns NULL or pointer to the wsi's UDP-specific information
+ */
+LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
+lws_get_udp(const struct lws *wsi);
+
+/**
+ * lws_parent_carries_io() - mark wsi as needing to send messages via parent
+ *
+ * \param wsi: child lws connection
+ */
+
+LWS_VISIBLE LWS_EXTERN void
+lws_set_parent_carries_io(struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN void *
+lws_get_opaque_parent_data(const struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_set_opaque_parent_data(struct lws *wsi, void *data);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_get_child_pending_on_writable(const struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_clear_child_pending_on_writable(struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_get_close_length(struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN unsigned char *
+lws_get_close_payload(struct lws *wsi);
+
+/**
+ * lws_get_network_wsi() - Returns wsi that has the tcp connection for this wsi
+ *
+ * \param wsi: wsi you have
+ *
+ * Returns wsi that has the tcp connection (which may be the incoming wsi)
+ *
+ * HTTP/1 connections will always return the incoming wsi
+ * HTTP/2 connections may return a different wsi that has the tcp connection
+ */
+LWS_VISIBLE LWS_EXTERN
+struct lws *lws_get_network_wsi(struct lws *wsi);
+
+/**
+ * lws_set_allocator() - custom allocator support
+ *
+ * \param realloc
+ *
+ * Allows you to replace the allocator (and deallocator) used by lws
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
+///@}
+
+/** \defgroup wsstatus Websocket status APIs
+ * ##Websocket connection status APIs
+ *
+ * These provide information about ws connection or message status
+ */
+///@{
+/**
+ * lws_send_pipe_choked() - tests if socket is writable or not
+ * \param wsi: lws connection
+ *
+ * Allows you to check if you can write more on the socket
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_send_pipe_choked(struct lws *wsi);
+
+/**
+ * lws_is_final_fragment() - tests if last part of ws message
+ *
+ * \param wsi: lws connection
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_is_final_fragment(struct lws *wsi);
+
+/**
+ * lws_is_first_fragment() - tests if first part of ws message
+ *
+ * \param wsi: lws connection
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_is_first_fragment(struct lws *wsi);
+
+/**
+ * lws_get_reserved_bits() - access reserved bits of ws frame
+ * \param wsi: lws connection
+ */
+LWS_VISIBLE LWS_EXTERN unsigned char
+lws_get_reserved_bits(struct lws *wsi);
+
+/**
+ * lws_partial_buffered() - find out if lws buffered the last write
+ * \param wsi: websocket connection to check
+ *
+ * Returns 1 if you cannot use lws_write because the last
+ * write on this connection is still buffered, and can't be cleared without
+ * returning to the service loop and waiting for the connection to be
+ * writeable again.
+ *
+ * If you will try to do >1 lws_write call inside a single
+ * WRITEABLE callback, you must check this after every write and bail if
+ * set, ask for a new writeable callback and continue writing from there.
+ *
+ * This is never set at the start of a writeable callback, but any write
+ * may set it.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_partial_buffered(struct lws *wsi);
+
+/**
+ * lws_frame_is_binary(): true if the current frame was sent in binary mode
+ *
+ * \param wsi: the connection we are inquiring about
+ *
+ * This is intended to be called from the LWS_CALLBACK_RECEIVE callback if
+ * it's interested to see if the frame it's dealing with was sent in binary
+ * mode.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_frame_is_binary(struct lws *wsi);
+
+/**
+ * lws_is_ssl() - Find out if connection is using SSL
+ * \param wsi: websocket connection to check
+ *
+ * Returns 0 if the connection is not using SSL, 1 if using SSL and
+ * using verified cert, and 2 if using SSL but the cert was not
+ * checked (appears for client wsi told to skip check on connection)
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_is_ssl(struct lws *wsi);
+/**
+ * lws_is_cgi() - find out if this wsi is running a cgi process
+ * \param wsi: lws connection
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_is_cgi(struct lws *wsi);
+
+
+struct lws_wifi_scan { /* generic wlan scan item */
+ struct lws_wifi_scan *next;
+ char ssid[32];
+ int32_t rssi; /* divide by .count to get db */
+ uint8_t bssid[6];
+ uint8_t count;
+ uint8_t channel;
+ uint8_t authmode;
+};
+
+#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
+/**
+ * lws_get_ssl() - Return wsi's SSL context structure
+ * \param wsi: websocket connection
+ *
+ * Returns pointer to the SSL library's context structure
+ */
+LWS_VISIBLE LWS_EXTERN SSL*
+lws_get_ssl(struct lws *wsi);
+#endif
+
+enum lws_tls_cert_info {
+ LWS_TLS_CERT_INFO_VALIDITY_FROM,
+ /**< fills .time with the time_t the cert validity started from */
+ LWS_TLS_CERT_INFO_VALIDITY_TO,
+ /**< fills .time with the time_t the cert validity ends at */
+ LWS_TLS_CERT_INFO_COMMON_NAME,
+ /**< fills up to len bytes of .ns.name with the cert common name */
+ LWS_TLS_CERT_INFO_ISSUER_NAME,
+ /**< fills up to len bytes of .ns.name with the cert issuer name */
+ LWS_TLS_CERT_INFO_USAGE,
+ /**< fills verified with a bitfield asserting the valid uses */
+ LWS_TLS_CERT_INFO_VERIFIED,
+ /**< fills .verified with a bool representing peer cert validity,
+ * call returns -1 if no cert */
+ LWS_TLS_CERT_INFO_OPAQUE_PUBLIC_KEY,
+ /**< the certificate's public key, as an opaque bytestream. These
+ * opaque bytestreams can only be compared with each other using the
+ * same tls backend, ie, OpenSSL or mbedTLS. The different backends
+ * produce different, incompatible representations for the same cert.
+ */
+};
+
+union lws_tls_cert_info_results {
+ unsigned int verified;
+ time_t time;
+ unsigned int usage;
+ struct {
+ int len;
+ /* KEEP LAST... notice the [64] is only there because
+ * name[] is not allowed in a union. The actual length of
+ * name[] is arbitrary and is passed into the api using the
+ * len parameter. Eg
+ *
+ * char big[1024];
+ * union lws_tls_cert_info_results *buf =
+ * (union lws_tls_cert_info_results *)big;
+ *
+ * lws_tls_peer_cert_info(wsi, type, buf, sizeof(big) -
+ * sizeof(*buf) + sizeof(buf->ns.name));
+ */
+ char name[64];
+ } ns;
+};
+
+/**
+ * lws_tls_peer_cert_info() - get information from the peer's TLS cert
+ *
+ * \param wsi: the connection to query
+ * \param type: one of LWS_TLS_CERT_INFO_
+ * \param buf: pointer to union to take result
+ * \param len: when result is a string, the true length of buf->ns.name[]
+ *
+ * lws_tls_peer_cert_info() lets you get hold of information from the peer
+ * certificate.
+ *
+ * Return 0 if there is a result in \p buf, or -1 indicating there was no cert
+ * or another problem.
+ *
+ * This function works the same no matter if the TLS backend is OpenSSL or
+ * mbedTLS.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_peer_cert_info(struct lws *wsi, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len);
+
+/**
+ * lws_tls_vhost_cert_info() - get information from the vhost's own TLS cert
+ *
+ * \param vhost: the vhost to query
+ * \param type: one of LWS_TLS_CERT_INFO_
+ * \param buf: pointer to union to take result
+ * \param len: when result is a string, the true length of buf->ns.name[]
+ *
+ * lws_tls_vhost_cert_info() lets you get hold of information from the vhost
+ * certificate.
+ *
+ * Return 0 if there is a result in \p buf, or -1 indicating there was no cert
+ * or another problem.
+ *
+ * This function works the same no matter if the TLS backend is OpenSSL or
+ * mbedTLS.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_vhost_cert_info(struct lws_vhost *vhost, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len);
+
+/**
+ * lws_tls_acme_sni_cert_create() - creates a temp selfsigned cert
+ * and attaches to a vhost
+ *
+ * \param vhost: the vhost to acquire the selfsigned cert
+ * \param san_a: SAN written into the certificate
+ * \param san_b: second SAN written into the certificate
+ *
+ *
+ * Returns 0 if created and attached to the vhost. Returns -1 if problems and
+ * frees all allocations before returning.
+ *
+ * On success, any allocations are destroyed at vhost destruction automatically.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
+ const char *san_b);
+
+/**
+ * lws_tls_acme_sni_csr_create() - creates a CSR and related private key PEM
+ *
+ * \param context: lws_context used for random
+ * \param elements: array of LWS_TLS_REQ_ELEMENT_COUNT const char *
+ * \param csr: buffer that will get the b64URL(ASN-1 CSR)
+ * \param csr_len: max length of the csr buffer
+ * \param privkey_pem: pointer to pointer allocated to hold the privkey_pem
+ * \param privkey_len: pointer to size_t set to the length of the privkey_pem
+ *
+ * Creates a CSR according to the information in \p elements, and a private
+ * RSA key used to sign the CSR.
+ *
+ * The outputs are the b64URL(ASN-1 CSR) into csr, and the PEM private key into
+ * privkey_pem.
+ *
+ * Notice that \p elements points to an array of const char *s pointing to the
+ * information listed in the enum above. If an entry is NULL or an empty
+ * string, the element is set to "none" in the CSR.
+ *
+ * Returns 0 on success or nonzero for failure.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_acme_sni_csr_create(struct lws_context *context, const char *elements[],
+ uint8_t *csr, size_t csr_len, char **privkey_pem,
+ size_t *privkey_len);
+
+/**
+ * lws_tls_cert_updated() - update every vhost using the given cert path
+ *
+ * \param context: our lws_context
+ * \param certpath: the filepath to the certificate
+ * \param keypath: the filepath to the private key of the certificate
+ * \param mem_cert: copy of the cert in memory
+ * \param len_mem_cert: length of the copy of the cert in memory
+ * \param mem_privkey: copy of the private key in memory
+ * \param len_mem_privkey: length of the copy of the private key in memory
+ *
+ * Checks every vhost to see if it is the using certificate described by the
+ * the given filepaths. If so, it attempts to update the vhost ssl_ctx to use
+ * the new certificate.
+ *
+ * Returns 0 on success or nonzero for failure.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_cert_updated(struct lws_context *context, const char *certpath,
+ const char *keypath,
+ const char *mem_cert, size_t len_mem_cert,
+ const char *mem_privkey, size_t len_mem_privkey);
+///@}
+
+/** \defgroup lws_ring LWS Ringbuffer APIs
+ * ##lws_ring: generic ringbuffer struct
+ *
+ * Provides an abstract ringbuffer api supporting one head and one or an
+ * unlimited number of tails.
+ *
+ * All of the members are opaque and manipulated by lws_ring_...() apis.
+ *
+ * The lws_ring and its buffer is allocated at runtime on the heap, using
+ *
+ * - lws_ring_create()
+ * - lws_ring_destroy()
+ *
+ * It may contain any type, the size of the "element" stored in the ring
+ * buffer and the number of elements is given at creation time.
+ *
+ * When you create the ringbuffer, you can optionally provide an element
+ * destroy callback that frees any allocations inside the element. This is then
+ * automatically called for elements with no tail behind them, ie, elements
+ * which don't have any pending consumer are auto-freed.
+ *
+ * Whole elements may be inserted into the ringbuffer and removed from it, using
+ *
+ * - lws_ring_insert()
+ * - lws_ring_consume()
+ *
+ * You can find out how many whole elements are free or waiting using
+ *
+ * - lws_ring_get_count_free_elements()
+ * - lws_ring_get_count_waiting_elements()
+ *
+ * In addition there are special purpose optional byte-centric apis
+ *
+ * - lws_ring_next_linear_insert_range()
+ * - lws_ring_bump_head()
+ *
+ * which let you, eg, read() directly into the ringbuffer without needing
+ * an intermediate bounce buffer.
+ *
+ * The accessors understand that the ring wraps, and optimizes insertion and
+ * consumption into one or two memcpy()s depending on if the head or tail
+ * wraps.
+ *
+ * lws_ring only supports a single head, but optionally multiple tails with
+ * an API to inform it when the "oldest" tail has moved on. You can give
+ * NULL where-ever an api asks for a tail pointer, and it will use an internal
+ * single tail pointer for convenience.
+ *
+ * The "oldest tail", which is the only tail if you give it NULL instead of
+ * some other tail, is used to track which elements in the ringbuffer are
+ * still unread by anyone.
+ *
+ * - lws_ring_update_oldest_tail()
+ */
+///@{
+struct lws_ring;
+
+/**
+ * lws_ring_create(): create a new ringbuffer
+ *
+ * \param element_len: the size in bytes of one element in the ringbuffer
+ * \param count: the number of elements the ringbuffer can contain
+ * \param destroy_element: NULL, or callback to be called for each element
+ * that is removed from the ringbuffer due to the
+ * oldest tail moving beyond it
+ *
+ * Creates the ringbuffer and allocates the storage. Returns the new
+ * lws_ring *, or NULL if the allocation failed.
+ *
+ * If non-NULL, destroy_element will get called back for every element that is
+ * retired from the ringbuffer after the oldest tail has gone past it, and for
+ * any element still left in the ringbuffer when it is destroyed. It replaces
+ * all other element destruction code in your user code.
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_ring *
+lws_ring_create(size_t element_len, size_t count,
+ void (*destroy_element)(void *element));
+
+/**
+ * lws_ring_destroy(): destroy a previously created ringbuffer
+ *
+ * \param ring: the struct lws_ring to destroy
+ *
+ * Destroys the ringbuffer allocation and the struct lws_ring itself.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_ring_destroy(struct lws_ring *ring);
+
+/**
+ * lws_ring_get_count_free_elements(): return how many elements can fit
+ * in the free space
+ *
+ * \param ring: the struct lws_ring to report on
+ *
+ * Returns how much room is left in the ringbuffer for whole element insertion.
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_ring_get_count_free_elements(struct lws_ring *ring);
+
+/**
+ * lws_ring_get_count_waiting_elements(): return how many elements can be consumed
+ *
+ * \param ring: the struct lws_ring to report on
+ * \param tail: a pointer to the tail struct to use, or NULL for single tail
+ *
+ * Returns how many elements are waiting to be consumed from the perspective
+ * of the tail pointer given.
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_ring_get_count_waiting_elements(struct lws_ring *ring, uint32_t *tail);
+
+/**
+ * lws_ring_insert(): attempt to insert up to max_count elements from src
+ *
+ * \param ring: the struct lws_ring to report on
+ * \param src: the array of elements to be inserted
+ * \param max_count: the number of available elements at src
+ *
+ * Attempts to insert as many of the elements at src as possible, up to the
+ * maximum max_count. Returns the number of elements actually inserted.
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_ring_insert(struct lws_ring *ring, const void *src, size_t max_count);
+
+/**
+ * lws_ring_consume(): attempt to copy out and remove up to max_count elements
+ * to src
+ *
+ * \param ring: the struct lws_ring to report on
+ * \param tail: a pointer to the tail struct to use, or NULL for single tail
+ * \param dest: the array of elements to be inserted. or NULL for no copy
+ * \param max_count: the number of available elements at src
+ *
+ * Attempts to copy out as many waiting elements as possible into dest, from
+ * the perspective of the given tail, up to max_count. If dest is NULL, the
+ * copying out is not done but the elements are logically consumed as usual.
+ * NULL dest is useful in combination with lws_ring_get_element(), where you
+ * can use the element direct from the ringbuffer and then call this with NULL
+ * dest to logically consume it.
+ *
+ * Increments the tail position according to how many elements could be
+ * consumed.
+ *
+ * Returns the number of elements consumed.
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_ring_consume(struct lws_ring *ring, uint32_t *tail, void *dest,
+ size_t max_count);
+
+/**
+ * lws_ring_get_element(): get a pointer to the next waiting element for tail
+ *
+ * \param ring: the struct lws_ring to report on
+ * \param tail: a pointer to the tail struct to use, or NULL for single tail
+ *
+ * Points to the next element that tail would consume, directly in the
+ * ringbuffer. This lets you write() or otherwise use the element without
+ * having to copy it out somewhere first.
+ *
+ * After calling this, you must call lws_ring_consume(ring, &tail, NULL, 1)
+ * which will logically consume the element you used up and increment your
+ * tail (tail may also be NULL there if you use a single tail).
+ *
+ * Returns NULL if no waiting element, or a const void * pointing to it.
+ */
+LWS_VISIBLE LWS_EXTERN const void *
+lws_ring_get_element(struct lws_ring *ring, uint32_t *tail);
+
+/**
+ * lws_ring_update_oldest_tail(): free up elements older than tail for reuse
+ *
+ * \param ring: the struct lws_ring to report on
+ * \param tail: a pointer to the tail struct to use, or NULL for single tail
+ *
+ * If you are using multiple tails, you must use this API to inform the
+ * lws_ring when none of the tails still need elements in the fifo any more,
+ * by updating it when the "oldest" tail has moved on.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_ring_update_oldest_tail(struct lws_ring *ring, uint32_t tail);
+
+/**
+ * lws_ring_get_oldest_tail(): get current oldest available data index
+ *
+ * \param ring: the struct lws_ring to report on
+ *
+ * If you are initializing a new ringbuffer consumer, you can set its tail to
+ * this to start it from the oldest ringbuffer entry still available.
+ */
+LWS_VISIBLE LWS_EXTERN uint32_t
+lws_ring_get_oldest_tail(struct lws_ring *ring);
+
+/**
+ * lws_ring_next_linear_insert_range(): used to write directly into the ring
+ *
+ * \param ring: the struct lws_ring to report on
+ * \param start: pointer to a void * set to the start of the next ringbuffer area
+ * \param bytes: pointer to a size_t set to the max length you may use from *start
+ *
+ * This provides a low-level, bytewise access directly into the ringbuffer
+ * allowing direct insertion of data without having to use a bounce buffer.
+ *
+ * The api reports the position and length of the next linear range that can
+ * be written in the ringbuffer, ie, up to the point it would wrap, and sets
+ * *start and *bytes accordingly. You can then, eg, directly read() into
+ * *start for up to *bytes, and use lws_ring_bump_head() to update the lws_ring
+ * with what you have done.
+ *
+ * Returns nonzero if no insertion is currently possible.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_ring_next_linear_insert_range(struct lws_ring *ring, void **start,
+ size_t *bytes);
+
+/**
+ * lws_ring_bump_head(): used to write directly into the ring
+ *
+ * \param ring: the struct lws_ring to operate on
+ * \param bytes: the number of bytes you inserted at the current head
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_ring_bump_head(struct lws_ring *ring, size_t bytes);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_ring_dump(struct lws_ring *ring, uint32_t *tail);
+
+/*
+ * This is a helper that combines the common pattern of needing to consume
+ * some ringbuffer elements, move the consumer tail on, and check if that
+ * has moved any ringbuffer elements out of scope, because it was the last
+ * consumer that had not already consumed them.
+ *
+ * Elements that go out of scope because the oldest tail is now after them
+ * get garbage-collected by calling the destroy_element callback on them
+ * defined when the ringbuffer was created.
+ */
+
+#define lws_ring_consume_and_update_oldest_tail(\
+ ___ring, /* the lws_ring object */ \
+ ___type, /* type of objects with tails */ \
+ ___ptail, /* ptr to tail of obj with tail doing consuming */ \
+ ___count, /* count of payload objects being consumed */ \
+ ___list_head, /* head of list of objects with tails */ \
+ ___mtail, /* member name of tail in ___type */ \
+ ___mlist /* member name of next list member ptr in ___type */ \
+ ) { \
+ int ___n, ___m; \
+ \
+ ___n = lws_ring_get_oldest_tail(___ring) == *(___ptail); \
+ lws_ring_consume(___ring, ___ptail, NULL, ___count); \
+ if (___n) { \
+ uint32_t ___oldest; \
+ ___n = 0; \
+ ___oldest = *(___ptail); \
+ lws_start_foreach_llp(___type **, ___ppss, ___list_head) { \
+ ___m = lws_ring_get_count_waiting_elements( \
+ ___ring, &(*___ppss)->tail); \
+ if (___m >= ___n) { \
+ ___n = ___m; \
+ ___oldest = (*___ppss)->tail; \
+ } \
+ } lws_end_foreach_llp(___ppss, ___mlist); \
+ \
+ lws_ring_update_oldest_tail(___ring, ___oldest); \
+ } \
+}
+
+/*
+ * This does the same as the lws_ring_consume_and_update_oldest_tail()
+ * helper, but for the simpler case there is only one consumer, so one
+ * tail, and that tail is always the oldest tail.
+ */
+
+#define lws_ring_consume_single_tail(\
+ ___ring, /* the lws_ring object */ \
+ ___ptail, /* ptr to tail of obj with tail doing consuming */ \
+ ___count /* count of payload objects being consumed */ \
+ ) { \
+ lws_ring_consume(___ring, ___ptail, NULL, ___count); \
+ lws_ring_update_oldest_tail(___ring, *(___ptail)); \
+}
+///@}
+
+/** \defgroup sha SHA and B64 helpers
+ * ##SHA and B64 helpers
+ *
+ * These provide SHA-1 and B64 helper apis
+ */
+///@{
+#ifdef LWS_SHA1_USE_OPENSSL_NAME
+#define lws_SHA1 SHA1
+#else
+/**
+ * lws_SHA1(): make a SHA-1 digest of a buffer
+ *
+ * \param d: incoming buffer
+ * \param n: length of incoming buffer
+ * \param md: buffer for message digest (must be >= 20 bytes)
+ *
+ * Reduces any size buffer into a 20-byte SHA-1 hash.
+ */
+LWS_VISIBLE LWS_EXTERN unsigned char *
+lws_SHA1(const unsigned char *d, size_t n, unsigned char *md);
+#endif
+/**
+ * lws_b64_encode_string(): encode a string into base 64
+ *
+ * \param in: incoming buffer
+ * \param in_len: length of incoming buffer
+ * \param out: result buffer
+ * \param out_size: length of result buffer
+ *
+ * Encodes a string using b64
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_b64_encode_string(const char *in, int in_len, char *out, int out_size);
+/**
+ * lws_b64_encode_string_url(): encode a string into base 64
+ *
+ * \param in: incoming buffer
+ * \param in_len: length of incoming buffer
+ * \param out: result buffer
+ * \param out_size: length of result buffer
+ *
+ * Encodes a string using b64 with the "URL" variant (+ -> -, and / -> _)
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_b64_encode_string_url(const char *in, int in_len, char *out, int out_size);
+/**
+ * lws_b64_decode_string(): decode a string from base 64
+ *
+ * \param in: incoming buffer
+ * \param out: result buffer
+ * \param out_size: length of result buffer
+ *
+ * Decodes a NUL-terminated string using b64
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_b64_decode_string(const char *in, char *out, int out_size);
+/**
+ * lws_b64_decode_string_len(): decode a string from base 64
+ *
+ * \param in: incoming buffer
+ * \param in_len: length of incoming buffer
+ * \param out: result buffer
+ * \param out_size: length of result buffer
+ *
+ * Decodes a range of chars using b64
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_b64_decode_string_len(const char *in, int in_len, char *out, int out_size);
+///@}
+
+
+/*! \defgroup cgi cgi handling
+ *
+ * ##CGI handling
+ *
+ * These functions allow low-level control over stdin/out/err of the cgi.
+ *
+ * However for most cases, binding the cgi to http in and out, the default
+ * lws implementation already does the right thing.
+ */
+
+enum lws_enum_stdinouterr {
+ LWS_STDIN = 0,
+ LWS_STDOUT = 1,
+ LWS_STDERR = 2,
+};
+
+enum lws_cgi_hdr_state {
+ LCHS_HEADER,
+ LCHS_CR1,
+ LCHS_LF1,
+ LCHS_CR2,
+ LCHS_LF2,
+ LHCS_RESPONSE,
+ LHCS_DUMP_HEADERS,
+ LHCS_PAYLOAD,
+ LCHS_SINGLE_0A,
+};
+
+struct lws_cgi_args {
+ struct lws **stdwsi; /**< get fd with lws_get_socket_fd() */
+ enum lws_enum_stdinouterr ch; /**< channel index */
+ unsigned char *data; /**< for messages with payload */
+ enum lws_cgi_hdr_state hdr_state; /**< track where we are in cgi headers */
+ int len; /**< length */
+};
+
+#ifdef LWS_WITH_CGI
+/**
+ * lws_cgi: spawn network-connected cgi process
+ *
+ * \param wsi: connection to own the process
+ * \param exec_array: array of "exec-name" "arg1" ... "argn" NULL
+ * \param script_uri_path_len: how many chars on the left of the uri are the
+ * path to the cgi, or -1 to spawn without URL-related env vars
+ * \param timeout_secs: seconds script should be allowed to run
+ * \param mp_cgienv: pvo list with per-vhost cgi options to put in env
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_cgi(struct lws *wsi, const char * const *exec_array,
+ int script_uri_path_len, int timeout_secs,
+ const struct lws_protocol_vhost_options *mp_cgienv);
+
+/**
+ * lws_cgi_write_split_stdout_headers: write cgi output accounting for header part
+ *
+ * \param wsi: connection to own the process
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_cgi_write_split_stdout_headers(struct lws *wsi);
+
+/**
+ * lws_cgi_kill: terminate cgi process associated with wsi
+ *
+ * \param wsi: connection to own the process
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_cgi_kill(struct lws *wsi);
+
+/**
+ * lws_cgi_get_stdwsi: get wsi for stdin, stdout, or stderr
+ *
+ * \param wsi: parent wsi that has cgi
+ * \param ch: which of LWS_STDIN, LWS_STDOUT or LWS_STDERR
+ */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_cgi_get_stdwsi(struct lws *wsi, enum lws_enum_stdinouterr ch);
+
+#endif
+///@}
+
+
+/*! \defgroup fops file operation wrapping
+ *
+ * ##File operation wrapping
+ *
+ * Use these helper functions if you want to access a file from the perspective
+ * of a specific wsi, which is usually the case. If you just want contextless
+ * file access, use the fops callbacks directly with NULL wsi instead of these
+ * helpers.
+ *
+ * If so, then it calls the platform handler or user overrides where present
+ * (as defined in info->fops)
+ *
+ * The advantage from all this is user code can be portable for file operations
+ * without having to deal with differences between platforms.
+ */
+//@{
+
+/** struct lws_plat_file_ops - Platform-specific file operations
+ *
+ * These provide platform-agnostic ways to deal with filesystem access in the
+ * library and in the user code.
+ */
+
+#if defined(LWS_WITH_ESP32)
+/* sdk preprocessor defs? compiler issue? gets confused with member names */
+#define LWS_FOP_OPEN _open
+#define LWS_FOP_CLOSE _close
+#define LWS_FOP_SEEK_CUR _seek_cur
+#define LWS_FOP_READ _read
+#define LWS_FOP_WRITE _write
+#else
+#define LWS_FOP_OPEN open
+#define LWS_FOP_CLOSE close
+#define LWS_FOP_SEEK_CUR seek_cur
+#define LWS_FOP_READ read
+#define LWS_FOP_WRITE write
+#endif
+
+#define LWS_FOP_FLAGS_MASK ((1 << 23) - 1)
+#define LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP (1 << 24)
+#define LWS_FOP_FLAG_COMPR_IS_GZIP (1 << 25)
+#define LWS_FOP_FLAG_MOD_TIME_VALID (1 << 26)
+#define LWS_FOP_FLAG_VIRTUAL (1 << 27)
+
+struct lws_plat_file_ops;
+
+struct lws_fop_fd {
+ lws_filefd_type fd;
+ /**< real file descriptor related to the file... */
+ const struct lws_plat_file_ops *fops;
+ /**< fops that apply to this fop_fd */
+ void *filesystem_priv;
+ /**< ignored by lws; owned by the fops handlers */
+ lws_filepos_t pos;
+ /**< generic "position in file" */
+ lws_filepos_t len;
+ /**< generic "length of file" */
+ lws_fop_flags_t flags;
+ /**< copy of the returned flags */
+ uint32_t mod_time;
+ /**< optional "modification time of file", only valid if .open()
+ * set the LWS_FOP_FLAG_MOD_TIME_VALID flag */
+};
+typedef struct lws_fop_fd *lws_fop_fd_t;
+
+struct lws_fops_index {
+ const char *sig; /* NULL or vfs signature, eg, ".zip/" */
+ uint8_t len; /* length of above string */
+};
+
+struct lws_plat_file_ops {
+ lws_fop_fd_t (*LWS_FOP_OPEN)(const struct lws_plat_file_ops *fops,
+ const char *filename, const char *vpath,
+ lws_fop_flags_t *flags);
+ /**< Open file (always binary access if plat supports it)
+ * vpath may be NULL, or if the fops understands it, the point at which
+ * the filename's virtual part starts.
+ * *flags & LWS_FOP_FLAGS_MASK should be set to O_RDONLY or O_RDWR.
+ * If the file may be gzip-compressed,
+ * LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP is set. If it actually is
+ * gzip-compressed, then the open handler should OR
+ * LWS_FOP_FLAG_COMPR_IS_GZIP on to *flags before returning.
+ */
+ int (*LWS_FOP_CLOSE)(lws_fop_fd_t *fop_fd);
+ /**< close file AND set the pointer to NULL */
+ lws_fileofs_t (*LWS_FOP_SEEK_CUR)(lws_fop_fd_t fop_fd,
+ lws_fileofs_t offset_from_cur_pos);
+ /**< seek from current position */
+ int (*LWS_FOP_READ)(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len);
+ /**< Read from file, on exit *amount is set to amount actually read */
+ int (*LWS_FOP_WRITE)(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len);
+ /**< Write to file, on exit *amount is set to amount actually written */
+
+ struct lws_fops_index fi[3];
+ /**< vfs path signatures implying use of this fops */
+
+ const struct lws_plat_file_ops *next;
+ /**< NULL or next fops in list */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility */
+};
+
+/**
+ * lws_get_fops() - get current file ops
+ *
+ * \param context: context
+ */
+LWS_VISIBLE LWS_EXTERN struct lws_plat_file_ops * LWS_WARN_UNUSED_RESULT
+lws_get_fops(struct lws_context *context);
+LWS_VISIBLE LWS_EXTERN void
+lws_set_fops(struct lws_context *context, const struct lws_plat_file_ops *fops);
+/**
+ * lws_vfs_tell() - get current file position
+ *
+ * \param fop_fd: fop_fd we are asking about
+ */
+LWS_VISIBLE LWS_EXTERN lws_filepos_t LWS_WARN_UNUSED_RESULT
+lws_vfs_tell(lws_fop_fd_t fop_fd);
+/**
+ * lws_vfs_get_length() - get current file total length in bytes
+ *
+ * \param fop_fd: fop_fd we are asking about
+ */
+LWS_VISIBLE LWS_EXTERN lws_filepos_t LWS_WARN_UNUSED_RESULT
+lws_vfs_get_length(lws_fop_fd_t fop_fd);
+/**
+ * lws_vfs_get_mod_time() - get time file last modified
+ *
+ * \param fop_fd: fop_fd we are asking about
+ */
+LWS_VISIBLE LWS_EXTERN uint32_t LWS_WARN_UNUSED_RESULT
+lws_vfs_get_mod_time(lws_fop_fd_t fop_fd);
+/**
+ * lws_vfs_file_seek_set() - seek relative to start of file
+ *
+ * \param fop_fd: fop_fd we are seeking in
+ * \param offset: offset from start of file
+ */
+LWS_VISIBLE LWS_EXTERN lws_fileofs_t
+lws_vfs_file_seek_set(lws_fop_fd_t fop_fd, lws_fileofs_t offset);
+/**
+ * lws_vfs_file_seek_end() - seek relative to end of file
+ *
+ * \param fop_fd: fop_fd we are seeking in
+ * \param offset: offset from start of file
+ */
+LWS_VISIBLE LWS_EXTERN lws_fileofs_t
+lws_vfs_file_seek_end(lws_fop_fd_t fop_fd, lws_fileofs_t offset);
+
+extern struct lws_plat_file_ops fops_zip;
+
+/**
+ * lws_plat_file_open() - open vfs filepath
+ *
+ * \param fops: file ops struct that applies to this descriptor
+ * \param vfs_path: filename to open
+ * \param flags: pointer to open flags
+ *
+ * The vfs_path is scanned for known fops signatures, and the open directed
+ * to any matching fops open.
+ *
+ * User code should use this api to perform vfs opens.
+ *
+ * returns semi-opaque handle
+ */
+LWS_VISIBLE LWS_EXTERN lws_fop_fd_t LWS_WARN_UNUSED_RESULT
+lws_vfs_file_open(const struct lws_plat_file_ops *fops, const char *vfs_path,
+ lws_fop_flags_t *flags);
+
+/**
+ * lws_plat_file_close() - close file
+ *
+ * \param fop_fd: file handle to close
+ */
+static LWS_INLINE int
+lws_vfs_file_close(lws_fop_fd_t *fop_fd)
+{
+ return (*fop_fd)->fops->LWS_FOP_CLOSE(fop_fd);
+}
+
+/**
+ * lws_plat_file_seek_cur() - close file
+ *
+ *
+ * \param fop_fd: file handle
+ * \param offset: position to seek to
+ */
+static LWS_INLINE lws_fileofs_t
+lws_vfs_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
+{
+ return fop_fd->fops->LWS_FOP_SEEK_CUR(fop_fd, offset);
+}
+/**
+ * lws_plat_file_read() - read from file
+ *
+ * \param fop_fd: file handle
+ * \param amount: how much to read (rewritten by call)
+ * \param buf: buffer to write to
+ * \param len: max length
+ */
+static LWS_INLINE int LWS_WARN_UNUSED_RESULT
+lws_vfs_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len)
+{
+ return fop_fd->fops->LWS_FOP_READ(fop_fd, amount, buf, len);
+}
+/**
+ * lws_plat_file_write() - write from file
+ *
+ * \param fop_fd: file handle
+ * \param amount: how much to write (rewritten by call)
+ * \param buf: buffer to read from
+ * \param len: max length
+ */
+static LWS_INLINE int LWS_WARN_UNUSED_RESULT
+lws_vfs_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len)
+{
+ return fop_fd->fops->LWS_FOP_WRITE(fop_fd, amount, buf, len);
+}
+
+/* these are the platform file operations implementations... they can
+ * be called directly and used in fops arrays
+ */
+
+LWS_VISIBLE LWS_EXTERN lws_fop_fd_t
+_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ const char *vpath, lws_fop_flags_t *flags);
+LWS_VISIBLE LWS_EXTERN int
+_lws_plat_file_close(lws_fop_fd_t *fop_fd);
+LWS_VISIBLE LWS_EXTERN lws_fileofs_t
+_lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset);
+LWS_VISIBLE LWS_EXTERN int
+_lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len);
+LWS_VISIBLE LWS_EXTERN int
+_lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_alloc_vfs_file(struct lws_context *context, const char *filename,
+ uint8_t **buf, lws_filepos_t *amount);
+//@}
+
+/** \defgroup smtp SMTP related functions
+ * ##SMTP related functions
+ * \ingroup lwsapi
+ *
+ * These apis let you communicate with a local SMTP server to send email from
+ * lws. It handles all the SMTP sequencing and protocol actions.
+ *
+ * Your system should have postfix, sendmail or another MTA listening on port
+ * 25 and able to send email using the "mail" commandline app. Usually distro
+ * MTAs are configured for this by default.
+ *
+ * It runs via its own libuv events if initialized (which requires giving it
+ * a libuv loop to attach to).
+ *
+ * It operates using three callbacks, on_next() queries if there is a new email
+ * to send, on_get_body() asks for the body of the email, and on_sent() is
+ * called after the email is successfully sent.
+ *
+ * To use it
+ *
+ * - create an lws_email struct
+ *
+ * - initialize data, loop, the email_* strings, max_content_size and
+ * the callbacks
+ *
+ * - call lws_email_init()
+ *
+ * When you have at least one email to send, call lws_email_check() to
+ * schedule starting to send it.
+ */
+//@{
+#ifdef LWS_WITH_SMTP
+
+/** enum lwsgs_smtp_states - where we are in SMTP protocol sequence */
+enum lwsgs_smtp_states {
+ LGSSMTP_IDLE, /**< awaiting new email */
+ LGSSMTP_CONNECTING, /**< opening tcp connection to MTA */
+ LGSSMTP_CONNECTED, /**< tcp connection to MTA is connected */
+ LGSSMTP_SENT_HELO, /**< sent the HELO */
+ LGSSMTP_SENT_FROM, /**< sent FROM */
+ LGSSMTP_SENT_TO, /**< sent TO */
+ LGSSMTP_SENT_DATA, /**< sent DATA request */
+ LGSSMTP_SENT_BODY, /**< sent the email body */
+ LGSSMTP_SENT_QUIT, /**< sent the session quit */
+};
+
+/** struct lws_email - abstract context for performing SMTP operations */
+struct lws_email {
+ void *data;
+ /**< opaque pointer set by user code and available to the callbacks */
+ uv_loop_t *loop;
+ /**< the libuv loop we will work on */
+
+ char email_smtp_ip[32]; /**< Fill before init, eg, "127.0.0.1" */
+ char email_helo[32]; /**< Fill before init, eg, "myserver.com" */
+ char email_from[100]; /**< Fill before init or on_next */
+ char email_to[100]; /**< Fill before init or on_next */
+
+ unsigned int max_content_size;
+ /**< largest possible email body size */
+
+ /* Fill all the callbacks before init */
+
+ int (*on_next)(struct lws_email *email);
+ /**< (Fill in before calling lws_email_init)
+ * called when idle, 0 = another email to send, nonzero is idle.
+ * If you return 0, all of the email_* char arrays must be set
+ * to something useful. */
+ int (*on_sent)(struct lws_email *email);
+ /**< (Fill in before calling lws_email_init)
+ * called when transfer of the email to the SMTP server was
+ * successful, your callback would remove the current email
+ * from its queue */
+ int (*on_get_body)(struct lws_email *email, char *buf, int len);
+ /**< (Fill in before calling lws_email_init)
+ * called when the body part of the queued email is about to be
+ * sent to the SMTP server. */
+
+
+ /* private things */
+ uv_timer_t timeout_email; /**< private */
+ enum lwsgs_smtp_states estate; /**< private */
+ uv_connect_t email_connect_req; /**< private */
+ uv_tcp_t email_client; /**< private */
+ time_t email_connect_started; /**< private */
+ char email_buf[256]; /**< private */
+ char *content; /**< private */
+};
+
+/**
+ * lws_email_init() - Initialize a struct lws_email
+ *
+ * \param email: struct lws_email to init
+ * \param loop: libuv loop to use
+ * \param max_content: max email content size
+ *
+ * Prepares a struct lws_email for use ending SMTP
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_email_init(struct lws_email *email, uv_loop_t *loop, int max_content);
+
+/**
+ * lws_email_check() - Request check for new email
+ *
+ * \param email: struct lws_email context to check
+ *
+ * Schedules a check for new emails in 1s... call this when you have queued an
+ * email for send.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_email_check(struct lws_email *email);
+/**
+ * lws_email_destroy() - stop using the struct lws_email
+ *
+ * \param email: the struct lws_email context
+ *
+ * Stop sending email using email and free allocations
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_email_destroy(struct lws_email *email);
+
+#endif
+//@}
+
+
+/** \defgroup lejp JSON parser
+ * ##JSON parsing related functions
+ * \ingroup lwsapi
+ *
+ * LEJP is an extremely lightweight JSON stream parser included in lws.
+ */
+//@{
+struct lejp_ctx;
+
+#define LWS_ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
+#define LEJP_FLAG_WS_KEEP 64
+#define LEJP_FLAG_WS_COMMENTLINE 32
+
+enum lejp_states {
+ LEJP_IDLE = 0,
+ LEJP_MEMBERS = 1,
+ LEJP_M_P = 2,
+ LEJP_MP_STRING = LEJP_FLAG_WS_KEEP | 3,
+ LEJP_MP_STRING_ESC = LEJP_FLAG_WS_KEEP | 4,
+ LEJP_MP_STRING_ESC_U1 = LEJP_FLAG_WS_KEEP | 5,
+ LEJP_MP_STRING_ESC_U2 = LEJP_FLAG_WS_KEEP | 6,
+ LEJP_MP_STRING_ESC_U3 = LEJP_FLAG_WS_KEEP | 7,
+ LEJP_MP_STRING_ESC_U4 = LEJP_FLAG_WS_KEEP | 8,
+ LEJP_MP_DELIM = 9,
+ LEJP_MP_VALUE = 10,
+ LEJP_MP_VALUE_NUM_INT = LEJP_FLAG_WS_KEEP | 11,
+ LEJP_MP_VALUE_NUM_EXP = LEJP_FLAG_WS_KEEP | 12,
+ LEJP_MP_VALUE_TOK = LEJP_FLAG_WS_KEEP | 13,
+ LEJP_MP_COMMA_OR_END = 14,
+ LEJP_MP_ARRAY_END = 15,
+};
+
+enum lejp_reasons {
+ LEJP_CONTINUE = -1,
+ LEJP_REJECT_IDLE_NO_BRACE = -2,
+ LEJP_REJECT_MEMBERS_NO_CLOSE = -3,
+ LEJP_REJECT_MP_NO_OPEN_QUOTE = -4,
+ LEJP_REJECT_MP_STRING_UNDERRUN = -5,
+ LEJP_REJECT_MP_ILLEGAL_CTRL = -6,
+ LEJP_REJECT_MP_STRING_ESC_ILLEGAL_ESC = -7,
+ LEJP_REJECT_ILLEGAL_HEX = -8,
+ LEJP_REJECT_MP_DELIM_MISSING_COLON = -9,
+ LEJP_REJECT_MP_DELIM_BAD_VALUE_START = -10,
+ LEJP_REJECT_MP_VAL_NUM_INT_NO_FRAC = -11,
+ LEJP_REJECT_MP_VAL_NUM_FORMAT = -12,
+ LEJP_REJECT_MP_VAL_NUM_EXP_BAD_EXP = -13,
+ LEJP_REJECT_MP_VAL_TOK_UNKNOWN = -14,
+ LEJP_REJECT_MP_C_OR_E_UNDERF = -15,
+ LEJP_REJECT_MP_C_OR_E_NOTARRAY = -16,
+ LEJP_REJECT_MP_ARRAY_END_MISSING = -17,
+ LEJP_REJECT_STACK_OVERFLOW = -18,
+ LEJP_REJECT_MP_DELIM_ISTACK = -19,
+ LEJP_REJECT_NUM_TOO_LONG = -20,
+ LEJP_REJECT_MP_C_OR_E_NEITHER = -21,
+ LEJP_REJECT_UNKNOWN = -22,
+ LEJP_REJECT_CALLBACK = -23
+};
+
+#define LEJP_FLAG_CB_IS_VALUE 64
+
+enum lejp_callbacks {
+ LEJPCB_CONSTRUCTED = 0,
+ LEJPCB_DESTRUCTED = 1,
+
+ LEJPCB_START = 2,
+ LEJPCB_COMPLETE = 3,
+ LEJPCB_FAILED = 4,
+
+ LEJPCB_PAIR_NAME = 5,
+
+ LEJPCB_VAL_TRUE = LEJP_FLAG_CB_IS_VALUE | 6,
+ LEJPCB_VAL_FALSE = LEJP_FLAG_CB_IS_VALUE | 7,
+ LEJPCB_VAL_NULL = LEJP_FLAG_CB_IS_VALUE | 8,
+ LEJPCB_VAL_NUM_INT = LEJP_FLAG_CB_IS_VALUE | 9,
+ LEJPCB_VAL_NUM_FLOAT = LEJP_FLAG_CB_IS_VALUE | 10,
+ LEJPCB_VAL_STR_START = 11, /* notice handle separately */
+ LEJPCB_VAL_STR_CHUNK = LEJP_FLAG_CB_IS_VALUE | 12,
+ LEJPCB_VAL_STR_END = LEJP_FLAG_CB_IS_VALUE | 13,
+
+ LEJPCB_ARRAY_START = 14,
+ LEJPCB_ARRAY_END = 15,
+
+ LEJPCB_OBJECT_START = 16,
+ LEJPCB_OBJECT_END = 17
+};
+
+/**
+ * _lejp_callback() - User parser actions
+ * \param ctx: LEJP context
+ * \param reason: Callback reason
+ *
+ * Your user callback is associated with the context at construction time,
+ * and receives calls as the parsing progresses.
+ *
+ * All of the callbacks may be ignored and just return 0.
+ *
+ * The reasons it might get called, found in @reason, are:
+ *
+ * LEJPCB_CONSTRUCTED: The context was just constructed... you might want to
+ * perform one-time allocation for the life of the context.
+ *
+ * LEJPCB_DESTRUCTED: The context is being destructed... if you made any
+ * allocations at construction-time, you can free them now
+ *
+ * LEJPCB_START: Parsing is beginning at the first byte of input
+ *
+ * LEJPCB_COMPLETE: Parsing has completed successfully. You'll get a 0 or
+ * positive return code from lejp_parse indicating the
+ * amount of unused bytes left in the input buffer
+ *
+ * LEJPCB_FAILED: Parsing failed. You'll get a negative error code
+ * returned from lejp_parse
+ *
+ * LEJPCB_PAIR_NAME: When a "name":"value" pair has had the name parsed,
+ * this callback occurs. You can find the new name at
+ * the end of ctx->path[]
+ *
+ * LEJPCB_VAL_TRUE: The "true" value appeared
+ *
+ * LEJPCB_VAL_FALSE: The "false" value appeared
+ *
+ * LEJPCB_VAL_NULL: The "null" value appeared
+ *
+ * LEJPCB_VAL_NUM_INT: A string representing an integer is in ctx->buf
+ *
+ * LEJPCB_VAL_NUM_FLOAT: A string representing a float is in ctx->buf
+ *
+ * LEJPCB_VAL_STR_START: We are starting to parse a string, no data yet
+ *
+ * LEJPCB_VAL_STR_CHUNK: We parsed LEJP_STRING_CHUNK -1 bytes of string data in
+ * ctx->buf, which is as much as we can buffer, so we are
+ * spilling it. If all your strings are less than
+ * LEJP_STRING_CHUNK - 1 bytes, you will never see this
+ * callback.
+ *
+ * LEJPCB_VAL_STR_END: String parsing has completed, the last chunk of the
+ * string is in ctx->buf.
+ *
+ * LEJPCB_ARRAY_START: An array started
+ *
+ * LEJPCB_ARRAY_END: An array ended
+ *
+ * LEJPCB_OBJECT_START: An object started
+ *
+ * LEJPCB_OBJECT_END: An object ended
+ */
+LWS_EXTERN signed char _lejp_callback(struct lejp_ctx *ctx, char reason);
+
+typedef signed char (*lejp_callback)(struct lejp_ctx *ctx, char reason);
+
+#ifndef LEJP_MAX_DEPTH
+#define LEJP_MAX_DEPTH 12
+#endif
+#ifndef LEJP_MAX_INDEX_DEPTH
+#define LEJP_MAX_INDEX_DEPTH 5
+#endif
+#ifndef LEJP_MAX_PATH
+#define LEJP_MAX_PATH 128
+#endif
+#ifndef LEJP_STRING_CHUNK
+/* must be >= 30 to assemble floats */
+#define LEJP_STRING_CHUNK 254
+#endif
+
+enum num_flags {
+ LEJP_SEEN_MINUS = (1 << 0),
+ LEJP_SEEN_POINT = (1 << 1),
+ LEJP_SEEN_POST_POINT = (1 << 2),
+ LEJP_SEEN_EXP = (1 << 3)
+};
+
+struct _lejp_stack {
+ char s; /* lejp_state stack*/
+ char p; /* path length */
+ char i; /* index array length */
+ char b; /* user bitfield */
+};
+
+struct lejp_ctx {
+
+ /* sorted by type for most compact alignment
+ *
+ * pointers
+ */
+
+ signed char (*callback)(struct lejp_ctx *ctx, char reason);
+ void *user;
+ const char * const *paths;
+
+ /* arrays */
+
+ struct _lejp_stack st[LEJP_MAX_DEPTH];
+ uint16_t i[LEJP_MAX_INDEX_DEPTH]; /* index array */
+ uint16_t wild[LEJP_MAX_INDEX_DEPTH]; /* index array */
+ char path[LEJP_MAX_PATH];
+ char buf[LEJP_STRING_CHUNK + 1];
+
+ /* int */
+
+ uint32_t line;
+
+ /* short */
+
+ uint16_t uni;
+
+ /* char */
+
+ uint8_t npos;
+ uint8_t dcount;
+ uint8_t f;
+ uint8_t sp; /* stack head */
+ uint8_t ipos; /* index stack depth */
+ uint8_t ppos;
+ uint8_t count_paths;
+ uint8_t path_match;
+ uint8_t path_match_len;
+ uint8_t wildcount;
+};
+
+LWS_VISIBLE LWS_EXTERN void
+lejp_construct(struct lejp_ctx *ctx,
+ signed char (*callback)(struct lejp_ctx *ctx, char reason),
+ void *user, const char * const *paths, unsigned char paths_count);
+
+LWS_VISIBLE LWS_EXTERN void
+lejp_destruct(struct lejp_ctx *ctx);
+
+LWS_VISIBLE LWS_EXTERN int
+lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len);
+
+LWS_VISIBLE LWS_EXTERN void
+lejp_change_callback(struct lejp_ctx *ctx,
+ signed char (*callback)(struct lejp_ctx *ctx, char reason));
+
+LWS_VISIBLE LWS_EXTERN int
+lejp_get_wildcard(struct lejp_ctx *ctx, int wildcard, char *dest, int len);
+//@}
+
+/*
+ * Stats are all uint64_t numbers that start at 0.
+ * Index names here have the convention
+ *
+ * _C_ counter
+ * _B_ byte count
+ * _MS_ millisecond count
+ */
+
+enum {
+ LWSSTATS_C_CONNECTIONS, /**< count incoming connections */
+ LWSSTATS_C_API_CLOSE, /**< count calls to close api */
+ LWSSTATS_C_API_READ, /**< count calls to read from socket api */
+ LWSSTATS_C_API_LWS_WRITE, /**< count calls to lws_write API */
+ LWSSTATS_C_API_WRITE, /**< count calls to write API */
+ LWSSTATS_C_WRITE_PARTIALS, /**< count of partial writes */
+ LWSSTATS_C_WRITEABLE_CB_REQ, /**< count of writable callback requests */
+ LWSSTATS_C_WRITEABLE_CB_EFF_REQ, /**< count of effective writable callback requests */
+ LWSSTATS_C_WRITEABLE_CB, /**< count of writable callbacks */
+ LWSSTATS_C_SSL_CONNECTIONS_FAILED, /**< count of failed SSL connections */
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED, /**< count of accepted SSL connections */
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN, /**< count of SSL_accept() attempts */
+ LWSSTATS_C_SSL_CONNS_HAD_RX, /**< count of accepted SSL conns that have had some RX */
+ LWSSTATS_C_TIMEOUTS, /**< count of timed-out connections */
+ LWSSTATS_C_SERVICE_ENTRY, /**< count of entries to lws service loop */
+ LWSSTATS_B_READ, /**< aggregate bytes read */
+ LWSSTATS_B_WRITE, /**< aggregate bytes written */
+ LWSSTATS_B_PARTIALS_ACCEPTED_PARTS, /**< aggreate of size of accepted write data from new partials */
+ LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY, /**< aggregate delay in accepting connection */
+ LWSSTATS_MS_WRITABLE_DELAY, /**< aggregate delay between asking for writable and getting cb */
+ LWSSTATS_MS_WORST_WRITABLE_DELAY, /**< single worst delay between asking for writable and getting cb */
+ LWSSTATS_MS_SSL_RX_DELAY, /**< aggregate delay between ssl accept complete and first RX */
+ LWSSTATS_C_PEER_LIMIT_AH_DENIED, /**< number of times we would have given an ah but for the peer limit */
+ LWSSTATS_C_PEER_LIMIT_WSI_DENIED, /**< number of times we would have given a wsi but for the peer limit */
+
+ /* Add new things just above here ---^
+ * This is part of the ABI, don't needlessly break compatibility */
+ LWSSTATS_SIZE
+};
+
+#if defined(LWS_WITH_STATS)
+
+LWS_VISIBLE LWS_EXTERN uint64_t
+lws_stats_get(struct lws_context *context, int index);
+LWS_VISIBLE LWS_EXTERN void
+lws_stats_log_dump(struct lws_context *context);
+#else
+static LWS_INLINE uint64_t
+lws_stats_get(struct lws_context *context, int index) { (void)context; (void)index; return 0; }
+static LWS_INLINE void
+lws_stats_log_dump(struct lws_context *context) { (void)context; }
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/libwebsockets/include/lws_config.h b/thirdparty/libwebsockets/lws_config.h
index fdf02157cc..fdf02157cc 100644
--- a/thirdparty/libwebsockets/include/lws_config.h
+++ b/thirdparty/libwebsockets/lws_config.h
diff --git a/thirdparty/libwebsockets/lib/lws_config_private.h b/thirdparty/libwebsockets/lws_config_private.h
index e531777624..e531777624 100644
--- a/thirdparty/libwebsockets/lib/lws_config_private.h
+++ b/thirdparty/libwebsockets/lws_config_private.h
diff --git a/thirdparty/libwebsockets/lib/misc/base64-decode.c b/thirdparty/libwebsockets/misc/base64-decode.c
index de2efc8fd1..64b84d78fa 100644
--- a/thirdparty/libwebsockets/lib/misc/base64-decode.c
+++ b/thirdparty/libwebsockets/misc/base64-decode.c
@@ -55,11 +55,12 @@ _lws_b64_encode_string(const char *encode, const char *in, int in_len,
{
unsigned char triple[3];
int i;
+ int len;
int line = 0;
int done = 0;
while (in_len) {
- int len = 0;
+ len = 0;
for (i = 0; i < 3; i++) {
if (in_len) {
triple[i] = *in++;
diff --git a/thirdparty/libwebsockets/lib/misc/getifaddrs.c b/thirdparty/libwebsockets/misc/getifaddrs.c
index 735b899f48..735b899f48 100644
--- a/thirdparty/libwebsockets/lib/misc/getifaddrs.c
+++ b/thirdparty/libwebsockets/misc/getifaddrs.c
diff --git a/thirdparty/libwebsockets/lib/misc/getifaddrs.h b/thirdparty/libwebsockets/misc/getifaddrs.h
index d26670c082..d26670c082 100644
--- a/thirdparty/libwebsockets/lib/misc/getifaddrs.h
+++ b/thirdparty/libwebsockets/misc/getifaddrs.h
diff --git a/thirdparty/libwebsockets/lib/misc/lejp.c b/thirdparty/libwebsockets/misc/lejp.c
index 599a6d37ba..99142b9553 100644
--- a/thirdparty/libwebsockets/lib/misc/lejp.c
+++ b/thirdparty/libwebsockets/misc/lejp.c
@@ -126,7 +126,7 @@ lejp_check_path_match(struct lejp_ctx *ctx)
q++;
continue;
}
- ctx->wild[ctx->wildcount++] = lws_ptr_diff(p, ctx->path);
+ ctx->wild[ctx->wildcount++] = p - ctx->path;
q++;
/*
* if * has something after it, match to .
diff --git a/thirdparty/libwebsockets/lib/misc/sha-1.c b/thirdparty/libwebsockets/misc/sha-1.c
index 898f3f45b1..2e4db52693 100644
--- a/thirdparty/libwebsockets/lib/misc/sha-1.c
+++ b/thirdparty/libwebsockets/misc/sha-1.c
@@ -236,14 +236,18 @@ sha1_pad(struct sha1_ctxt *ctxt)
void
sha1_loop(struct sha1_ctxt *ctxt, const unsigned char *input, size_t len)
{
+ size_t gaplen;
+ size_t gapstart;
size_t off;
+ size_t copysiz;
off = 0;
while (off < len) {
- size_t gapstart = COUNT % 64, gaplen = 64 - gapstart,
- copysiz = (gaplen < len - off) ? gaplen : len - off;
+ gapstart = COUNT % 64;
+ gaplen = 64 - gapstart;
+ copysiz = (gaplen < len - off) ? gaplen : len - off;
memcpy(&ctxt->m.b8[gapstart], &input[off], copysiz);
COUNT += (unsigned char)copysiz;
COUNT %= 64;
diff --git a/thirdparty/libwebsockets/plat/lws-plat-unix.c b/thirdparty/libwebsockets/plat/lws-plat-unix.c
new file mode 100644
index 0000000000..d1bca8b5df
--- /dev/null
+++ b/thirdparty/libwebsockets/plat/lws-plat-unix.c
@@ -0,0 +1,982 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#define _GNU_SOURCE
+#include "core/private.h"
+
+#include <pwd.h>
+#include <grp.h>
+
+#ifdef LWS_WITH_PLUGINS
+#include <dlfcn.h>
+#endif
+#include <dirent.h>
+
+void lws_plat_apply_FD_CLOEXEC(int n)
+{
+ if (n != -1)
+ fcntl(n, F_SETFD, FD_CLOEXEC );
+}
+
+int
+lws_plat_socket_offset(void)
+{
+ return 0;
+}
+
+int
+lws_plat_pipe_create(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+#if defined(LWS_HAVE_PIPE2)
+ return pipe2(pt->dummy_pipe_fds, O_NONBLOCK);
+#else
+ return pipe(pt->dummy_pipe_fds);
+#endif
+}
+
+int
+lws_plat_pipe_signal(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ char buf = 0;
+ int n;
+
+ n = write(pt->dummy_pipe_fds[1], &buf, 1);
+
+ return n != 1;
+}
+
+void
+lws_plat_pipe_close(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ if (pt->dummy_pipe_fds[0] && pt->dummy_pipe_fds[0] != -1)
+ close(pt->dummy_pipe_fds[0]);
+ if (pt->dummy_pipe_fds[1] && pt->dummy_pipe_fds[1] != -1)
+ close(pt->dummy_pipe_fds[1]);
+
+ pt->dummy_pipe_fds[0] = pt->dummy_pipe_fds[1] = -1;
+}
+
+#ifdef __QNX__
+# include "netinet/tcp_var.h"
+# define TCP_KEEPINTVL TCPCTL_KEEPINTVL
+# define TCP_KEEPIDLE TCPCTL_KEEPIDLE
+# define TCP_KEEPCNT TCPCTL_KEEPCNT
+#endif
+
+unsigned long long time_in_microseconds(void)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ return ((unsigned long long)tv.tv_sec * 1000000LL) + tv.tv_usec;
+}
+
+LWS_VISIBLE int
+lws_get_random(struct lws_context *context, void *buf, int len)
+{
+ return read(context->fd_random, (char *)buf, len);
+}
+
+LWS_VISIBLE int
+lws_send_pipe_choked(struct lws *wsi)
+{
+ struct lws_pollfd fds;
+ struct lws *wsi_eff = wsi;
+
+#if defined(LWS_WITH_HTTP2)
+ wsi_eff = lws_get_network_wsi(wsi);
+#endif
+
+ /* the fact we checked implies we avoided back-to-back writes */
+ wsi_eff->could_have_pending = 0;
+
+ /* treat the fact we got a truncated send pending as if we're choked */
+ if (wsi_eff->trunc_len)
+ return 1;
+
+ fds.fd = wsi_eff->desc.sockfd;
+ fds.events = POLLOUT;
+ fds.revents = 0;
+
+ if (poll(&fds, 1, 0) != 1)
+ return 1;
+
+ if ((fds.revents & POLLOUT) == 0)
+ return 1;
+
+ /* okay to send another packet without blocking */
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_poll_listen_fd(struct lws_pollfd *fd)
+{
+ return poll(fd, 1, 0);
+}
+
+LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
+{
+ int syslog_level = LOG_DEBUG;
+
+ switch (level) {
+ case LLL_ERR:
+ syslog_level = LOG_ERR;
+ break;
+ case LLL_WARN:
+ syslog_level = LOG_WARNING;
+ break;
+ case LLL_NOTICE:
+ syslog_level = LOG_NOTICE;
+ break;
+ case LLL_INFO:
+ syslog_level = LOG_INFO;
+ break;
+ }
+ syslog(syslog_level, "%s", line);
+}
+
+LWS_VISIBLE LWS_EXTERN int
+_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
+{
+ volatile struct lws_foreign_thread_pollfd *ftp, *next;
+ volatile struct lws_context_per_thread *vpt;
+ struct lws_context_per_thread *pt;
+ int n = -1, m, c;
+
+ /* stay dead once we are dead */
+
+ if (!context || !context->vhost_list)
+ return 1;
+
+ pt = &context->pt[tsi];
+ vpt = (volatile struct lws_context_per_thread *)pt;
+
+ lws_stats_atomic_bump(context, pt, LWSSTATS_C_SERVICE_ENTRY, 1);
+
+ if (timeout_ms < 0)
+ goto faked_service;
+
+ if (context->event_loop_ops->run_pt)
+ context->event_loop_ops->run_pt(context, tsi);
+
+ if (!context->service_tid_detected) {
+ struct lws _lws;
+
+ memset(&_lws, 0, sizeof(_lws));
+ _lws.context = context;
+
+ context->service_tid_detected =
+ context->vhost_list->protocols[0].callback(
+ &_lws, LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0);
+ context->service_tid = context->service_tid_detected;
+ context->service_tid_detected = 1;
+ }
+
+ /*
+ * is there anybody with pending stuff that needs service forcing?
+ */
+ if (!lws_service_adjust_timeout(context, 1, tsi)) {
+ /* -1 timeout means just do forced service */
+ _lws_plat_service_tsi(context, -1, pt->tid);
+ /* still somebody left who wants forced service? */
+ if (!lws_service_adjust_timeout(context, 1, pt->tid))
+ /* yes... come back again quickly */
+ timeout_ms = 0;
+ }
+
+ if (timeout_ms) {
+ lws_pt_lock(pt, __func__);
+ /* don't stay in poll wait longer than next hr timeout */
+ lws_usec_t t = __lws_hrtimer_service(pt);
+ if ((lws_usec_t)timeout_ms * 1000 > t)
+ timeout_ms = t / 1000;
+ lws_pt_unlock(pt);
+ }
+
+ vpt->inside_poll = 1;
+ lws_memory_barrier();
+ n = poll(pt->fds, pt->fds_count, timeout_ms);
+ vpt->inside_poll = 0;
+ lws_memory_barrier();
+
+ /* Collision will be rare and brief. Just spin until it completes */
+ while (vpt->foreign_spinlock)
+ ;
+
+ /*
+ * At this point we are not inside a foreign thread pollfd change,
+ * and we have marked ourselves as outside the poll() wait. So we
+ * are the only guys that can modify the lws_foreign_thread_pollfd
+ * list on the pt. Drain the list and apply the changes to the
+ * affected pollfds in the correct order.
+ */
+
+ lws_pt_lock(pt, __func__);
+
+ ftp = vpt->foreign_pfd_list;
+ //lwsl_notice("cleared list %p\n", ftp);
+ while (ftp) {
+ struct lws *wsi;
+ struct lws_pollfd *pfd;
+
+ next = ftp->next;
+ pfd = &vpt->fds[ftp->fd_index];
+ if (lws_socket_is_valid(pfd->fd)) {
+ wsi = wsi_from_fd(context, pfd->fd);
+ if (wsi)
+ __lws_change_pollfd(wsi, ftp->_and, ftp->_or);
+ }
+ lws_free((void *)ftp);
+ ftp = next;
+ }
+ vpt->foreign_pfd_list = NULL;
+ lws_memory_barrier();
+
+ /* we have come out of a poll wait... check the hrtimer list */
+
+ __lws_hrtimer_service(pt);
+
+ lws_pt_unlock(pt);
+
+ m = 0;
+#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
+ m |= !!pt->ws.rx_draining_ext_list;
+#endif
+
+ if (pt->context->tls_ops &&
+ pt->context->tls_ops->fake_POLLIN_for_buffered)
+ m |= pt->context->tls_ops->fake_POLLIN_for_buffered(pt);
+
+ if (!m && !n) { /* nothing to do */
+ lws_service_fd_tsi(context, NULL, tsi);
+ lws_service_do_ripe_rxflow(pt);
+
+ return 0;
+ }
+
+faked_service:
+ m = lws_service_flag_pending(context, tsi);
+ if (m)
+ c = -1; /* unknown limit */
+ else
+ if (n < 0) {
+ if (LWS_ERRNO != LWS_EINTR)
+ return -1;
+ return 0;
+ } else
+ c = n;
+
+ /* any socket with events to service? */
+ for (n = 0; n < (int)pt->fds_count && c; n++) {
+ if (!pt->fds[n].revents)
+ continue;
+
+ c--;
+
+ m = lws_service_fd_tsi(context, &pt->fds[n], tsi);
+ if (m < 0)
+ return -1;
+ /* if something closed, retry this slot */
+ if (m)
+ n--;
+ }
+
+ lws_service_do_ripe_rxflow(pt);
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_check_connection_error(struct lws *wsi)
+{
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_service(struct lws_context *context, int timeout_ms)
+{
+ return _lws_plat_service_tsi(context, timeout_ms, 0);
+}
+
+LWS_VISIBLE int
+lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
+{
+ int optval = 1;
+ socklen_t optlen = sizeof(optval);
+
+#ifdef LWS_WITH_IPV6
+ optval = 0;
+ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
+#endif
+
+#if defined(__APPLE__) || \
+ defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__) || \
+ defined(__OpenBSD__) || \
+ defined(__HAIKU__)
+ struct protoent *tcp_proto;
+#endif
+
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+
+ if (vhost->ka_time) {
+ /* enable keepalive on this socket */
+ optval = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
+ (const void *)&optval, optlen) < 0)
+ return 1;
+
+#if defined(__APPLE__) || \
+ defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__) || \
+ defined(__CYGWIN__) || defined(__OpenBSD__) || defined (__sun) || \
+ defined(__HAIKU__)
+
+ /*
+ * didn't find a way to set these per-socket, need to
+ * tune kernel systemwide values
+ */
+#else
+ /* set the keepalive conditions we want on it too */
+
+#if defined(LWS_HAVE_TCP_USER_TIMEOUT)
+ optval = 1000 * (vhost->ka_time +
+ (vhost->ka_interval * vhost->ka_probes));
+ if (setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT,
+ (const void *)&optval, optlen) < 0)
+ return 1;
+#endif
+ optval = vhost->ka_time;
+ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
+ (const void *)&optval, optlen) < 0)
+ return 1;
+
+ optval = vhost->ka_interval;
+ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL,
+ (const void *)&optval, optlen) < 0)
+ return 1;
+
+ optval = vhost->ka_probes;
+ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT,
+ (const void *)&optval, optlen) < 0)
+ return 1;
+#endif
+ }
+
+#if defined(SO_BINDTODEVICE)
+ if (vhost->bind_iface && vhost->iface) {
+ lwsl_info("binding listen skt to %s using SO_BINDTODEVICE\n", vhost->iface);
+ if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, vhost->iface,
+ strlen(vhost->iface)) < 0) {
+ lwsl_warn("Failed to bind to device %s\n", vhost->iface);
+ return 1;
+ }
+ }
+#endif
+
+ /* Disable Nagle */
+ optval = 1;
+#if defined (__sun) || defined(__QNX__)
+ if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
+ return 1;
+#elif !defined(__APPLE__) && \
+ !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
+ !defined(__NetBSD__) && \
+ !defined(__OpenBSD__) && \
+ !defined(__HAIKU__)
+ if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
+ return 1;
+#else
+ tcp_proto = getprotobyname("TCP");
+ if (setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, &optval, optlen) < 0)
+ return 1;
+#endif
+
+ /* We are nonblocking... */
+ if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
+ return 1;
+
+ return 0;
+}
+
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+static void
+_lws_plat_apply_caps(int mode, const cap_value_t *cv, int count)
+{
+ cap_t caps;
+
+ if (!count)
+ return;
+
+ caps = cap_get_proc();
+
+ cap_set_flag(caps, mode, count, cv, CAP_SET);
+ cap_set_proc(caps);
+ prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
+ cap_free(caps);
+}
+#endif
+
+LWS_VISIBLE void
+lws_plat_drop_app_privileges(const struct lws_context_creation_info *info)
+{
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+ int n;
+#endif
+
+ if (info->gid && info->gid != -1)
+ if (setgid(info->gid))
+ lwsl_warn("setgid: %s\n", strerror(LWS_ERRNO));
+
+ if (info->uid && info->uid != -1) {
+ struct passwd *p = getpwuid(info->uid);
+
+ if (p) {
+
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+ _lws_plat_apply_caps(CAP_PERMITTED, info->caps, info->count_caps);
+#endif
+
+ initgroups(p->pw_name, info->gid);
+ if (setuid(info->uid))
+ lwsl_warn("setuid: %s\n", strerror(LWS_ERRNO));
+ else
+ lwsl_notice("Set privs to user '%s'\n", p->pw_name);
+
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+ _lws_plat_apply_caps(CAP_EFFECTIVE, info->caps, info->count_caps);
+
+ if (info->count_caps)
+ for (n = 0; n < info->count_caps; n++)
+ lwsl_notice(" RETAINING CAPABILITY %d\n", (int)info->caps[n]);
+#endif
+
+ } else
+ lwsl_warn("getpwuid: unable to find uid %d", info->uid);
+ }
+}
+
+#ifdef LWS_WITH_PLUGINS
+
+#if defined(LWS_WITH_LIBUV) && UV_VERSION_MAJOR > 0
+
+/* libuv.c implements these in a cross-platform way */
+
+#else
+
+static int filter(const struct dirent *ent)
+{
+ if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
+ return 0;
+
+ return 1;
+}
+
+LWS_VISIBLE int
+lws_plat_plugins_init(struct lws_context * context, const char * const *d)
+{
+ struct lws_plugin_capability lcaps;
+ struct lws_plugin *plugin;
+ lws_plugin_init_func initfunc;
+ struct dirent **namelist;
+ int n, i, m, ret = 0;
+ char path[256];
+ void *l;
+
+ lwsl_notice(" Plugins:\n");
+
+ while (d && *d) {
+ n = scandir(*d, &namelist, filter, alphasort);
+ if (n < 0) {
+ lwsl_err("Scandir on %s failed\n", *d);
+ return 1;
+ }
+
+ for (i = 0; i < n; i++) {
+ if (strlen(namelist[i]->d_name) < 7)
+ goto inval;
+
+ lwsl_notice(" %s\n", namelist[i]->d_name);
+
+ lws_snprintf(path, sizeof(path) - 1, "%s/%s", *d,
+ namelist[i]->d_name);
+ l = dlopen(path, RTLD_NOW);
+ if (!l) {
+ lwsl_err("Error loading DSO: %s\n", dlerror());
+ while (i++ < n)
+ free(namelist[i]);
+ goto bail;
+ }
+ /* we could open it, can we get his init function? */
+ m = lws_snprintf(path, sizeof(path) - 1, "init_%s",
+ namelist[i]->d_name + 3 /* snip lib... */);
+ path[m - 3] = '\0'; /* snip the .so */
+ initfunc = dlsym(l, path);
+ if (!initfunc) {
+ lwsl_err("Failed to get init on %s: %s",
+ namelist[i]->d_name, dlerror());
+ dlclose(l);
+ }
+ lcaps.api_magic = LWS_PLUGIN_API_MAGIC;
+ m = initfunc(context, &lcaps);
+ if (m) {
+ lwsl_err("Initializing %s failed %d\n",
+ namelist[i]->d_name, m);
+ dlclose(l);
+ goto skip;
+ }
+
+ plugin = lws_malloc(sizeof(*plugin), "plugin");
+ if (!plugin) {
+ lwsl_err("OOM\n");
+ goto bail;
+ }
+ plugin->list = context->plugin_list;
+ context->plugin_list = plugin;
+ lws_strncpy(plugin->name, namelist[i]->d_name,
+ sizeof(plugin->name));
+ plugin->l = l;
+ plugin->caps = lcaps;
+ context->plugin_protocol_count += lcaps.count_protocols;
+ context->plugin_extension_count += lcaps.count_extensions;
+
+ free(namelist[i]);
+ continue;
+
+ skip:
+ dlclose(l);
+ inval:
+ free(namelist[i]);
+ }
+ free(namelist);
+ d++;
+ }
+
+bail:
+ free(namelist);
+
+ return ret;
+}
+
+LWS_VISIBLE int
+lws_plat_plugins_destroy(struct lws_context * context)
+{
+ struct lws_plugin *plugin = context->plugin_list, *p;
+ lws_plugin_destroy_func func;
+ char path[256];
+ int m;
+
+ if (!plugin)
+ return 0;
+
+ lwsl_notice("%s\n", __func__);
+
+ while (plugin) {
+ p = plugin;
+ m = lws_snprintf(path, sizeof(path) - 1, "destroy_%s", plugin->name + 3);
+ path[m - 3] = '\0';
+ func = dlsym(plugin->l, path);
+ if (!func) {
+ lwsl_err("Failed to get destroy on %s: %s",
+ plugin->name, dlerror());
+ goto next;
+ }
+ m = func(context);
+ if (m)
+ lwsl_err("Initializing %s failed %d\n",
+ plugin->name, m);
+next:
+ dlclose(p->l);
+ plugin = p->list;
+ p->list = NULL;
+ free(p);
+ }
+
+ context->plugin_list = NULL;
+
+ return 0;
+}
+
+#endif
+#endif
+
+
+#if 0
+static void
+sigabrt_handler(int x)
+{
+ printf("%s\n", __func__);
+}
+#endif
+
+LWS_VISIBLE int
+lws_plat_context_early_init(void)
+{
+#if !defined(LWS_AVOID_SIGPIPE_IGN)
+ signal(SIGPIPE, SIG_IGN);
+#endif
+
+ return 0;
+}
+
+LWS_VISIBLE void
+lws_plat_context_early_destroy(struct lws_context *context)
+{
+}
+
+LWS_VISIBLE void
+lws_plat_context_late_destroy(struct lws_context *context)
+{
+#ifdef LWS_WITH_PLUGINS
+ if (context->plugin_list)
+ lws_plat_plugins_destroy(context);
+#endif
+
+ if (context->lws_lookup)
+ lws_free(context->lws_lookup);
+
+ if (!context->fd_random)
+ lwsl_err("ZERO RANDOM FD\n");
+ if (context->fd_random != LWS_INVALID_FILE)
+ close(context->fd_random);
+}
+
+/* cast a struct sockaddr_in6 * into addr for ipv6 */
+
+LWS_VISIBLE int
+lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
+ size_t addrlen)
+{
+ int rc = LWS_ITOSA_NOT_EXIST;
+
+ struct ifaddrs *ifr;
+ struct ifaddrs *ifc;
+#ifdef LWS_WITH_IPV6
+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
+#endif
+
+ getifaddrs(&ifr);
+ for (ifc = ifr; ifc != NULL && rc; ifc = ifc->ifa_next) {
+ if (!ifc->ifa_addr)
+ continue;
+
+ lwsl_debug(" interface %s vs %s (fam %d) ipv6 %d\n", ifc->ifa_name, ifname, ifc->ifa_addr->sa_family, ipv6);
+
+ if (strcmp(ifc->ifa_name, ifname))
+ continue;
+
+ switch (ifc->ifa_addr->sa_family) {
+#if defined(AF_PACKET)
+ case AF_PACKET:
+ /* interface exists but is not usable */
+ rc = LWS_ITOSA_NOT_USABLE;
+ continue;
+#endif
+
+ case AF_INET:
+#ifdef LWS_WITH_IPV6
+ if (ipv6) {
+ /* map IPv4 to IPv6 */
+ bzero((char *)&addr6->sin6_addr,
+ sizeof(struct in6_addr));
+ addr6->sin6_addr.s6_addr[10] = 0xff;
+ addr6->sin6_addr.s6_addr[11] = 0xff;
+ memcpy(&addr6->sin6_addr.s6_addr[12],
+ &((struct sockaddr_in *)ifc->ifa_addr)->sin_addr,
+ sizeof(struct in_addr));
+ } else
+#endif
+ memcpy(addr,
+ (struct sockaddr_in *)ifc->ifa_addr,
+ sizeof(struct sockaddr_in));
+ break;
+#ifdef LWS_WITH_IPV6
+ case AF_INET6:
+ memcpy(&addr6->sin6_addr,
+ &((struct sockaddr_in6 *)ifc->ifa_addr)->sin6_addr,
+ sizeof(struct in6_addr));
+ break;
+#endif
+ default:
+ continue;
+ }
+ rc = LWS_ITOSA_USABLE;
+ }
+
+ freeifaddrs(ifr);
+
+ if (rc) {
+ /* check if bind to IP address */
+#ifdef LWS_WITH_IPV6
+ if (inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1)
+ rc = LWS_ITOSA_USABLE;
+ else
+#endif
+ if (inet_pton(AF_INET, ifname, &addr->sin_addr) == 1)
+ rc = LWS_ITOSA_USABLE;
+ }
+
+ return rc;
+}
+
+LWS_VISIBLE void
+lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+
+ if (context->event_loop_ops->io)
+ context->event_loop_ops->io(wsi, LWS_EV_START | LWS_EV_READ);
+
+ pt->fds[pt->fds_count++].revents = 0;
+}
+
+LWS_VISIBLE void
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+ struct lws *wsi, int m)
+{
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+
+ if (context->event_loop_ops->io)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
+
+ pt->fds_count--;
+}
+
+LWS_VISIBLE void
+lws_plat_service_periodic(struct lws_context *context)
+{
+ /* if our parent went down, don't linger around */
+ if (context->started_with_parent &&
+ kill(context->started_with_parent, 0) < 0)
+ kill(getpid(), SIGTERM);
+}
+
+LWS_VISIBLE int
+lws_plat_change_pollfd(struct lws_context *context,
+ struct lws *wsi, struct lws_pollfd *pfd)
+{
+ return 0;
+}
+
+LWS_VISIBLE const char *
+lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
+{
+ return inet_ntop(af, src, dst, cnt);
+}
+
+LWS_VISIBLE int
+lws_plat_inet_pton(int af, const char *src, void *dst)
+{
+ return inet_pton(af, src, dst);
+}
+
+LWS_VISIBLE lws_fop_fd_t
+_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ const char *vpath, lws_fop_flags_t *flags)
+{
+ struct stat stat_buf;
+ int ret = open(filename, (*flags) & LWS_FOP_FLAGS_MASK, 0664);
+ lws_fop_fd_t fop_fd;
+
+ if (ret < 0)
+ return NULL;
+
+ if (fstat(ret, &stat_buf) < 0)
+ goto bail;
+
+ fop_fd = malloc(sizeof(*fop_fd));
+ if (!fop_fd)
+ goto bail;
+
+ fop_fd->fops = fops;
+ fop_fd->flags = *flags;
+ fop_fd->fd = ret;
+ fop_fd->filesystem_priv = NULL; /* we don't use it */
+ fop_fd->len = stat_buf.st_size;
+ fop_fd->pos = 0;
+
+ return fop_fd;
+
+bail:
+ close(ret);
+ return NULL;
+}
+
+LWS_VISIBLE int
+_lws_plat_file_close(lws_fop_fd_t *fop_fd)
+{
+ int fd = (*fop_fd)->fd;
+
+ free(*fop_fd);
+ *fop_fd = NULL;
+
+ return close(fd);
+}
+
+LWS_VISIBLE lws_fileofs_t
+_lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
+{
+ lws_fileofs_t r;
+
+ if (offset > 0 &&
+ offset > (lws_fileofs_t)fop_fd->len - (lws_fileofs_t)fop_fd->pos)
+ offset = fop_fd->len - fop_fd->pos;
+
+ if ((lws_fileofs_t)fop_fd->pos + offset < 0)
+ offset = -fop_fd->pos;
+
+ r = lseek(fop_fd->fd, offset, SEEK_CUR);
+
+ if (r >= 0)
+ fop_fd->pos = r;
+ else
+ lwsl_err("error seeking from cur %ld, offset %ld\n",
+ (long)fop_fd->pos, (long)offset);
+
+ return r;
+}
+
+LWS_VISIBLE int
+_lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len)
+{
+ long n;
+
+ n = read((int)fop_fd->fd, buf, len);
+ if (n == -1) {
+ *amount = 0;
+ return -1;
+ }
+ fop_fd->pos += n;
+ lwsl_debug("%s: read %ld of req %ld, pos %ld, len %ld\n", __func__, n,
+ (long)len, (long)fop_fd->pos, (long)fop_fd->len);
+ *amount = n;
+
+ return 0;
+}
+
+LWS_VISIBLE int
+_lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len)
+{
+ long n;
+
+ n = write((int)fop_fd->fd, buf, len);
+ if (n == -1) {
+ *amount = 0;
+ return -1;
+ }
+
+ fop_fd->pos += n;
+ *amount = n;
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_init(struct lws_context *context,
+ const struct lws_context_creation_info *info)
+{
+ int fd;
+
+ /* master context has the global fd lookup array */
+ context->lws_lookup = lws_zalloc(sizeof(struct lws *) *
+ context->max_fds, "lws_lookup");
+ if (context->lws_lookup == NULL) {
+ lwsl_err("OOM on lws_lookup array for %d connections\n",
+ context->max_fds);
+ return 1;
+ }
+
+ lwsl_info(" mem: platform fd map: %5lu bytes\n",
+ (unsigned long)(sizeof(struct lws *) * context->max_fds));
+ fd = open(SYSTEM_RANDOM_FILEPATH, O_RDONLY);
+
+ context->fd_random = fd;
+ if (context->fd_random < 0) {
+ lwsl_err("Unable to open random device %s %d\n",
+ SYSTEM_RANDOM_FILEPATH, context->fd_random);
+ return 1;
+ }
+
+#ifdef LWS_WITH_PLUGINS
+ if (info->plugin_dirs)
+ lws_plat_plugins_init(context, info->plugin_dirs);
+#endif
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
+ int len)
+{
+ int n;
+
+ n = write(fd, buf, len);
+
+ fsync(fd);
+ lseek(fd, 0, SEEK_SET);
+
+ return n != len;
+}
+
+LWS_VISIBLE int
+lws_plat_write_file(const char *filename, void *buf, int len)
+{
+ int m, fd;
+
+ fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+ if (fd == -1)
+ return 1;
+
+ m = write(fd, buf, len);
+ close(fd);
+
+ return m != len;
+}
+
+LWS_VISIBLE int
+lws_plat_read_file(const char *filename, void *buf, int len)
+{
+ int n, fd = lws_open(filename, O_RDONLY);
+ if (fd == -1)
+ return -1;
+
+ n = read(fd, buf, len);
+ close(fd);
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_plat_recommended_rsa_bits(void)
+{
+ return 4096;
+}
diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
new file mode 100644
index 0000000000..26caab2cde
--- /dev/null
+++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
@@ -0,0 +1,852 @@
+#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
+#endif
+#include "core/private.h"
+
+void lws_plat_apply_FD_CLOEXEC(int n)
+{
+}
+
+int
+lws_plat_socket_offset(void)
+{
+ return 0;
+}
+
+int
+lws_plat_pipe_create(struct lws *wsi)
+{
+ return 1;
+}
+
+int
+lws_plat_pipe_signal(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ WSASetEvent(pt->events[0]); /* trigger the cancel event */
+
+ return 0;
+}
+
+void
+lws_plat_pipe_close(struct lws *wsi)
+{
+}
+
+unsigned long long
+time_in_microseconds()
+{
+#ifndef DELTA_EPOCH_IN_MICROSECS
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+#endif
+ FILETIME filetime;
+ ULARGE_INTEGER datetime;
+
+#ifdef _WIN32_WCE
+ GetCurrentFT(&filetime);
+#else
+ GetSystemTimeAsFileTime(&filetime);
+#endif
+
+ /*
+ * As per Windows documentation for FILETIME, copy the resulting
+ * FILETIME structure to a ULARGE_INTEGER structure using memcpy
+ * (using memcpy instead of direct assignment can prevent alignment
+ * faults on 64-bit Windows).
+ */
+ memcpy(&datetime, &filetime, sizeof(datetime));
+
+ /* Windows file times are in 100s of nanoseconds. */
+ return (datetime.QuadPart / 10) - DELTA_EPOCH_IN_MICROSECS;
+}
+
+#ifdef _WIN32_WCE
+time_t time(time_t *t)
+{
+ time_t ret = time_in_microseconds() / 1000000;
+
+ if(t != NULL)
+ *t = ret;
+
+ return ret;
+}
+#endif
+
+/* file descriptor hash management */
+
+struct lws *
+wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd)
+{
+ int h = LWS_FD_HASH(fd);
+ int n = 0;
+
+ for (n = 0; n < context->fd_hashtable[h].length; n++)
+ if (context->fd_hashtable[h].wsi[n]->desc.sockfd == fd)
+ return context->fd_hashtable[h].wsi[n];
+
+ return NULL;
+}
+
+int
+insert_wsi(struct lws_context *context, struct lws *wsi)
+{
+ int h = LWS_FD_HASH(wsi->desc.sockfd);
+
+ if (context->fd_hashtable[h].length == (getdtablesize() - 1)) {
+ lwsl_err("hash table overflow\n");
+ return 1;
+ }
+
+ context->fd_hashtable[h].wsi[context->fd_hashtable[h].length++] = wsi;
+
+ return 0;
+}
+
+int
+delete_from_fd(struct lws_context *context, lws_sockfd_type fd)
+{
+ int h = LWS_FD_HASH(fd);
+ int n = 0;
+
+ for (n = 0; n < context->fd_hashtable[h].length; n++)
+ if (context->fd_hashtable[h].wsi[n]->desc.sockfd == fd) {
+ while (n < context->fd_hashtable[h].length) {
+ context->fd_hashtable[h].wsi[n] =
+ context->fd_hashtable[h].wsi[n + 1];
+ n++;
+ }
+ context->fd_hashtable[h].length--;
+
+ return 0;
+ }
+
+ lwsl_err("Failed to find fd %d requested for "
+ "delete in hashtable\n", fd);
+ return 1;
+}
+
+LWS_VISIBLE int
+lws_get_random(struct lws_context *context, void *buf, int len)
+{
+ int n;
+ char *p = (char *)buf;
+
+ for (n = 0; n < len; n++)
+ p[n] = (unsigned char)rand();
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_send_pipe_choked(struct lws *wsi)
+{ struct lws *wsi_eff = wsi;
+
+#if defined(LWS_WITH_HTTP2)
+ wsi_eff = lws_get_network_wsi(wsi);
+#endif
+ /* the fact we checked implies we avoided back-to-back writes */
+ wsi_eff->could_have_pending = 0;
+
+ /* treat the fact we got a truncated send pending as if we're choked */
+ if (wsi_eff->trunc_len)
+ return 1;
+
+ return (int)wsi_eff->sock_send_blocking;
+}
+
+LWS_VISIBLE int
+lws_poll_listen_fd(struct lws_pollfd *fd)
+{
+ fd_set readfds;
+ struct timeval tv = { 0, 0 };
+
+ assert((fd->events & LWS_POLLIN) == LWS_POLLIN);
+
+ FD_ZERO(&readfds);
+ FD_SET(fd->fd, &readfds);
+
+ return select(((int)fd->fd) + 1, &readfds, NULL, NULL, &tv);
+}
+
+LWS_VISIBLE void
+lwsl_emit_syslog(int level, const char *line)
+{
+ lwsl_emit_stderr(level, line);
+}
+
+LWS_VISIBLE LWS_EXTERN int
+_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
+{
+ struct lws_context_per_thread *pt;
+ WSANETWORKEVENTS networkevents;
+ struct lws_pollfd *pfd;
+ struct lws *wsi;
+ unsigned int i;
+ DWORD ev;
+ int n, m;
+
+ /* stay dead once we are dead */
+ if (context == NULL || !context->vhost_list)
+ return 1;
+
+ pt = &context->pt[tsi];
+
+ if (!context->service_tid_detected) {
+ struct lws _lws;
+
+ memset(&_lws, 0, sizeof(_lws));
+ _lws.context = context;
+
+ context->service_tid_detected = context->vhost_list->
+ protocols[0].callback(&_lws, LWS_CALLBACK_GET_THREAD_ID,
+ NULL, NULL, 0);
+ context->service_tid = context->service_tid_detected;
+ context->service_tid_detected = 1;
+ }
+
+ if (timeout_ms < 0) {
+ if (lws_service_flag_pending(context, tsi)) {
+ /* any socket with events to service? */
+ for (n = 0; n < (int)pt->fds_count; n++) {
+ if (!pt->fds[n].revents)
+ continue;
+
+ m = lws_service_fd_tsi(context, &pt->fds[n], tsi);
+ if (m < 0)
+ return -1;
+ /* if something closed, retry this slot */
+ if (m)
+ n--;
+ }
+ }
+ return 0;
+ }
+
+ if (context->event_loop_ops->run_pt)
+ context->event_loop_ops->run_pt(context, tsi);
+
+ for (i = 0; i < pt->fds_count; ++i) {
+ pfd = &pt->fds[i];
+
+ if (!(pfd->events & LWS_POLLOUT))
+ continue;
+
+ wsi = wsi_from_fd(context, pfd->fd);
+ if (!wsi || wsi->listener)
+ continue;
+ if (wsi->sock_send_blocking)
+ continue;
+ pfd->revents = LWS_POLLOUT;
+ n = lws_service_fd(context, pfd);
+ if (n < 0)
+ return -1;
+
+ /* Force WSAWaitForMultipleEvents() to check events and then return immediately. */
+ timeout_ms = 0;
+
+ /* if something closed, retry this slot */
+ if (n)
+ i--;
+ }
+
+ /*
+ * is there anybody with pending stuff that needs service forcing?
+ */
+ if (!lws_service_adjust_timeout(context, 1, tsi)) {
+ /* -1 timeout means just do forced service */
+ _lws_plat_service_tsi(context, -1, pt->tid);
+ /* still somebody left who wants forced service? */
+ if (!lws_service_adjust_timeout(context, 1, pt->tid))
+ /* yes... come back again quickly */
+ timeout_ms = 0;
+ }
+
+ if (timeout_ms) {
+ lws_usec_t t;
+
+ lws_pt_lock(pt, __func__);
+ /* don't stay in poll wait longer than next hr timeout */
+ t = __lws_hrtimer_service(pt);
+
+ if ((lws_usec_t)timeout_ms * 1000 > t)
+ timeout_ms = (int)(t / 1000);
+ lws_pt_unlock(pt);
+ }
+
+ ev = WSAWaitForMultipleEvents(1, pt->events, FALSE, timeout_ms, FALSE);
+ if (ev == WSA_WAIT_EVENT_0) {
+ unsigned int eIdx, err;
+
+ WSAResetEvent(pt->events[0]);
+
+ if (pt->context->tls_ops &&
+ pt->context->tls_ops->fake_POLLIN_for_buffered)
+ pt->context->tls_ops->fake_POLLIN_for_buffered(pt);
+
+ for (eIdx = 0; eIdx < pt->fds_count; ++eIdx) {
+ if (WSAEnumNetworkEvents(pt->fds[eIdx].fd, 0,
+ &networkevents) == SOCKET_ERROR) {
+ lwsl_err("WSAEnumNetworkEvents() failed "
+ "with error %d\n", LWS_ERRNO);
+ return -1;
+ }
+
+ pfd = &pt->fds[eIdx];
+ pfd->revents = (short)networkevents.lNetworkEvents;
+
+ err = networkevents.iErrorCode[FD_CONNECT_BIT];
+
+ if ((networkevents.lNetworkEvents & FD_CONNECT) &&
+ err && err != LWS_EALREADY &&
+ err != LWS_EINPROGRESS && err != LWS_EWOULDBLOCK &&
+ err != WSAEINVAL) {
+ lwsl_debug("Unable to connect errno=%d\n", err);
+ pfd->revents |= LWS_POLLHUP;
+ }
+
+ if (pfd->revents & LWS_POLLOUT) {
+ wsi = wsi_from_fd(context, pfd->fd);
+ if (wsi)
+ wsi->sock_send_blocking = 0;
+ }
+ /* if something closed, retry this slot */
+ if (pfd->revents & LWS_POLLHUP)
+ --eIdx;
+
+ if (pfd->revents) {
+ recv(pfd->fd, NULL, 0, 0);
+ lws_service_fd_tsi(context, pfd, tsi);
+ }
+ }
+ }
+
+ context->service_tid = 0;
+
+ if (ev == WSA_WAIT_TIMEOUT)
+ lws_service_fd(context, NULL);
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_service(struct lws_context *context, int timeout_ms)
+{
+ return _lws_plat_service_tsi(context, timeout_ms, 0);
+}
+
+LWS_VISIBLE int
+lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
+{
+ int optval = 1;
+ int optlen = sizeof(optval);
+ u_long optl = 1;
+ DWORD dwBytesRet;
+ struct tcp_keepalive alive;
+ int protonbr;
+#ifndef _WIN32_WCE
+ struct protoent *tcp_proto;
+#endif
+
+#ifdef LWS_WITH_IPV6
+ optval = 0;
+ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
+#endif
+
+ if (vhost->ka_time) {
+ /* enable keepalive on this socket */
+ optval = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
+ (const char *)&optval, optlen) < 0)
+ return 1;
+
+ alive.onoff = TRUE;
+ alive.keepalivetime = vhost->ka_time;
+ alive.keepaliveinterval = vhost->ka_interval;
+
+ if (WSAIoctl(fd, SIO_KEEPALIVE_VALS, &alive, sizeof(alive),
+ NULL, 0, &dwBytesRet, NULL, NULL))
+ return 1;
+ }
+
+ /* Disable Nagle */
+ optval = 1;
+#ifndef _WIN32_WCE
+ tcp_proto = getprotobyname("TCP");
+ if (!tcp_proto) {
+ lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO);
+ return 1;
+ }
+ protonbr = tcp_proto->p_proto;
+#else
+ protonbr = 6;
+#endif
+
+ setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen);
+
+ /* We are nonblocking... */
+ ioctlsocket(fd, FIONBIO, &optl);
+
+ return 0;
+}
+
+LWS_VISIBLE void
+lws_plat_drop_app_privileges(const struct lws_context_creation_info *info)
+{
+}
+
+LWS_VISIBLE int
+lws_plat_context_early_init(void)
+{
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+
+ /* Use the MAKEWORD(lowbyte, highbyte) macro from Windef.h */
+ wVersionRequested = MAKEWORD(2, 2);
+
+ err = WSAStartup(wVersionRequested, &wsaData);
+ if (!err)
+ return 0;
+ /*
+ * Tell the user that we could not find a usable
+ * Winsock DLL
+ */
+ lwsl_err("WSAStartup failed with error: %d\n", err);
+
+ return 1;
+}
+
+LWS_VISIBLE void
+lws_plat_context_early_destroy(struct lws_context *context)
+{
+ struct lws_context_per_thread *pt = &context->pt[0];
+ int n = context->count_threads;
+
+ while (n--) {
+ if (pt->events) {
+ WSACloseEvent(pt->events[0]);
+ lws_free(pt->events);
+ }
+ pt++;
+ }
+}
+
+LWS_VISIBLE void
+lws_plat_context_late_destroy(struct lws_context *context)
+{
+ int n;
+
+ for (n = 0; n < FD_HASHTABLE_MODULUS; n++) {
+ if (context->fd_hashtable[n].wsi)
+ lws_free(context->fd_hashtable[n].wsi);
+ }
+
+ WSACleanup();
+}
+
+LWS_VISIBLE LWS_EXTERN int
+lws_interface_to_sa(int ipv6,
+ const char *ifname, struct sockaddr_in *addr, size_t addrlen)
+{
+#ifdef LWS_WITH_IPV6
+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
+
+ if (ipv6) {
+ if (lws_plat_inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1) {
+ return LWS_ITOSA_USABLE;
+ }
+ }
+#endif
+
+ long long address = inet_addr(ifname);
+
+ if (address == INADDR_NONE) {
+ struct hostent *entry = gethostbyname(ifname);
+ if (entry)
+ address = ((struct in_addr *)entry->h_addr_list[0])->s_addr;
+ }
+
+ if (address == INADDR_NONE)
+ return LWS_ITOSA_NOT_EXIST;
+
+ addr->sin_addr.s_addr = (unsigned long)(lws_intptr_t)address;
+
+ return LWS_ITOSA_USABLE;
+}
+
+LWS_VISIBLE void
+lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+
+ pt->fds[pt->fds_count++].revents = 0;
+ pt->events[pt->fds_count] = pt->events[0];
+ WSAEventSelect(wsi->desc.sockfd, pt->events[0],
+ LWS_POLLIN | LWS_POLLHUP | FD_CONNECT);
+}
+
+LWS_VISIBLE void
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+ struct lws *wsi, int m)
+{
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+
+ pt->events[m + 1] = pt->events[pt->fds_count--];
+}
+
+LWS_VISIBLE void
+lws_plat_service_periodic(struct lws_context *context)
+{
+}
+
+LWS_VISIBLE int
+lws_plat_check_connection_error(struct lws *wsi)
+{
+ int optVal;
+ int optLen = sizeof(int);
+
+ if (getsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_ERROR,
+ (char*)&optVal, &optLen) != SOCKET_ERROR && optVal &&
+ optVal != LWS_EALREADY && optVal != LWS_EINPROGRESS &&
+ optVal != LWS_EWOULDBLOCK && optVal != WSAEINVAL) {
+ lwsl_debug("Connect failed SO_ERROR=%d\n", optVal);
+ return 1;
+ }
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_change_pollfd(struct lws_context *context,
+ struct lws *wsi, struct lws_pollfd *pfd)
+{
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ long networkevents = LWS_POLLHUP | FD_CONNECT;
+
+ if ((pfd->events & LWS_POLLIN))
+ networkevents |= LWS_POLLIN;
+
+ if ((pfd->events & LWS_POLLOUT))
+ networkevents |= LWS_POLLOUT;
+
+ if (WSAEventSelect(wsi->desc.sockfd,
+ pt->events[0],
+ networkevents) != SOCKET_ERROR)
+ return 0;
+
+ lwsl_err("WSAEventSelect() failed with error %d\n", LWS_ERRNO);
+
+ return 1;
+}
+
+LWS_VISIBLE const char *
+lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
+{
+ WCHAR *buffer;
+ DWORD bufferlen = cnt;
+ BOOL ok = FALSE;
+
+ buffer = lws_malloc(bufferlen * 2, "inet_ntop");
+ if (!buffer) {
+ lwsl_err("Out of memory\n");
+ return NULL;
+ }
+
+ if (af == AF_INET) {
+ struct sockaddr_in srcaddr;
+ bzero(&srcaddr, sizeof(srcaddr));
+ srcaddr.sin_family = AF_INET;
+ memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr));
+
+ if (!WSAAddressToStringW((struct sockaddr*)&srcaddr, sizeof(srcaddr), 0, buffer, &bufferlen))
+ ok = TRUE;
+#ifdef LWS_WITH_IPV6
+ } else if (af == AF_INET6) {
+ struct sockaddr_in6 srcaddr;
+ bzero(&srcaddr, sizeof(srcaddr));
+ srcaddr.sin6_family = AF_INET6;
+ memcpy(&(srcaddr.sin6_addr), src, sizeof(srcaddr.sin6_addr));
+
+ if (!WSAAddressToStringW((struct sockaddr*)&srcaddr, sizeof(srcaddr), 0, buffer, &bufferlen))
+ ok = TRUE;
+#endif
+ } else
+ lwsl_err("Unsupported type\n");
+
+ if (!ok) {
+ int rv = WSAGetLastError();
+ lwsl_err("WSAAddressToString() : %d\n", rv);
+ } else {
+ if (WideCharToMultiByte(CP_ACP, 0, buffer, bufferlen, dst, cnt, 0, NULL) <= 0)
+ ok = FALSE;
+ }
+
+ lws_free(buffer);
+ return ok ? dst : NULL;
+}
+
+LWS_VISIBLE int
+lws_plat_inet_pton(int af, const char *src, void *dst)
+{
+ WCHAR *buffer;
+ DWORD bufferlen = (int)strlen(src) + 1;
+ BOOL ok = FALSE;
+
+ buffer = lws_malloc(bufferlen * 2, "inet_pton");
+ if (!buffer) {
+ lwsl_err("Out of memory\n");
+ return -1;
+ }
+
+ if (MultiByteToWideChar(CP_ACP, 0, src, bufferlen, buffer, bufferlen) <= 0) {
+ lwsl_err("Failed to convert multi byte to wide char\n");
+ lws_free(buffer);
+ return -1;
+ }
+
+ if (af == AF_INET) {
+ struct sockaddr_in dstaddr;
+ int dstaddrlen = sizeof(dstaddr);
+ bzero(&dstaddr, sizeof(dstaddr));
+ dstaddr.sin_family = AF_INET;
+
+ if (!WSAStringToAddressW(buffer, af, 0, (struct sockaddr *) &dstaddr, &dstaddrlen)) {
+ ok = TRUE;
+ memcpy(dst, &dstaddr.sin_addr, sizeof(dstaddr.sin_addr));
+ }
+#ifdef LWS_WITH_IPV6
+ } else if (af == AF_INET6) {
+ struct sockaddr_in6 dstaddr;
+ int dstaddrlen = sizeof(dstaddr);
+ bzero(&dstaddr, sizeof(dstaddr));
+ dstaddr.sin6_family = AF_INET6;
+
+ if (!WSAStringToAddressW(buffer, af, 0, (struct sockaddr *) &dstaddr, &dstaddrlen)) {
+ ok = TRUE;
+ memcpy(dst, &dstaddr.sin6_addr, sizeof(dstaddr.sin6_addr));
+ }
+#endif
+ } else
+ lwsl_err("Unsupported type\n");
+
+ if (!ok) {
+ int rv = WSAGetLastError();
+ lwsl_err("WSAAddressToString() : %d\n", rv);
+ }
+
+ lws_free(buffer);
+ return ok ? 1 : -1;
+}
+
+LWS_VISIBLE lws_fop_fd_t
+_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ const char *vpath, lws_fop_flags_t *flags)
+{
+ HANDLE ret;
+ WCHAR buf[MAX_PATH];
+ lws_fop_fd_t fop_fd;
+ FILE_STANDARD_INFO fInfo = {0};
+
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, LWS_ARRAY_SIZE(buf));
+
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 // Windows 8 (minimum when UWP_ENABLED, but can be used in Windows builds)
+ CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
+ extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+
+ if (((*flags) & 7) == _O_RDONLY) {
+ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams);
+ } else {
+ ret = CreateFile2(buf, GENERIC_WRITE, 0, CREATE_ALWAYS, &extParams);
+ }
+#else
+ if (((*flags) & 7) == _O_RDONLY) {
+ ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ } else {
+ ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ }
+#endif
+
+ if (ret == LWS_INVALID_FILE)
+ goto bail;
+
+ fop_fd = malloc(sizeof(*fop_fd));
+ if (!fop_fd)
+ goto bail;
+
+ fop_fd->fops = fops;
+ fop_fd->fd = ret;
+ fop_fd->filesystem_priv = NULL; /* we don't use it */
+ fop_fd->flags = *flags;
+ fop_fd->len = 0;
+ if(GetFileInformationByHandleEx(ret, FileStandardInfo, &fInfo, sizeof(fInfo)))
+ fop_fd->len = fInfo.EndOfFile.QuadPart;
+
+ fop_fd->pos = 0;
+
+ return fop_fd;
+
+bail:
+ return NULL;
+}
+
+LWS_VISIBLE int
+_lws_plat_file_close(lws_fop_fd_t *fop_fd)
+{
+ HANDLE fd = (*fop_fd)->fd;
+
+ free(*fop_fd);
+ *fop_fd = NULL;
+
+ CloseHandle((HANDLE)fd);
+
+ return 0;
+}
+
+LWS_VISIBLE lws_fileofs_t
+_lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
+{
+ LARGE_INTEGER l;
+
+ l.QuadPart = offset;
+ return SetFilePointerEx((HANDLE)fop_fd->fd, l, NULL, FILE_CURRENT);
+}
+
+LWS_VISIBLE int
+_lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t *buf, lws_filepos_t len)
+{
+ DWORD _amount;
+
+ if (!ReadFile((HANDLE)fop_fd->fd, buf, (DWORD)len, &_amount, NULL)) {
+ *amount = 0;
+
+ return 1;
+ }
+
+ fop_fd->pos += _amount;
+ *amount = (unsigned long)_amount;
+
+ return 0;
+}
+
+LWS_VISIBLE int
+_lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
+ uint8_t* buf, lws_filepos_t len)
+{
+ DWORD _amount;
+
+ if (!WriteFile((HANDLE)fop_fd->fd, buf, (DWORD)len, &_amount, NULL)) {
+ *amount = 0;
+
+ return 1;
+ }
+
+ fop_fd->pos += _amount;
+ *amount = (unsigned long)_amount;
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_plat_init(struct lws_context *context,
+ const struct lws_context_creation_info *info)
+{
+ struct lws_context_per_thread *pt = &context->pt[0];
+ int i, n = context->count_threads;
+
+ for (i = 0; i < FD_HASHTABLE_MODULUS; i++) {
+ context->fd_hashtable[i].wsi =
+ lws_zalloc(sizeof(struct lws*) * context->max_fds, "win hashtable");
+
+ if (!context->fd_hashtable[i].wsi)
+ return -1;
+ }
+
+ while (n--) {
+ pt->events = lws_malloc(sizeof(WSAEVENT) *
+ (context->fd_limit_per_thread + 1), "event table");
+ if (pt->events == NULL) {
+ lwsl_err("Unable to allocate events array for %d connections\n",
+ context->fd_limit_per_thread + 1);
+ return 1;
+ }
+
+ pt->fds_count = 0;
+ pt->events[0] = WSACreateEvent(); /* the cancel event */
+
+ pt++;
+ }
+
+ context->fd_random = 0;
+
+#ifdef LWS_WITH_PLUGINS
+ if (info->plugin_dirs)
+ lws_plat_plugins_init(context, info->plugin_dirs);
+#endif
+
+ return 0;
+}
+
+
+int kill(int pid, int sig)
+{
+ lwsl_err("Sorry Windows doesn't support kill().");
+ exit(0);
+}
+
+int fork(void)
+{
+ lwsl_err("Sorry Windows doesn't support fork().");
+ exit(0);
+}
+
+LWS_VISIBLE int
+lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
+ int len)
+{
+ int n;
+
+ n = write(fd, buf, len);
+
+ lseek(fd, 0, SEEK_SET);
+
+ return n != len;
+}
+
+LWS_VISIBLE int
+lws_plat_write_file(const char *filename, void *buf, int len)
+{
+ int m, fd;
+
+ fd = lws_open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+ if (fd == -1)
+ return -1;
+
+ m = write(fd, buf, len);
+ close(fd);
+
+ return m != len;
+}
+
+LWS_VISIBLE int
+lws_plat_read_file(const char *filename, void *buf, int len)
+{
+ int n, fd = lws_open(filename, O_RDONLY);
+ if (fd == -1)
+ return -1;
+
+ n = read(fd, buf, len);
+ close(fd);
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_plat_recommended_rsa_bits(void)
+{
+ return 4096;
+}
diff --git a/thirdparty/libwebsockets/lib/roles/h1/ops-h1.c b/thirdparty/libwebsockets/roles/h1/ops-h1.c
index 2fa0fe16e4..9001c864ea 100644
--- a/thirdparty/libwebsockets/lib/roles/h1/ops-h1.c
+++ b/thirdparty/libwebsockets/roles/h1/ops-h1.c
@@ -42,7 +42,7 @@ lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len)
lws_filepos_t body_chunk_len;
size_t n;
- lwsl_debug("%s: h1 path: wsi state 0x%x\n", __func__, lwsi_state(wsi));
+ // lwsl_notice("%s: h1 path: wsi state 0x%x\n", __func__, lwsi_state(wsi));
switch (lwsi_state(wsi)) {
@@ -90,6 +90,7 @@ lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len)
* appropriately:
*/
len -= (buf - last_char);
+// lwsl_debug("%s: thinks we have used %ld\n", __func__, (long)len);
if (!wsi->hdr_parsing_completed)
/* More header content on the way */
@@ -118,10 +119,6 @@ lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len)
http_postbody:
lwsl_debug("%s: http post body: remain %d\n", __func__,
(int)wsi->http.rx_content_remain);
-
- if (!wsi->http.rx_content_remain)
- goto postbody_completion;
-
while (len && wsi->http.rx_content_remain) {
/* Copy as much as possible, up to the limit of:
* what we have in the read buffer (len)
@@ -161,8 +158,7 @@ http_postbody:
buf += n;
if (wsi->http.rx_content_remain) {
- lws_set_timeout(wsi,
- PENDING_TIMEOUT_HTTP_CONTENT,
+ lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT,
wsi->context->timeout_secs);
break;
}
@@ -225,7 +221,7 @@ ws_mode:
break;
case LRS_DEFERRING_ACTION:
- lwsl_notice("%s: LRS_DEFERRING_ACTION\n", __func__);
+ lwsl_debug("%s: LRS_DEFERRING_ACTION\n", __func__);
break;
case LRS_SSL_ACK_PENDING:
@@ -315,8 +311,7 @@ lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)
lwsi_state(wsi) == LRS_BODY)) {
if (!wsi->http.ah && lws_header_table_attach(wsi, 0)) {
- lwsl_info("%s: wsi %p: ah not available\n", __func__,
- wsi);
+ lwsl_info("%s: wsi %p: ah not available\n", __func__, wsi);
goto try_pollout;
}
@@ -342,8 +337,7 @@ lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)
* and draining the extensions
*/
if (wsi->ws &&
- (wsi->ws->rx_draining_ext ||
- wsi->ws->tx_draining_ext))
+ (wsi->ws->rx_draining_ext || wsi->ws->tx_draining_ext))
goto try_pollout;
#endif
/*
@@ -451,9 +445,10 @@ try_pollout:
if (lwsi_state(wsi) != LRS_ISSUING_FILE) {
- if (lws_has_buffered_out(wsi)) {
+ if (wsi->trunc_len) {
//lwsl_notice("%s: completing partial\n", __func__);
- if (lws_issue_raw(wsi, NULL, 0) < 0) {
+ if (lws_issue_raw(wsi, wsi->trunc_alloc + wsi->trunc_offset,
+ wsi->trunc_len) < 0) {
lwsl_info("%s signalling to close\n", __func__);
goto fail;
}
@@ -464,7 +459,7 @@ try_pollout:
LWSSTATS_C_WRITEABLE_CB, 1);
#if defined(LWS_WITH_STATS)
if (wsi->active_writable_req_us) {
- uint64_t ul = lws_time_in_microseconds() -
+ uint64_t ul = time_in_microseconds() -
wsi->active_writable_req_us;
lws_stats_atomic_bump(wsi->context, pt,
@@ -524,58 +519,6 @@ rops_handle_POLLIN_h1(struct lws_context_per_thread *pt, struct lws *wsi,
}
#endif
-#if 0
-
- /*
- * !!! lws_serve_http_file_fragment() seems to duplicate most of
- * lws_handle_POLLOUT_event() in its own loop...
- */
- lwsl_debug("%s: %d %d\n", __func__, (pollfd->revents & LWS_POLLOUT),
- lwsi_state_can_handle_POLLOUT(wsi));
-
- if ((pollfd->revents & LWS_POLLOUT) &&
- lwsi_state_can_handle_POLLOUT(wsi) &&
- lws_handle_POLLOUT_event(wsi, pollfd)) {
- if (lwsi_state(wsi) == LRS_RETURNED_CLOSE)
- lwsi_set_state(wsi, LRS_FLUSHING_BEFORE_CLOSE);
- /* the write failed... it's had it */
- wsi->socket_is_permanently_unusable = 1;
-
- return LWS_HPI_RET_PLEASE_CLOSE_ME;
- }
-#endif
-
-
- /* Priority 2: pre- compression transform */
-
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more) {
- enum lws_write_protocol wp = LWS_WRITE_HTTP;
-
- lwsl_info("%s: completing comp partial (buflist_comp %p, may %d)\n",
- __func__, wsi->http.comp_ctx.buflist_comp,
- wsi->http.comp_ctx.may_have_more
- );
-
- if (wsi->role_ops->write_role_protocol(wsi, NULL, 0, &wp) < 0) {
- lwsl_info("%s signalling to close\n", __func__);
- return LWS_HPI_RET_PLEASE_CLOSE_ME;
- }
- lws_callback_on_writable(wsi);
-
- if (!wsi->http.comp_ctx.buflist_comp &&
- !wsi->http.comp_ctx.may_have_more &&
- wsi->http.deferred_transaction_completed) {
- wsi->http.deferred_transaction_completed = 0;
- if (lws_http_transaction_completed(wsi))
- return LWS_HPI_RET_PLEASE_CLOSE_ME;
- }
-
- return LWS_HPI_RET_HANDLED;
- }
-#endif
-
if (lws_is_flowcontrolled(wsi))
/* We cannot deal with any kind of new RX because we are
* RX-flowcontrolled.
@@ -586,14 +529,12 @@ rops_handle_POLLIN_h1(struct lws_context_per_thread *pt, struct lws *wsi,
if (!lwsi_role_client(wsi)) {
int n;
- lwsl_debug("%s: %p: wsistate 0x%x\n", __func__, wsi,
- wsi->wsistate);
+ lwsl_debug("%s: %p: wsistate 0x%x\n", __func__, wsi, wsi->wsistate);
n = lws_h1_server_socket_service(wsi, pollfd);
if (n != LWS_HPI_RET_HANDLED)
return n;
if (lwsi_state(wsi) != LRS_SSL_INIT)
- if (lws_server_socket_service_ssl(wsi,
- LWS_SOCK_INVALID))
+ if (lws_server_socket_service_ssl(wsi, LWS_SOCK_INVALID))
return LWS_HPI_RET_PLEASE_CLOSE_ME;
return LWS_HPI_RET_HANDLED;
@@ -623,9 +564,10 @@ rops_handle_POLLIN_h1(struct lws_context_per_thread *pt, struct lws *wsi,
/* let user code know, he'll usually ask for writeable
* callback and drain / re-enable it there
*/
- if (user_callback_handle_rxflow(wsi->protocol->callback, wsi,
- LWS_CALLBACK_RECEIVE_CLIENT_HTTP,
- wsi->user_space, NULL, 0)) {
+ if (user_callback_handle_rxflow(
+ wsi->protocol->callback,
+ wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP,
+ wsi->user_space, NULL, 0)) {
lwsl_info("RECEIVE_CLIENT_HTTP closed it\n");
return LWS_HPI_RET_PLEASE_CLOSE_ME;
}
@@ -666,68 +608,19 @@ static int
rops_write_role_protocol_h1(struct lws *wsi, unsigned char *buf, size_t len,
enum lws_write_protocol *wp)
{
- size_t olen = len;
- int n;
-
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.lcs && (((*wp) & 0x1f) == LWS_WRITE_HTTP_FINAL ||
- ((*wp) & 0x1f) == LWS_WRITE_HTTP)) {
- unsigned char mtubuf[1400 + LWS_PRE +
- LWS_HTTP_CHUNK_HDR_MAX_SIZE +
- LWS_HTTP_CHUNK_TRL_MAX_SIZE],
- *out = mtubuf + LWS_PRE +
- LWS_HTTP_CHUNK_HDR_MAX_SIZE;
- size_t o = sizeof(mtubuf) - LWS_PRE -
- LWS_HTTP_CHUNK_HDR_MAX_SIZE -
- LWS_HTTP_CHUNK_TRL_MAX_SIZE;
-
- n = lws_http_compression_transform(wsi, buf, len, wp, &out, &o);
- if (n)
- return n;
-
- lwsl_info("%s: %p: transformed %d bytes to %d "
- "(wp 0x%x, more %d)\n", __func__, wsi, (int)len,
- (int)o, (int)*wp, wsi->http.comp_ctx.may_have_more);
-
- if (!o)
- return olen;
-
- if (wsi->http.comp_ctx.chunking) {
- char c[LWS_HTTP_CHUNK_HDR_MAX_SIZE + 2];
- /*
- * this only needs dealing with on http/1.1 to allow
- * pipelining
- */
- n = lws_snprintf(c, sizeof(c), "%X\x0d\x0a", (int)o);
- lwsl_info("%s: chunk (%d) %s", __func__, (int)o, c);
- out -= n;
- o += n;
- memcpy(out, c, n);
- out[o++] = '\x0d';
- out[o++] = '\x0a';
-
- if (((*wp) & 0x1f) == LWS_WRITE_HTTP_FINAL) {
- lwsl_info("%s: final chunk\n", __func__);
- out[o++] = '0';
- out[o++] = '\x0d';
- out[o++] = '\x0a';
- out[o++] = '\x0d';
- out[o++] = '\x0a';
- }
- }
+#if 0
+ /* if not in a state to send stuff, then just send nothing */
- buf = out;
- len = o;
+ if ((lwsi_state(wsi) != LRS_RETURNED_CLOSE &&
+ lwsi_state(wsi) != LRS_WAITING_TO_SEND_CLOSE &&
+ lwsi_state(wsi) != LRS_AWAITING_CLOSE_ACK)) {
+ //assert(0);
+ lwsl_debug("binning %d %d\n", lwsi_state(wsi), *wp);
+ return 0;
}
#endif
- n = lws_issue_raw(wsi, (unsigned char *)buf, len);
- if (n < 0)
- return n;
-
- /* hide there may have been compression */
-
- return (int)olen;
+ return lws_issue_raw(wsi, (unsigned char *)buf, len);
}
static int
@@ -773,230 +666,12 @@ rops_destroy_role_h1(struct lws *wsi)
ah = ah->next;
}
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- lws_http_compression_destroy(wsi);
-#endif
-
#ifdef LWS_ROLE_WS
lws_free_set_NULL(wsi->ws);
#endif
return 0;
}
-#if !defined(LWS_NO_SERVER)
-
-static int
-rops_adoption_bind_h1(struct lws *wsi, int type, const char *vh_prot_name)
-{
- if (!(type & LWS_ADOPT_HTTP))
- return 0; /* no match */
-
-
- if (type & _LWS_ADOPT_FINISH) {
- if (!lws_header_table_attach(wsi, 0))
- lwsl_debug("Attached ah immediately\n");
- else
- lwsl_info("%s: waiting for ah\n", __func__);
-
- return 1;
- }
-
- lws_role_transition(wsi, LWSIFR_SERVER, (type & LWS_ADOPT_ALLOW_SSL) ?
- LRS_SSL_INIT : LRS_HEADERS, &role_ops_h1);
-
- if (!vh_prot_name)
- wsi->protocol = &wsi->vhost->protocols[
- wsi->vhost->default_protocol_index];
-
- /* the transport is accepted... give him time to negotiate */
- lws_set_timeout(wsi, PENDING_TIMEOUT_ESTABLISH_WITH_SERVER,
- wsi->context->timeout_secs);
-
- return 1; /* bound */
-}
-
-#endif
-
-#if !defined(LWS_NO_CLIENT)
-
-static const char * const http_methods[] = {
- "GET", "POST", "OPTIONS", "PUT", "PATCH", "DELETE", "CONNECT"
-};
-
-static int
-rops_client_bind_h1(struct lws *wsi, const struct lws_client_connect_info *i)
-{
- int n;
-
- if (!i) {
- /* we are finalizing an already-selected role */
-
- /*
- * If we stay in http, assuming there wasn't already-set
- * external user_space, since we know our initial protocol
- * we can assign the user space now, otherwise do it after the
- * ws subprotocol negotiated
- */
- if (!wsi->user_space && wsi->stash->method)
- if (lws_ensure_user_space(wsi))
- return 1;
-
- /*
- * For ws, default to http/1.1 only. If i->alpn had been set
- * though, defer to whatever he has set in there (eg, "h2").
- *
- * The problem is he has to commit to h2 before he can find
- * out if the server has the SETTINGS for ws-over-h2 enabled;
- * if not then ws is not possible on that connection. So we
- * only try h2 if he assertively said to use h2 alpn, otherwise
- * ws implies alpn restriction to h1.
- */
- if (!wsi->stash->method && !wsi->stash->alpn) {
- wsi->stash->alpn = lws_strdup("http/1.1");
- if (!wsi->stash->alpn)
- return 1;
- }
-
- /* if we went on the ah waiting list, it's ok, we can wait.
- *
- * When we do get the ah, now or later, he will end up at
- * lws_http_client_connect_via_info2().
- */
- if (lws_header_table_attach(wsi, 0) < 0)
- /*
- * if we failed here, the connection is already closed
- * and freed.
- */
- return -1;
-
- return 0;
- }
-
- /*
- * Clients that want to be h1, h2, or ws all start out as h1
- * (we don't yet know if the server supports h2 or ws)
- */
-
- if (!i->method) { /* websockets */
-#if defined(LWS_ROLE_WS)
- if (lws_create_client_ws_object(i, wsi))
- goto fail_wsi;
-#else
- lwsl_err("%s: ws role not configured\n", __func__);
-
- goto fail_wsi;
-#endif
- goto bind_h1;
- }
-
- /* if a recognized http method, bind to it */
-
- for (n = 0; n < (int)LWS_ARRAY_SIZE(http_methods); n++)
- if (!strcmp(i->method, http_methods[n]))
- goto bind_h1;
-
- /* other roles may bind to it */
-
- return 0; /* no match */
-
-bind_h1:
- /* assert the mode and union status (hdr) clearly */
- lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, &role_ops_h1);
-
- return 1; /* matched */
-
-fail_wsi:
- return -1;
-}
-#endif
-
-#if 0
-static int
-rops_perform_user_POLLOUT_h1(struct lws *wsi)
-{
- volatile struct lws *vwsi = (volatile struct lws *)wsi;
- int n;
-
- /* priority 1: post compression-transform buffered output */
-
- if (lws_has_buffered_out(wsi)) {
- lwsl_debug("%s: completing partial\n", __func__);
- if (lws_issue_raw(wsi, NULL, 0) < 0) {
- lwsl_info("%s signalling to close\n", __func__);
- return -1;
- }
- n = 0;
- vwsi->leave_pollout_active = 1;
- goto cleanup;
- }
-
- /* priority 2: pre compression-transform buffered output */
-
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more) {
- enum lws_write_protocol wp = LWS_WRITE_HTTP;
-
- lwsl_info("%s: completing comp partial"
- "(buflist_comp %p, may %d)\n",
- __func__, wsi->http.comp_ctx.buflist_comp,
- wsi->http.comp_ctx.may_have_more);
-
- if (rops_write_role_protocol_h1(wsi, NULL, 0, &wp) < 0) {
- lwsl_info("%s signalling to close\n", __func__);
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
- "comp write fail");
- }
- n = 0;
- vwsi->leave_pollout_active = 1;
- goto cleanup;
- }
-#endif
-
- /* priority 3: if no buffered out and waiting for that... */
-
- if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE) {
- wsi->socket_is_permanently_unusable = 1;
- return -1;
- }
-
- /* priority 4: user writeable callback */
-
- vwsi = (volatile struct lws *)wsi;
- vwsi->leave_pollout_active = 0;
-
- n = lws_callback_as_writeable(wsi);
-
-cleanup:
- vwsi->handling_pollout = 0;
-
- if (vwsi->leave_pollout_active)
- lws_change_pollfd(wsi, 0, LWS_POLLOUT);
-
- return n;
-}
-#endif
-
-static int
-rops_close_kill_connection_h1(struct lws *wsi, enum lws_close_status reason)
-{
-#if defined(LWS_WITH_HTTP_PROXY)
- struct lws *wsi_eff = lws_client_wsi_effective(wsi);
-
- if (!wsi_eff->http.proxy_clientside)
- return 0;
-
- wsi_eff->http.proxy_clientside = 0;
-
- if (user_callback_handle_rxflow(wsi_eff->protocol->callback, wsi_eff,
- LWS_CALLBACK_COMPLETED_CLIENT_HTTP,
- wsi_eff->user_space, NULL, 0))
- return 0;
-#endif
- return 0;
-}
-
-
struct lws_role_ops role_ops_h1 = {
/* role name */ "h1",
/* alpn id */ "http/1.1",
@@ -1016,25 +691,11 @@ struct lws_role_ops role_ops_h1 = {
/* alpn_negotiated */ rops_alpn_negotiated_h1,
/* close_via_role_protocol */ NULL,
/* close_role */ NULL,
- /* close_kill_connection */ rops_close_kill_connection_h1,
+ /* close_kill_connection */ NULL,
/* destroy_role */ rops_destroy_role_h1,
-#if !defined(LWS_NO_SERVER)
- /* adoption_bind */ rops_adoption_bind_h1,
-#else
- NULL,
-#endif
-#if !defined(LWS_NO_CLIENT)
- /* client_bind */ rops_client_bind_h1,
-#else
- NULL,
-#endif
/* writeable cb clnt, srv */ { LWS_CALLBACK_CLIENT_HTTP_WRITEABLE,
LWS_CALLBACK_HTTP_WRITEABLE },
/* close cb clnt, srv */ { LWS_CALLBACK_CLOSED_CLIENT_HTTP,
LWS_CALLBACK_CLOSED_HTTP },
- /* protocol_bind cb c, srv */ { LWS_CALLBACK_CLIENT_HTTP_BIND_PROTOCOL,
- LWS_CALLBACK_HTTP_BIND_PROTOCOL },
- /* protocol_unbind cb c, srv */ { LWS_CALLBACK_CLIENT_HTTP_DROP_PROTOCOL,
- LWS_CALLBACK_HTTP_DROP_PROTOCOL },
/* file_handle */ 0,
};
diff --git a/thirdparty/libwebsockets/lib/roles/h1/private.h b/thirdparty/libwebsockets/roles/h1/private.h
index 3f53954d33..3f53954d33 100644
--- a/thirdparty/libwebsockets/lib/roles/h1/private.h
+++ b/thirdparty/libwebsockets/roles/h1/private.h
diff --git a/thirdparty/libwebsockets/lib/roles/http/client/client-handshake.c b/thirdparty/libwebsockets/roles/http/client/client-handshake.c
index 6b4e98f346..0095c79a69 100644
--- a/thirdparty/libwebsockets/lib/roles/http/client/client-handshake.c
+++ b/thirdparty/libwebsockets/roles/http/client/client-handshake.c
@@ -37,14 +37,9 @@ lws_client_connect_2(struct lws *wsi)
ssize_t plen = 0;
#endif
struct addrinfo *result;
-#if defined(LWS_WITH_UNIX_SOCK)
- struct sockaddr_un sau;
- char unix_skt = 0;
-#endif
const char *ads;
sockaddr46 sa46;
- const struct sockaddr *psa;
- int n, port = 0;
+ int n, port;
const char *cce = "", *iface;
const char *meth = NULL;
#ifdef LWS_WITH_IPV6
@@ -131,7 +126,7 @@ lws_client_connect_2(struct lws *wsi)
}
#endif
- lwsl_info("applying %p to txn queue on %p state 0x%x\n",
+ lwsl_info("applying %p to txn queue on %p (wsistate 0x%x)\n",
wsi, w, w->wsistate);
/*
* ...let's add ourselves to his transaction queue...
@@ -182,36 +177,12 @@ create_new_conn:
lws_dll_is_null(&wsi->dll_client_transaction_queue) &&
lws_dll_is_null(&wsi->dll_active_client_conns)) {
lws_vhost_lock(wsi->vhost);
- /* caution... we will have to unpick this on oom4 path */
lws_dll_lws_add_front(&wsi->dll_active_client_conns,
&wsi->vhost->dll_active_client_conns);
lws_vhost_unlock(wsi->vhost);
}
/*
- * unix socket destination?
- */
-
- ads = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS);
-#if defined(LWS_WITH_UNIX_SOCK)
- if (*ads == '+') {
- ads++;
- memset(&sau, 0, sizeof(sau));
- sau.sun_family = AF_UNIX;
- strncpy(sau.sun_path, ads, sizeof(sau.sun_path));
- sau.sun_path[sizeof(sau.sun_path) - 1] = '\0';
-
- lwsl_info("%s: Unix skt: %s\n", __func__, ads);
-
- if (sau.sun_path[0] == '@')
- sau.sun_path[0] = '\0';
-
- unix_skt = 1;
- goto ads_known;
- }
-#endif
-
- /*
* start off allowing ipv6 on connection if vhost allows it
*/
wsi->ipv6 = LWS_IPV6_ENABLED(wsi->vhost);
@@ -270,9 +241,10 @@ create_new_conn:
#ifdef LWS_WITH_IPV6
if (wsi->ipv6) {
- struct sockaddr_in6 *sa6;
+ struct sockaddr_in6 *sa6 =
+ ((struct sockaddr_in6 *)result->ai_addr);
- if (n || !result) {
+ if (n) {
/* lws_getaddrinfo46 failed, there is no usable result */
lwsl_notice("%s: lws_getaddrinfo46 failed %d\n",
__func__, n);
@@ -280,8 +252,6 @@ create_new_conn:
goto oom4;
}
- sa6 = ((struct sockaddr_in6 *)result->ai_addr);
-
memset(&sa46, 0, sizeof(sa46));
sa46.sa6.sin6_family = AF_INET6;
@@ -337,7 +307,7 @@ create_new_conn:
} else if (n == EAI_SYSTEM) {
struct hostent *host;
- lwsl_info("ipv4 getaddrinfo err, try gethostbyname\n");
+ lwsl_info("getaddrinfo (ipv4) failed, trying gethostbyname\n");
host = gethostbyname(ads);
if (host) {
p = host->h_addr;
@@ -348,7 +318,7 @@ create_new_conn:
}
#endif
} else {
- lwsl_err("getaddrinfo failed: %d\n", n);
+ lwsl_err("getaddrinfo failed\n");
cce = "getaddrinfo failed";
goto oom4;
}
@@ -369,10 +339,6 @@ create_new_conn:
if (result)
freeaddrinfo(result);
-#if defined(LWS_WITH_UNIX_SOCK)
-ads_known:
-#endif
-
/* now we decided on ipv4 or ipv6, set the port */
if (!lws_socket_is_valid(wsi->desc.sockfd)) {
@@ -383,21 +349,12 @@ ads_known:
goto oom4;
}
-#if defined(LWS_WITH_UNIX_SOCK)
- if (unix_skt) {
- wsi->unix_skt = 1;
- wsi->desc.sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
- } else
-#endif
- {
-
#ifdef LWS_WITH_IPV6
if (wsi->ipv6)
wsi->desc.sockfd = socket(AF_INET6, SOCK_STREAM, 0);
else
#endif
wsi->desc.sockfd = socket(AF_INET, SOCK_STREAM, 0);
- }
if (!lws_socket_is_valid(wsi->desc.sockfd)) {
lwsl_warn("Unable to open socket\n");
@@ -405,12 +362,7 @@ ads_known:
goto oom4;
}
- if (lws_plat_set_socket_options(wsi->vhost, wsi->desc.sockfd,
-#if defined(LWS_WITH_UNIX_SOCK)
- unix_skt)) {
-#else
- 0)) {
-#endif
+ if (lws_plat_set_socket_options(wsi->vhost, wsi->desc.sockfd)) {
lwsl_err("Failed to set wsi socket options\n");
compatible_close(wsi->desc.sockfd);
cce = "set socket opts failed";
@@ -420,11 +372,7 @@ ads_known:
lwsi_set_state(wsi, LRS_WAITING_CONNECT);
if (wsi->context->event_loop_ops->accept)
- if (wsi->context->event_loop_ops->accept(wsi)) {
- compatible_close(wsi->desc.sockfd);
- cce = "event loop accept failed";
- goto oom4;
- }
+ wsi->context->event_loop_ops->accept(wsi);
if (__insert_wsi_socket_into_fds(wsi->context, wsi)) {
compatible_close(wsi->desc.sockfd);
@@ -451,8 +399,7 @@ ads_known:
iface = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_IFACE);
if (iface) {
- n = lws_socket_bind(wsi->vhost, wsi->desc.sockfd, 0,
- iface);
+ n = lws_socket_bind(wsi->vhost, wsi->desc.sockfd, 0, iface);
if (n < 0) {
cce = "unable to bind socket";
goto failed;
@@ -460,29 +407,18 @@ ads_known:
}
}
-#if defined(LWS_WITH_UNIX_SOCK)
- if (unix_skt) {
- psa = (const struct sockaddr *)&sau;
- n = sizeof(sau);
+#ifdef LWS_WITH_IPV6
+ if (wsi->ipv6) {
+ sa46.sa6.sin6_port = htons(port);
+ n = sizeof(struct sockaddr_in6);
} else
#endif
-
{
-#ifdef LWS_WITH_IPV6
- if (wsi->ipv6) {
- sa46.sa6.sin6_port = htons(port);
- n = sizeof(struct sockaddr_in6);
- psa = (const struct sockaddr *)&sa46;
- } else
-#endif
- {
- sa46.sa4.sin_port = htons(port);
- n = sizeof(struct sockaddr);
- psa = (const struct sockaddr *)&sa46;
- }
+ sa46.sa4.sin_port = htons(port);
+ n = sizeof(struct sockaddr);
}
- if (connect(wsi->desc.sockfd, (const struct sockaddr *)psa, n) == -1 ||
+ if (connect(wsi->desc.sockfd, (const struct sockaddr *)&sa46, n) == -1 ||
LWS_ERRNO == LWS_EISCONN) {
if (LWS_ERRNO == LWS_EALREADY ||
LWS_ERRNO == LWS_EINPROGRESS ||
@@ -564,8 +500,7 @@ ads_known:
goto failed;
}
- lws_set_timeout(wsi,
- PENDING_TIMEOUT_AWAITING_SOCKS_GREETING_REPLY,
+ lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SOCKS_GREETING_REPLY,
AWAITING_TIMEOUT);
lwsi_set_state(wsi, LRS_WAITING_SOCKS_GREETING_REPLY);
@@ -596,7 +531,7 @@ send_hs:
* wait in the queue until it's possible to send them.
*/
lws_callback_on_writable(wsi_piggyback);
- lwsl_info("%s: wsi %p: waiting to send hdrs (par state 0x%x)\n",
+ lwsl_info("%s: wsi %p: waiting to send headers (parent state %x)\n",
__func__, wsi, lwsi_state(wsi_piggyback));
} else {
lwsl_info("%s: wsi %p: client creating own connection\n",
@@ -635,7 +570,7 @@ send_hs:
return wsi;
oom4:
- if (lwsi_role_client(wsi) /* && lwsi_state_est(wsi) */) {
+ if (lwsi_role_client(wsi) && lwsi_state_est(wsi)) {
wsi->protocol->callback(wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space, (void *)cce, strlen(cce));
@@ -644,21 +579,13 @@ oom4:
/* take care that we might be inserted in fds already */
if (wsi->position_in_fds_table != LWS_NO_FDS_POS)
goto failed1;
-
- /*
- * We can't be an active client connection any more, if we thought
- * that was what we were going to be doing. It should be if we are
- * failing by oom4 path, we are still called by
- * lws_client_connect_via_info() and will be returning NULL to that,
- * so nobody else should have had a chance to queue on us.
- */
- {
- struct lws_vhost *vhost = wsi->vhost;
-
- lws_vhost_lock(vhost);
- __lws_free_wsi(wsi);
- lws_vhost_unlock(vhost);
- }
+ lws_remove_from_timeout_list(wsi);
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ lws_header_table_detach(wsi, 0);
+#endif
+ lws_client_stash_destroy(wsi);
+ lws_free_set_NULL(wsi->client_hostname_copy);
+ lws_free(wsi);
return NULL;
@@ -676,8 +603,7 @@ failed1:
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
/**
- * lws_client_reset() - retarget a connected wsi to start over with a new
- * connection (ie, redirect)
+ * lws_client_reset() - retarget a connected wsi to start over with a new connection (ie, redirect)
* this only works if still in HTTP, ie, not upgraded yet
* wsi: connection to reset
* address: network address of the new server
@@ -790,7 +716,7 @@ lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,
return *pwsi;
}
-#if defined(LWS_WITH_HTTP_PROXY) && defined(LWS_WITH_HUBBUB)
+#ifdef LWS_WITH_HTTP_PROXY
hubbub_error
html_parser_cb(const hubbub_token *token, void *pw)
{
@@ -920,8 +846,252 @@ html_parser_cb(const hubbub_token *token, void *pw)
#endif
+char *
+lws_strdup(const char *s)
+{
+ char *d = lws_malloc(strlen(s) + 1, "strdup");
+
+ if (d)
+ strcpy(d, s);
+
+ return d;
+}
+
+void
+lws_client_stash_destroy(struct lws *wsi)
+{
+ if (!wsi || !wsi->stash)
+ return;
+
+ lws_free_set_NULL(wsi->stash->address);
+ lws_free_set_NULL(wsi->stash->path);
+ lws_free_set_NULL(wsi->stash->host);
+ lws_free_set_NULL(wsi->stash->origin);
+ lws_free_set_NULL(wsi->stash->protocol);
+ lws_free_set_NULL(wsi->stash->method);
+ lws_free_set_NULL(wsi->stash->iface);
+ lws_free_set_NULL(wsi->stash->alpn);
+
+ lws_free_set_NULL(wsi->stash);
+}
+
+LWS_VISIBLE struct lws *
+lws_client_connect_via_info(struct lws_client_connect_info *i)
+{
+ struct lws *wsi;
+ const struct lws_protocols *p;
+ const char *local = i->protocol;
+
+ if (i->context->requested_kill)
+ return NULL;
+
+ if (!i->context->protocol_init_done)
+ lws_protocol_init(i->context);
+ /*
+ * If we have .local_protocol_name, use it to select the
+ * local protocol handler to bind to. Otherwise use .protocol if
+ * http[s].
+ */
+ if (i->local_protocol_name)
+ local = i->local_protocol_name;
+
+ wsi = lws_zalloc(sizeof(struct lws), "client wsi");
+ if (wsi == NULL)
+ goto bail;
+
+ wsi->context = i->context;
+#if defined(LWS_ROLE_H1)
+ /* assert the mode and union status (hdr) clearly */
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, &role_ops_h1);
+#else
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, &role_ops_raw_skt);
+#endif
+ wsi->desc.sockfd = LWS_SOCK_INVALID;
+
+ /* 1) fill up the wsi with stuff from the connect_info as far as it
+ * can go. It's because not only is our connection async, we might
+ * not even be able to get ahold of an ah at this point.
+ */
+
+ if (!i->method) /* ie, ws */
+#if defined(LWS_ROLE_WS)
+ if (lws_create_client_ws_object(i, wsi))
+ return NULL;
+#else
+ return NULL;
+#endif
+
+ wsi->user_space = NULL;
+ wsi->pending_timeout = NO_PENDING_TIMEOUT;
+ wsi->position_in_fds_table = LWS_NO_FDS_POS;
+ wsi->c_port = i->port;
+ wsi->vhost = i->vhost;
+ if (!wsi->vhost)
+ wsi->vhost = i->context->vhost_list;
+
+ if (!wsi->vhost) {
+ lwsl_err("At least one vhost in the context is required\n");
+
+ goto bail;
+ }
+
+ wsi->protocol = &wsi->vhost->protocols[0];
+ wsi->client_pipeline = !!(i->ssl_connection & LCCSCF_PIPELINE);
+
+ /* reasonable place to start */
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
+#if defined(LWS_ROLE_H1)
+ &role_ops_h1);
+#else
+ &role_ops_raw_skt);
+#endif
+
+ /*
+ * 1) for http[s] connection, allow protocol selection by name
+ * 2) for ws[s], if local_protocol_name given also use it for
+ * local protocol binding... this defeats the server
+ * protocol negotiation if so
+ *
+ * Otherwise leave at protocols[0]... the server will tell us
+ * which protocol we are associated with since we can give it a
+ * list.
+ */
+ if (/*(i->method || i->local_protocol_name) && */local) {
+ lwsl_info("binding to %s\n", local);
+ p = lws_vhost_name_to_protocol(wsi->vhost, local);
+ if (p)
+ wsi->protocol = p;
+ }
+
+ if (wsi && !wsi->user_space && i->userdata) {
+ wsi->user_space_externally_allocated = 1;
+ wsi->user_space = i->userdata;
+ } else
+ /* if we stay in http, we can assign the user space now,
+ * otherwise do it after the protocol negotiated
+ */
+ if (i->method)
+ if (lws_ensure_user_space(wsi))
+ goto bail;
+
+#if defined(LWS_WITH_TLS)
+ wsi->tls.use_ssl = i->ssl_connection;
+#else
+ if (i->ssl_connection & LCCSCF_USE_SSL) {
+ lwsl_err("libwebsockets not configured for ssl\n");
+ goto bail;
+ }
+#endif
+
+ /* 2) stash the things from connect_info that we can't process without
+ * an ah. Because if no ah, we will go on the ah waiting list and
+ * process those things later (after the connect_info and maybe the
+ * things pointed to have gone out of scope.
+ */
+
+ wsi->stash = lws_zalloc(sizeof(*wsi->stash), "client stash");
+ if (!wsi->stash) {
+ lwsl_err("%s: OOM\n", __func__);
+ goto bail1;
+ }
+
+ wsi->stash->address = lws_strdup(i->address);
+ wsi->stash->path = lws_strdup(i->path);
+ wsi->stash->host = lws_strdup(i->host);
+
+ if (!wsi->stash->address || !wsi->stash->path || !wsi->stash->host)
+ goto bail1;
+
+ if (i->origin) {
+ wsi->stash->origin = lws_strdup(i->origin);
+ if (!wsi->stash->origin)
+ goto bail1;
+ }
+ if (i->protocol) {
+ wsi->stash->protocol = lws_strdup(i->protocol);
+ if (!wsi->stash->protocol)
+ goto bail1;
+ }
+ if (i->method) {
+ wsi->stash->method = lws_strdup(i->method);
+ if (!wsi->stash->method)
+ goto bail1;
+ }
+ if (i->iface) {
+ wsi->stash->iface = lws_strdup(i->iface);
+ if (!wsi->stash->iface)
+ goto bail1;
+ }
+ /*
+ * For ws, default to http/1.1 only. If i->alpn is set, defer to
+ * whatever he has set in there (eg, "h2").
+ *
+ * The problem is he has to commit to h2 before he can find out if the
+ * server has the SETTINGS for ws-over-h2 enabled; if not then ws is
+ * not possible on that connection. So we only try it if he
+ * assertively said to use h2 alpn.
+ */
+ if (!i->method && !i->alpn) {
+ wsi->stash->alpn = lws_strdup("http/1.1");
+ if (!wsi->stash->alpn)
+ goto bail1;
+ } else
+ if (i->alpn) {
+ wsi->stash->alpn = lws_strdup(i->alpn);
+ if (!wsi->stash->alpn)
+ goto bail1;
+ }
+
+ if (i->pwsi)
+ *i->pwsi = wsi;
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ /* if we went on the waiting list, no probs just return the wsi
+ * when we get the ah, now or later, he will call
+ * lws_client_connect_via_info2() below.
+ */
+ if (lws_header_table_attach(wsi, 0) < 0) {
+ /*
+ * if we failed here, the connection is already closed
+ * and freed.
+ */
+ goto bail2;
+ }
+
+#endif
+
+ if (i->parent_wsi) {
+ lwsl_info("%s: created child %p of parent %p\n", __func__,
+ wsi, i->parent_wsi);
+ wsi->parent = i->parent_wsi;
+ wsi->sibling_list = i->parent_wsi->child_list;
+ i->parent_wsi->child_list = wsi;
+ }
+#ifdef LWS_WITH_HTTP_PROXY
+ if (i->uri_replace_to)
+ wsi->http.rw = lws_rewrite_create(wsi, html_parser_cb,
+ i->uri_replace_from,
+ i->uri_replace_to);
+#endif
+
+ return wsi;
+
+bail1:
+ lws_client_stash_destroy(wsi);
+
+bail:
+ lws_free(wsi);
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+bail2:
+#endif
+ if (i->pwsi)
+ *i->pwsi = NULL;
+
+ return NULL;
+}
+
struct lws *
-lws_http_client_connect_via_info2(struct lws *wsi)
+lws_client_connect_via_info2(struct lws *wsi)
{
struct client_info_stash *stash = wsi->stash;
@@ -986,6 +1156,55 @@ bail1:
return NULL;
}
+LWS_VISIBLE struct lws *
+lws_client_connect_extended(struct lws_context *context, const char *address,
+ int port, int ssl_connection, const char *path,
+ const char *host, const char *origin,
+ const char *protocol, int ietf_version_or_minus_one,
+ void *userdata)
+{
+ struct lws_client_connect_info i;
+
+ memset(&i, 0, sizeof(i));
+
+ i.context = context;
+ i.address = address;
+ i.port = port;
+ i.ssl_connection = ssl_connection;
+ i.path = path;
+ i.host = host;
+ i.origin = origin;
+ i.protocol = protocol;
+ i.ietf_version_or_minus_one = ietf_version_or_minus_one;
+ i.userdata = userdata;
+
+ return lws_client_connect_via_info(&i);
+}
+
+LWS_VISIBLE struct lws *
+lws_client_connect(struct lws_context *context, const char *address,
+ int port, int ssl_connection, const char *path,
+ const char *host, const char *origin,
+ const char *protocol, int ietf_version_or_minus_one)
+{
+ struct lws_client_connect_info i;
+
+ memset(&i, 0, sizeof(i));
+
+ i.context = context;
+ i.address = address;
+ i.port = port;
+ i.ssl_connection = ssl_connection;
+ i.path = path;
+ i.host = host;
+ i.origin = origin;
+ i.protocol = protocol;
+ i.ietf_version_or_minus_one = ietf_version_or_minus_one;
+ i.userdata = NULL;
+
+ return lws_client_connect_via_info(&i);
+}
+
#if defined(LWS_WITH_SOCKS5)
void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
ssize_t *msg_len)
@@ -1023,9 +1242,8 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
/* length of the password */
pt->serv_buf[len++] = passwd_len;
/* password */
- lws_strncpy((char *)&pt->serv_buf[len],
- wsi->vhost->socks_password,
- context->pt_serv_buf_size - len + 1);
+ lws_strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_password,
+ context->pt_serv_buf_size - len + 1);
len += passwd_len;
break;
diff --git a/thirdparty/libwebsockets/lib/roles/http/client/client.c b/thirdparty/libwebsockets/roles/http/client/client.c
index 1d6f13dcf8..5645fa2b7a 100644
--- a/thirdparty/libwebsockets/lib/roles/http/client/client.c
+++ b/thirdparty/libwebsockets/roles/http/client/client.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - lib/client/client.c
*
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -48,7 +48,7 @@ lws_client_wsi_effective(struct lws *wsi)
} lws_end_foreach_dll_safe(d, d1);
return lws_container_of(tail, struct lws,
- dll_client_transaction_queue);
+ dll_client_transaction_queue);
}
/*
@@ -66,7 +66,7 @@ _lws_client_wsi_master(struct lws *wsi)
d = wsi->dll_client_transaction_queue.prev;
while (d) {
wsi_eff = lws_container_of(d, struct lws,
- dll_client_transaction_queue_head);
+ dll_client_transaction_queue_head);
d = d->prev;
}
@@ -111,12 +111,11 @@ lws_client_socket_service(struct lws *wsi, struct lws_pollfd *pollfd,
*/
lws_vhost_lock(wsi->vhost);
lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
- wsi->dll_client_transaction_queue_head.next) {
+ wsi->dll_client_transaction_queue_head.next) {
struct lws *w = lws_container_of(d, struct lws,
dll_client_transaction_queue);
- lwsl_debug("%s: %p states 0x%x\n", __func__, w,
- w->wsistate);
+ lwsl_debug("%s: %p states 0x%x\n", __func__, w, w->wsistate);
if (lwsi_state(w) == LRS_H1C_ISSUE_HANDSHAKE2)
wfound = w;
} lws_end_foreach_dll_safe(d, d1);
@@ -209,8 +208,7 @@ lws_client_socket_service(struct lws *wsi, struct lws_pollfd *pollfd,
case LRS_WAITING_SOCKS_AUTH_REPLY:
if (pt->serv_buf[0] != SOCKS_SUBNEGOTIATION_VERSION_1 ||
- pt->serv_buf[1] !=
- SOCKS_SUBNEGOTIATION_STATUS_SUCCESS)
+ pt->serv_buf[1] != SOCKS_SUBNEGOTIATION_STATUS_SUCCESS)
goto socks_reply_fail;
lwsl_client("SOCKS password OK, sending connect\n");
@@ -245,8 +243,8 @@ socks_reply_fail:
/* free stash since we are done with it */
lws_client_stash_destroy(wsi);
if (lws_hdr_simple_create(wsi,
- _WSI_TOKEN_CLIENT_PEER_ADDRESS,
- wsi->vhost->socks_proxy_address))
+ _WSI_TOKEN_CLIENT_PEER_ADDRESS,
+ wsi->vhost->socks_proxy_address))
goto bail3;
wsi->c_port = wsi->vhost->socks_proxy_port;
@@ -354,9 +352,7 @@ start_ws_handshake:
* So this is it, we are an h2 master client connection
* now, not an h1 client connection.
*/
-#if defined (LWS_WITH_TLS)
lws_tls_server_conn_alpn(wsi);
-#endif
/* send the H2 preface to legitimize the connection */
if (lws_h2_issue_preface(wsi)) {
@@ -381,8 +377,7 @@ start_ws_handshake:
return 0;
lwsl_err("Failed to generate handshake for client\n");
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
- "chs");
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "chs");
return 0;
}
@@ -390,9 +385,8 @@ start_ws_handshake:
lws_latency_pre(context, wsi);
w = _lws_client_wsi_master(wsi);
- lwsl_info("%s: HANDSHAKE2: %p: sending headers on %p "
- "(wsistate 0x%x 0x%x)\n", __func__, wsi, w,
- wsi->wsistate, w->wsistate);
+ lwsl_info("%s: HANDSHAKE2: %p: sending headers on %p (wsistate 0x%x 0x%x)\n",
+ __func__, wsi, w, wsi->wsistate, w->wsistate);
n = lws_ssl_capable_write(w, (unsigned char *)sb, (int)(p - sb));
lws_latency(context, wsi, "send lws_issue_raw", n,
@@ -400,8 +394,7 @@ start_ws_handshake:
switch (n) {
case LWS_SSL_CAPABLE_ERROR:
lwsl_debug("ERROR writing to client socket\n");
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
- "cws");
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "cws");
return 0;
case LWS_SSL_CAPABLE_MORE_SERVICE:
lws_callback_on_writable(wsi);
@@ -426,7 +419,7 @@ start_ws_handshake:
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
w->http.ah->parser_state = WSI_TOKEN_NAME_PART;
w->http.ah->lextable_pos = 0;
- /* If we're (re)starting on hdr, need other implied init */
+ /* If we're (re)starting on headers, need other implied init */
wsi->http.ah->ues = URIES_IDLE;
#endif
}
@@ -556,12 +549,11 @@ lws_http_transaction_completed_client(struct lws *wsi)
{
struct lws *wsi_eff = lws_client_wsi_effective(wsi);
- lwsl_info("%s: wsi: %p, wsi_eff: %p (%s)\n", __func__, wsi, wsi_eff,
- wsi_eff->protocol->name);
+ lwsl_info("%s: wsi: %p, wsi_eff: %p\n", __func__, wsi, wsi_eff);
- if (user_callback_handle_rxflow(wsi_eff->protocol->callback, wsi_eff,
- LWS_CALLBACK_COMPLETED_CLIENT_HTTP,
- wsi_eff->user_space, NULL, 0)) {
+ if (user_callback_handle_rxflow(wsi_eff->protocol->callback,
+ wsi_eff, LWS_CALLBACK_COMPLETED_CLIENT_HTTP,
+ wsi_eff->user_space, NULL, 0)) {
lwsl_debug("%s: Completed call returned nonzero (role 0x%x)\n",
__func__, lwsi_role(wsi_eff));
return -1;
@@ -634,8 +626,7 @@ lws_http_transaction_completed_client(struct lws *wsi)
/* If we're (re)starting on headers, need other implied init */
wsi->http.ah->ues = URIES_IDLE;
- lwsl_info("%s: %p: new queued transaction as %p\n", __func__, wsi,
- wsi_eff);
+ lwsl_info("%s: %p: new queued transaction as %p\n", __func__, wsi, wsi_eff);
lws_callback_on_writable(wsi);
return 0;
@@ -681,7 +672,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
int n, port = 0, ssl = 0;
int close_reason = LWS_CLOSE_STATUS_PROTOCOL_ERR;
const char *prot, *ads = NULL, *path, *cce = NULL;
- struct allocated_headers *ah;
+ struct allocated_headers *ah = NULL;
struct lws *w = lws_client_wsi_effective(wsi);
char *p, *q;
char new_path[300];
@@ -694,8 +685,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
*/
#if defined(LWS_ROLE_H2)
if (wsi->client_h2_alpn || wsi->client_h2_substream) {
- lwsl_debug("%s: %p: transitioning to h2 client\n",
- __func__, wsi);
+ lwsl_debug("%s: %p: transitioning to h2 client\n", __func__, wsi);
lws_role_transition(wsi, LWSIFR_CLIENT,
LRS_ESTABLISHED, &role_ops_h2);
} else
@@ -703,8 +693,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
{
#if defined(LWS_ROLE_H1)
{
- lwsl_debug("%s: %p: transitioning to h1 client\n",
- __func__, wsi);
+ lwsl_debug("%s: %p: transitioning to h1 client\n", __func__, wsi);
lws_role_transition(wsi, LWSIFR_CLIENT,
LRS_ESTABLISHED, &role_ops_h1);
}
@@ -730,7 +719,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
* set-cookie:.test=LWS_1456736240_336776_COOKIE;Max-Age=360000
*/
- wsi->http.conn_type = HTTP_CONNECTION_KEEP_ALIVE;
+ wsi->http.connection_type = HTTP_CONNECTION_KEEP_ALIVE;
if (!wsi->client_h2_substream) {
p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
if (wsi->do_ws && !p) {
@@ -740,7 +729,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
}
if (!p) {
p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP1_0);
- wsi->http.conn_type = HTTP_CONNECTION_CLOSE;
+ wsi->http.connection_type = HTTP_CONNECTION_CLOSE;
}
if (!p) {
cce = "HS: URI missing";
@@ -837,9 +826,8 @@ lws_client_interpret_server_handshake(struct lws *wsi)
/* if h1 KA is allowed, enable the queued pipeline guys */
- if (!wsi->client_h2_alpn && !wsi->client_h2_substream &&
- w == wsi) { /* ie, coming to this for the first time */
- if (wsi->http.conn_type == HTTP_CONNECTION_KEEP_ALIVE)
+ if (!wsi->client_h2_alpn && !wsi->client_h2_substream && w == wsi) { /* ie, coming to this for the first time */
+ if (wsi->http.connection_type == HTTP_CONNECTION_KEEP_ALIVE)
wsi->keepalive_active = 1;
else {
/*
@@ -859,16 +847,13 @@ lws_client_interpret_server_handshake(struct lws *wsi)
wsi->keepalive_rejected = 1;
lws_vhost_lock(wsi->vhost);
- lws_start_foreach_dll_safe(struct lws_dll_lws *,
- d, d1,
- wsi->dll_client_transaction_queue_head.next) {
- struct lws *ww = lws_container_of(d,
- struct lws,
- dll_client_transaction_queue);
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ wsi->dll_client_transaction_queue_head.next) {
+ struct lws *ww = lws_container_of(d, struct lws,
+ dll_client_transaction_queue);
/* remove him from our queue */
- lws_dll_lws_remove(
- &ww->dll_client_transaction_queue);
+ lws_dll_lws_remove(&ww->dll_client_transaction_queue);
/* give up on pipelining */
ww->client_pipeline = 0;
@@ -896,7 +881,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
if (!strncmp(lws_hdr_simple_ptr(wsi,
WSI_TOKEN_HTTP_CONTENT_TYPE),
"text/html", 9))
- wsi->http.perform_rewrite = 0;
+ wsi->http.perform_rewrite = 1;
}
#endif
@@ -930,7 +915,8 @@ lws_client_interpret_server_handshake(struct lws *wsi)
wsi->http.rx_content_length;
} else /* can't do 1.1 without a content length or chunked */
if (!wsi->chunked)
- wsi->http.conn_type = HTTP_CONNECTION_CLOSE;
+ wsi->http.connection_type =
+ HTTP_CONNECTION_CLOSE;
/*
* we seem to be good to go, give client last chance to check
@@ -968,15 +954,6 @@ lws_client_interpret_server_handshake(struct lws *wsi)
lwsl_info("%s: client connection up\n", __func__);
- /*
- * Did we get a response from the server with an explicit
- * content-length of zero? If so, this transaction is already
- * completed at the end of the header processing...
- */
- if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH) &&
- !wsi->http.rx_content_length)
- return !!lws_http_transaction_completed_client(wsi);
-
return 0;
}
@@ -1006,9 +983,7 @@ bail2:
}
wsi->already_did_cce = 1;
- lwsl_info("closing connection (prot %s) "
- "due to bail2 connection error: %s\n", wsi->protocol ?
- wsi->protocol->name : "unknown", cce);
+ lwsl_info("closing connection due to bail2 connection error\n");
/* closing will free up his parsing allocations */
lws_close_free_wsi(wsi, close_reason, "c hs interp");
@@ -1048,7 +1023,7 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt)
return NULL;
}
- lws_bind_protocol(wsi, pr, __func__);
+ lws_bind_protocol(wsi, pr);
}
if ((wsi->protocol->callback)(wsi, LWS_CALLBACK_RAW_ADOPT,
@@ -1095,22 +1070,16 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt)
_WSI_TOKEN_CLIENT_ORIGIN));
}
#if defined(LWS_ROLE_WS)
- if (wsi->do_ws) {
- const char *conn1 = "";
- if (!wsi->client_pipeline)
- conn1 = "close, ";
- p = lws_generate_client_ws_handshake(wsi, p, conn1);
- } else
+ if (wsi->do_ws)
+ p = lws_generate_client_ws_handshake(wsi, p);
#endif
- if (!wsi->client_pipeline)
- p += sprintf(p, "connection: close\x0d\x0a");
/* give userland a chance to append, eg, cookies */
if (wsi->protocol->callback(wsi,
- LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER,
- wsi->user_space, &p,
- (pkt + wsi->context->pt_serv_buf_size) - p - 12))
+ LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER,
+ wsi->user_space, &p,
+ (pkt + wsi->context->pt_serv_buf_size) - p - 12))
return NULL;
p += sprintf(p, "\x0d\x0a");
@@ -1134,11 +1103,14 @@ lws_http_client_read(struct lws *wsi, char **buf, int *len)
lws_change_pollfd(wsi, 0, LWS_POLLIN);
if (rlen == LWS_SSL_CAPABLE_ERROR) {
- lwsl_debug("%s: SSL capable error\n", __func__);
+ lwsl_notice("%s: SSL capable error\n", __func__);
return -1;
}
- if (rlen <= 0)
+ if (rlen == 0)
+ return -1;
+
+ if (rlen < 0)
return 0;
*len = rlen;
@@ -1158,7 +1130,7 @@ spin_chunks:
}
n = char_to_hex((*buf)[0]);
if (n < 0) {
- lwsl_info("%s: chunking failure\n", __func__);
+ lwsl_debug("chunking failure\n");
return -1;
}
wsi->chunk_remaining <<= 4;
@@ -1166,7 +1138,7 @@ spin_chunks:
break;
case ELCP_CR:
if ((*buf)[0] != '\x0a') {
- lwsl_info("%s: chunking failure\n", __func__);
+ lwsl_debug("chunking failure\n");
return -1;
}
wsi->chunk_parser = ELCP_CONTENT;
@@ -1181,7 +1153,7 @@ spin_chunks:
case ELCP_POST_CR:
if ((*buf)[0] != '\x0d') {
- lwsl_info("%s: chunking failure\n", __func__);
+ lwsl_debug("chunking failure\n");
return -1;
}
@@ -1190,11 +1162,8 @@ spin_chunks:
break;
case ELCP_POST_LF:
- if ((*buf)[0] != '\x0a') {
- lwsl_info("%s: chunking failure\n", __func__);
-
+ if ((*buf)[0] != '\x0a')
return -1;
- }
wsi->chunk_parser = ELCP_HEX;
wsi->chunk_remaining = 0;
@@ -1217,7 +1186,7 @@ spin_chunks:
wsi->chunk_remaining < n)
n = wsi->chunk_remaining;
-#if defined(LWS_WITH_HTTP_PROXY) && defined(LWS_WITH_HUBBUB)
+#ifdef LWS_WITH_HTTP_PROXY
/* hubbub */
if (wsi->http.perform_rewrite)
lws_rewrite_parse(wsi->http.rw, (unsigned char *)*buf, n);
@@ -1229,7 +1198,7 @@ spin_chunks:
if (user_callback_handle_rxflow(wsi_eff->protocol->callback,
wsi_eff, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ,
wsi_eff->user_space, *buf, n)) {
- lwsl_info("%s: RECEIVE_CLIENT_HTTP_READ returned -1\n",
+ lwsl_debug("%s: RECEIVE_CLIENT_HTTP_READ returned -1\n",
__func__);
return -1;
diff --git a/thirdparty/libwebsockets/lib/roles/http/header.c b/thirdparty/libwebsockets/roles/http/header.c
index 448c5a8b5c..dbcf27cbd1 100644
--- a/thirdparty/libwebsockets/lib/roles/http/header.c
+++ b/thirdparty/libwebsockets/roles/http/header.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -116,10 +116,9 @@ lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
return lws_add_http_header_by_name(wsi, name, value, length, p, end);
}
-int
-lws_add_http_header_content_length(struct lws *wsi,
- lws_filepos_t content_length,
- unsigned char **p, unsigned char *end)
+int lws_add_http_header_content_length(struct lws *wsi,
+ lws_filepos_t content_length,
+ unsigned char **p, unsigned char *end)
{
char b[24];
int n;
@@ -142,10 +141,6 @@ lws_add_http_common_headers(struct lws *wsi, unsigned int code,
const char *content_type, lws_filepos_t content_len,
unsigned char **p, unsigned char *end)
{
- const char *ka[] = { "close", "keep-alive" };
- int types[] = { HTTP_CONNECTION_CLOSE, HTTP_CONNECTION_KEEP_ALIVE },
- t = 0;
-
if (lws_add_http_header_status(wsi, code, p, end))
return 1;
@@ -154,67 +149,22 @@ lws_add_http_common_headers(struct lws *wsi, unsigned int code,
(int)strlen(content_type), p, end))
return 1;
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (!wsi->http.lcs &&
- (!strncmp(content_type, "text/", 5) ||
- !strcmp(content_type, "application/javascript") ||
- !strcmp(content_type, "image/svg+xml")))
- lws_http_compression_apply(wsi, NULL, p, end, 0);
-#endif
-
- /*
- * if we decided to compress it, we don't know the content length...
- * the compressed data will go out chunked on h1
- */
- if (
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- !wsi->http.lcs &&
-#endif
- content_len != LWS_ILLEGAL_HTTP_CONTENT_LEN) {
- if (lws_add_http_header_content_length(wsi, content_len,
- p, end))
+ if (content_len != LWS_ILLEGAL_HTTP_CONTENT_LEN) {
+ if (lws_add_http_header_content_length(wsi, content_len, p, end))
return 1;
} else {
- /* there was no length... it normally means CONNECTION_CLOSE */
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
-
- if (!wsi->http2_substream && wsi->http.lcs) {
- /* so...
- * - h1 connection
- * - http compression transform active
- * - did not send content length
- *
- * then mark as chunked...
- */
- wsi->http.comp_ctx.chunking = 1;
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_TRANSFER_ENCODING,
- (unsigned char *)"chunked", 7, p, end))
- return -1;
-
- /* ... but h1 compression is chunked, if active we can
- * still pipeline
- */
- if (wsi->http.lcs &&
- wsi->http.conn_type == HTTP_CONNECTION_KEEP_ALIVE)
- t = 1;
- }
-#endif
- if (!wsi->http2_substream) {
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_CONNECTION,
- (unsigned char *)ka[t],
- (int)strlen(ka[t]), p, end))
- return 1;
-
- wsi->http.conn_type = types[t];
- }
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_CONNECTION,
+ (unsigned char *)"close", 5,
+ p, end))
+ return 1;
+
+ wsi->http.connection_type = HTTP_CONNECTION_CLOSE;
}
return 0;
}
-static const char * const err400[] = {
+STORE_IN_ROM static const char * const err400[] = {
"Bad Request",
"Unauthorized",
"Payment Required",
@@ -235,7 +185,7 @@ static const char * const err400[] = {
"Expectation Failed"
};
-static const char * const err500[] = {
+STORE_IN_ROM static const char * const err500[] = {
"Internal Server Error",
"Not Implemented",
"Bad Gateway",
@@ -244,31 +194,11 @@ static const char * const err500[] = {
"HTTP Version Not Supported"
};
-/* security best practices from Mozilla Observatory */
-
-static const
-struct lws_protocol_vhost_options pvo_hsbph[] = {{
- NULL, NULL, "referrer-policy:", "no-referrer"
-}, {
- &pvo_hsbph[0], NULL, "x-frame-options:", "deny"
-}, {
- &pvo_hsbph[1], NULL, "x-xss-protection:", "1; mode=block"
-}, {
- &pvo_hsbph[2], NULL, "x-content-type-options:", "nosniff"
-}, {
- &pvo_hsbph[3], NULL, "content-security-policy:",
- "default-src 'none'; img-src 'self' data: ; "
- "script-src 'self'; font-src 'self'; "
- "style-src 'self'; connect-src 'self'; "
- "frame-ancestors 'none'; base-uri 'none';"
- "form-action 'self';"
-}};
-
int
lws_add_http_header_status(struct lws *wsi, unsigned int _code,
unsigned char **p, unsigned char *end)
{
- static const char * const hver[] = {
+ STORE_IN_ROM static const char * const hver[] = {
"HTTP/1.0", "HTTP/1.1", "HTTP/2"
};
const struct lws_protocol_vhost_options *headers;
@@ -316,7 +246,6 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
end))
return 1;
}
-
headers = wsi->vhost->headers;
while (headers) {
if (lws_add_http_header_by_name(wsi,
@@ -328,20 +257,6 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
headers = headers->next;
}
- if (wsi->vhost->options &
- LWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE) {
- headers = &pvo_hsbph[LWS_ARRAY_SIZE(pvo_hsbph) - 1];
- while (headers) {
- if (lws_add_http_header_by_name(wsi,
- (const unsigned char *)headers->name,
- (unsigned char *)headers->value,
- (int)strlen(headers->value), p, end))
- return 1;
-
- headers = headers->next;
- }
- }
-
if (wsi->context->server_string &&
!(_code & LWSAHH_FLAG_NO_SERVER_NAME))
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_SERVER,
@@ -356,12 +271,6 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
"includeSubDomains", 36, p, end))
return 1;
- if (*p >= (end - 2)) {
- lwsl_err("%s: reached end of buffer\n", __func__);
-
- return 1;
- }
-
return 0;
}
@@ -374,7 +283,6 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
unsigned char *p = pt->serv_buf + LWS_PRE;
unsigned char *start = p;
unsigned char *end = p + context->pt_serv_buf_size - LWS_PRE;
- char *body = (char *)start + context->pt_serv_buf_size - 512;
int n = 0, m = 0, len;
char slen[20];
@@ -389,9 +297,9 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
code == HTTP_STATUS_NOT_FOUND)
/* we should do a redirect, and do the 404 there */
if (lws_http_redirect(wsi, HTTP_STATUS_FOUND,
- (uint8_t *)wsi->vhost->http.error_document_404,
- (int)strlen(wsi->vhost->http.error_document_404),
- &p, end) > 0)
+ (uint8_t *)wsi->vhost->http.error_document_404,
+ (int)strlen(wsi->vhost->http.error_document_404),
+ &p, end) > 0)
return 0;
#endif
@@ -409,15 +317,9 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
&p, end))
return 1;
- len = lws_snprintf(body, 510, "<html><head>"
- "<meta charset=utf-8 http-equiv=\"Content-Language\" "
- "content=\"en\"/>"
- "<link rel=\"stylesheet\" type=\"text/css\" "
- "href=\"/error.css\"/>"
- "</head><body><h1>%u</h1>%s</body></html>", code, html_body);
-
-
+ len = 35 + (int)strlen(html_body) + sprintf(slen, "%d", code);
n = sprintf(slen, "%d", len);
+
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH,
(unsigned char *)slen, n, &p, end))
return 1;
@@ -427,6 +329,7 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
#if defined(LWS_WITH_HTTP2)
if (wsi->http2_substream) {
+ unsigned char *body = p + 512;
/*
* for HTTP/2, the headers must be sent separately, since they
@@ -440,8 +343,7 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
*
* Solve it by writing the headers now...
*/
- m = lws_write(wsi, start, lws_ptr_diff(p, start),
- LWS_WRITE_HTTP_HEADERS);
+ m = lws_write(wsi, start, p - start, LWS_WRITE_HTTP_HEADERS);
if (m != lws_ptr_diff(p, start))
return 1;
@@ -449,6 +351,10 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
* ... but stash the body and send it as a priority next
* handle_POLLOUT
*/
+
+ len = sprintf((char *)body,
+ "<html><body><h1>%u</h1>%s</body></html>",
+ code, html_body);
wsi->http.tx_content_length = len;
wsi->http.tx_content_remain = len;
@@ -457,7 +363,8 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
if (!wsi->h2.pending_status_body)
return -1;
- strcpy(wsi->h2.pending_status_body + LWS_PRE, body);
+ strcpy(wsi->h2.pending_status_body + LWS_PRE,
+ (const char *)body);
lws_callback_on_writable(wsi);
return 0;
@@ -468,9 +375,11 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
* for http/1, we can just append the body after the finalized
* headers and send it all in one go.
*/
+ p += lws_snprintf((char *)p, end - p - 1,
+ "<html><body><h1>%u</h1>%s</body></html>",
+ code, html_body);
- n = lws_ptr_diff(p, start) + len;
- memcpy(p, body, len);
+ n = lws_ptr_diff(p, start);
m = lws_write(wsi, start, n, LWS_WRITE_HTTP);
if (m != n)
return 1;
@@ -510,20 +419,3 @@ lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
return lws_write(wsi, start, *p - start, LWS_WRITE_HTTP_HEADERS |
LWS_WRITE_H2_STREAM_END);
}
-
-#if !defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
-LWS_VISIBLE int
-lws_http_compression_apply(struct lws *wsi, const char *name,
- unsigned char **p, unsigned char *end, char decomp)
-{
- (void)wsi;
- (void)name;
- (void)p;
- (void)end;
- (void)decomp;
-
- return 0;
-}
-#endif
-
-
diff --git a/thirdparty/libwebsockets/lib/roles/http/lextable-strings.h b/thirdparty/libwebsockets/roles/http/lextable-strings.h
index 1e4fee855f..631f5cb600 100644
--- a/thirdparty/libwebsockets/lib/roles/http/lextable-strings.h
+++ b/thirdparty/libwebsockets/roles/http/lextable-strings.h
@@ -1,6 +1,10 @@
/* set of parsable strings -- ALL LOWER CASE */
-static const char * const set[] = {
+#if !defined(STORE_IN_ROM)
+#define STORE_IN_ROM
+#endif
+
+STORE_IN_ROM static const char * const set[] = {
"get ",
"post ",
"options ",
diff --git a/thirdparty/libwebsockets/lib/roles/http/lextable.h b/thirdparty/libwebsockets/roles/http/lextable.h
index 9a8063b157..9a8063b157 100644
--- a/thirdparty/libwebsockets/lib/roles/http/lextable.h
+++ b/thirdparty/libwebsockets/roles/http/lextable.h
diff --git a/thirdparty/libwebsockets/lib/roles/http/private.h b/thirdparty/libwebsockets/roles/http/private.h
index ff8b0581cc..5699914742 100644
--- a/thirdparty/libwebsockets/lib/roles/http/private.h
+++ b/thirdparty/libwebsockets/roles/http/private.h
@@ -22,15 +22,11 @@
* enabled
*/
-#if defined(LWS_WITH_HUBBUB)
+#if defined(LWS_WITH_HTTP_PROXY)
#include <hubbub/hubbub.h>
#include <hubbub/parser.h>
#endif
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
-#include "roles/http/compression/private.h"
-#endif
-
#define lwsi_role_http(wsi) (lwsi_role_h1(wsi) || lwsi_role_h2(wsi))
enum http_version {
@@ -39,7 +35,7 @@ enum http_version {
HTTP_VERSION_2
};
-enum http_conn_type {
+enum http_connection_type {
HTTP_CONNECTION_CLOSE,
HTTP_CONNECTION_KEEP_ALIVE
};
@@ -137,7 +133,7 @@ struct allocated_headers {
-#if defined(LWS_WITH_HUBBUB)
+#if defined(LWS_WITH_HTTP_PROXY)
struct lws_rewrite {
hubbub_parser *parser;
hubbub_parser_optparams params;
@@ -196,15 +192,9 @@ struct lws_access_log {
};
#endif
-#define LWS_HTTP_CHUNK_HDR_MAX_SIZE (6 + 2) /* 6 hex digits and then CRLF */
-#define LWS_HTTP_CHUNK_TRL_MAX_SIZE (2 + 5) /* CRLF, then maybe 0 CRLF CRLF */
-
struct _lws_http_mode_related {
struct lws *new_wsi_list;
- unsigned char *pending_return_headers;
- size_t pending_return_headers_len;
-
#if defined(LWS_WITH_HTTP_PROXY)
struct lws_rewrite *rw;
#endif
@@ -226,14 +216,9 @@ struct _lws_http_mode_related {
#ifdef LWS_WITH_CGI
struct lws_cgi *cgi; /* wsi being cgi master have one of these */
#endif
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- struct lws_compression_support *lcs;
- lws_comp_ctx_t comp_ctx;
- unsigned char comp_accept_mask;
-#endif
enum http_version request_version;
- enum http_conn_type conn_type;
+ enum http_connection_type connection_type;
lws_filepos_t tx_content_length;
lws_filepos_t tx_content_remain;
lws_filepos_t rx_content_length;
@@ -241,12 +226,8 @@ struct _lws_http_mode_related {
#if defined(LWS_WITH_HTTP_PROXY)
unsigned int perform_rewrite:1;
- unsigned int proxy_clientside:1;
- unsigned int proxy_parent_chunked:1;
#endif
unsigned int deferred_transaction_completed:1;
- unsigned int content_length_explicitly_zero:1;
- unsigned int did_stream_close:1;
};
diff --git a/thirdparty/libwebsockets/roles/http/server/access-log.c b/thirdparty/libwebsockets/roles/http/server/access-log.c
new file mode 100644
index 0000000000..0e75309d7a
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/http/server/access-log.c
@@ -0,0 +1,182 @@
+/*
+ * libwebsockets - server access log handling
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+/*
+ * Produce Apache-compatible log string for wsi, like this:
+ *
+ * 2.31.234.19 - - [27/Mar/2016:03:22:44 +0800]
+ * "GET /aep-screen.png HTTP/1.1"
+ * 200 152987 "https://libwebsockets.org/index.html"
+ * "Mozilla/5.0 (Macint... Chrome/49.0.2623.87 Safari/537.36"
+ *
+ */
+
+extern const char * const method_names[];
+
+static const char * const hver[] = {
+ "HTTP/1.0", "HTTP/1.1", "HTTP/2"
+};
+
+void
+lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int meth)
+{
+#ifdef LWS_WITH_IPV6
+ char ads[INET6_ADDRSTRLEN];
+#else
+ char ads[INET_ADDRSTRLEN];
+#endif
+ char da[64];
+ const char *pa, *me;
+ struct tm *tmp;
+ time_t t = time(NULL);
+ int l = 256, m;
+
+ if (!wsi->vhost)
+ return;
+
+ /* only worry about preparing it if we store it */
+ if (wsi->vhost->log_fd == (int)LWS_INVALID_FILE)
+ return;
+
+ if (wsi->access_log_pending)
+ lws_access_log(wsi);
+
+ wsi->http.access_log.header_log = lws_malloc(l, "access log");
+ if (wsi->http.access_log.header_log) {
+
+ tmp = localtime(&t);
+ if (tmp)
+ strftime(da, sizeof(da), "%d/%b/%Y:%H:%M:%S %z", tmp);
+ else
+ strcpy(da, "01/Jan/1970:00:00:00 +0000");
+
+ pa = lws_get_peer_simple(wsi, ads, sizeof(ads));
+ if (!pa)
+ pa = "(unknown)";
+
+ if (wsi->http2_substream)
+ me = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COLON_METHOD);
+ else
+ me = method_names[meth];
+ if (!me)
+ me = "(null)";
+
+ lws_snprintf(wsi->http.access_log.header_log, l,
+ "%s - - [%s] \"%s %s %s\"",
+ pa, da, me, uri_ptr,
+ hver[wsi->http.request_version]);
+
+ l = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_USER_AGENT);
+ if (l) {
+ wsi->http.access_log.user_agent = lws_malloc(l + 2, "access log");
+ if (!wsi->http.access_log.user_agent) {
+ lwsl_err("OOM getting user agent\n");
+ lws_free_set_NULL(wsi->http.access_log.header_log);
+ return;
+ }
+
+ lws_hdr_copy(wsi, wsi->http.access_log.user_agent,
+ l + 1, WSI_TOKEN_HTTP_USER_AGENT);
+
+ for (m = 0; m < l; m++)
+ if (wsi->http.access_log.user_agent[m] == '\"')
+ wsi->http.access_log.user_agent[m] = '\'';
+ }
+ l = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_REFERER);
+ if (l) {
+ wsi->http.access_log.referrer = lws_malloc(l + 2, "referrer");
+ if (!wsi->http.access_log.referrer) {
+ lwsl_err("OOM getting user agent\n");
+ lws_free_set_NULL(wsi->http.access_log.user_agent);
+ lws_free_set_NULL(wsi->http.access_log.header_log);
+ return;
+ }
+ lws_hdr_copy(wsi, wsi->http.access_log.referrer,
+ l + 1, WSI_TOKEN_HTTP_REFERER);
+
+ for (m = 0; m < l; m++)
+ if (wsi->http.access_log.referrer[m] == '\"')
+ wsi->http.access_log.referrer[m] = '\'';
+ }
+ wsi->access_log_pending = 1;
+ }
+}
+
+
+int
+lws_access_log(struct lws *wsi)
+{
+ char *p = wsi->http.access_log.user_agent, ass[512],
+ *p1 = wsi->http.access_log.referrer;
+ int l;
+
+ if (!wsi->vhost)
+ return 0;
+
+ if (wsi->vhost->log_fd == (int)LWS_INVALID_FILE)
+ return 0;
+
+ if (!wsi->access_log_pending)
+ return 0;
+
+ if (!wsi->http.access_log.header_log)
+ return 0;
+
+ if (!p)
+ p = "";
+
+ if (!p1)
+ p1 = "";
+
+ /*
+ * We do this in two parts to restrict an oversize referrer such that
+ * we will always have space left to append an empty useragent, while
+ * maintaining the structure of the log text
+ */
+ l = lws_snprintf(ass, sizeof(ass) - 7, "%s %d %lu \"%s",
+ wsi->http.access_log.header_log,
+ wsi->http.access_log.response, wsi->http.access_log.sent, p1);
+ if (strlen(p) > sizeof(ass) - 6 - l)
+ p[sizeof(ass) - 6 - l] = '\0';
+ l += lws_snprintf(ass + l, sizeof(ass) - 1 - l, "\" \"%s\"\n", p);
+
+ if (write(wsi->vhost->log_fd, ass, l) != l)
+ lwsl_err("Failed to write log\n");
+
+ if (wsi->http.access_log.header_log) {
+ lws_free(wsi->http.access_log.header_log);
+ wsi->http.access_log.header_log = NULL;
+ }
+ if (wsi->http.access_log.user_agent) {
+ lws_free(wsi->http.access_log.user_agent);
+ wsi->http.access_log.user_agent = NULL;
+ }
+ if (wsi->http.access_log.referrer) {
+ lws_free(wsi->http.access_log.referrer);
+ wsi->http.access_log.referrer = NULL;
+ }
+ wsi->access_log_pending = 0;
+
+ return 0;
+}
+
diff --git a/thirdparty/libwebsockets/lib/roles/http/server/fops-zip.c b/thirdparty/libwebsockets/roles/http/server/fops-zip.c
index 4db83ce621..4db83ce621 100644
--- a/thirdparty/libwebsockets/lib/roles/http/server/fops-zip.c
+++ b/thirdparty/libwebsockets/roles/http/server/fops-zip.c
diff --git a/thirdparty/libwebsockets/lib/roles/http/server/lejp-conf.c b/thirdparty/libwebsockets/roles/http/server/lejp-conf.c
index 0dd701d835..fbf10c288e 100644
--- a/thirdparty/libwebsockets/lib/roles/http/server/lejp-conf.c
+++ b/thirdparty/libwebsockets/roles/http/server/lejp-conf.c
@@ -1,7 +1,7 @@
/*
* libwebsockets web server application
*
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -105,11 +105,6 @@ static const char * const paths_vhosts[] = {
"vhosts[].ignore-missing-cert",
"vhosts[].error-document-404",
"vhosts[].alpn",
- "vhosts[].ssl-client-option-set",
- "vhosts[].ssl-client-option-clear",
- "vhosts[].tls13-ciphers",
- "vhosts[].client-tls13-ciphers",
- "vhosts[].strict-host-check",
};
enum lejp_vhost_paths {
@@ -161,11 +156,6 @@ enum lejp_vhost_paths {
LEJPVP_IGNORE_MISSING_CERT,
LEJPVP_ERROR_DOCUMENT_404,
LEJPVP_ALPN,
- LEJPVP_SSL_CLIENT_OPTION_SET,
- LEJPVP_SSL_CLIENT_OPTION_CLEAR,
- LEJPVP_TLS13_CIPHERS,
- LEJPVP_CLIENT_TLS13_CIPHERS,
- LEJPVP_FLAG_STRICT_HOST_CHECK,
};
static const char * const parser_errs[] = {
@@ -262,7 +252,7 @@ lejp_globals_cb(struct lejp_ctx *ctx, char reason)
rej = lwsws_align(a);
a->p += sizeof(*rej);
- n = lejp_get_wildcard(ctx, 0, a->p, lws_ptr_diff(a->end, a->p));
+ n = lejp_get_wildcard(ctx, 0, a->p, a->end - a->p);
rej->next = a->info->reject_service_keywords;
a->info->reject_service_keywords = rej;
rej->name = a->p;
@@ -413,7 +403,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->pvo = lwsws_align(a);
a->p += sizeof(*a->pvo);
- n = lejp_get_wildcard(ctx, 0, a->p, lws_ptr_diff(a->end, a->p));
+ n = lejp_get_wildcard(ctx, 0, a->p, a->end - a->p);
/* ie, enable this protocol, no options yet */
a->pvo->next = a->info->pvo;
a->info->pvo = a->pvo;
@@ -428,7 +418,6 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
/* this catches, eg, vhosts[].headers[].xxx */
if ((reason == LEJPCB_VAL_STR_END || reason == LEJPCB_VAL_STR_CHUNK) &&
ctx->path_match == LEJPVP_HEADERS_NAME + 1) {
-
if (!a->chunk) {
headers = lwsws_align(a);
a->p += sizeof(*headers);
@@ -461,9 +450,8 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
struct lws_vhost *vhost;
//lwsl_notice("%s\n", ctx->path);
- if (!a->info->port &&
- !(a->info->options & LWS_SERVER_OPTION_UNIX_SOCK)) {
- lwsl_err("Port required (eg, 443)\n");
+ if (!a->info->port) {
+ lwsl_err("Port required (eg, 443)");
return 1;
}
a->valid = 0;
@@ -479,19 +467,13 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
#if defined(LWS_WITH_TLS)
if (a->enable_client_ssl) {
- const char *cert_filepath =
- a->info->client_ssl_cert_filepath;
- const char *private_key_filepath =
- a->info->client_ssl_private_key_filepath;
- const char *ca_filepath =
- a->info->client_ssl_ca_filepath;
- const char *cipher_list =
- a->info->client_ssl_cipher_list;
-
+ const char *cert_filepath = a->info->client_ssl_cert_filepath;
+ const char *private_key_filepath = a->info->client_ssl_private_key_filepath;
+ const char *ca_filepath = a->info->client_ssl_ca_filepath;
+ const char *cipher_list = a->info->client_ssl_cipher_list;
memset(a->info, 0, sizeof(*a->info));
a->info->client_ssl_cert_filepath = cert_filepath;
- a->info->client_ssl_private_key_filepath =
- private_key_filepath;
+ a->info->client_ssl_private_key_filepath = private_key_filepath;
a->info->client_ssl_ca_filepath = ca_filepath;
a->info->client_ssl_cipher_list = cipher_list;
a->info->options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
@@ -635,13 +617,6 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
case LEJPVP_CIPHERS:
a->info->ssl_cipher_list = a->p;
break;
- case LEJPVP_TLS13_CIPHERS:
- a->info->tls1_3_plus_cipher_list = a->p;
- break;
- case LEJPVP_CLIENT_TLS13_CIPHERS:
- a->info->client_tls_1_3_plus_cipher_list = a->p;
- break;
-
case LEJPVP_ECDH_CURVE:
a->info->ecdh_curve = a->p;
break;
@@ -653,13 +628,13 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
mp_cgienv->next = a->m.cgienv;
a->m.cgienv = mp_cgienv;
- n = lejp_get_wildcard(ctx, 0, a->p, lws_ptr_diff(a->end, a->p));
+ n = lejp_get_wildcard(ctx, 0, a->p, a->end - a->p);
mp_cgienv->name = a->p;
a->p += n;
mp_cgienv->value = a->p;
mp_cgienv->options = NULL;
- //lwsl_notice(" adding pmo / cgi-env '%s' = '%s'\n",
- // mp_cgienv->name, mp_cgienv->value);
+ //lwsl_notice(" adding pmo / cgi-env '%s' = '%s'\n", mp_cgienv->name,
+ // mp_cgienv->value);
goto dostring;
case LEJPVP_PROTOCOL_NAME_OPT:
@@ -670,7 +645,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
pvo = lwsws_align(a);
a->p += sizeof(*a->pvo);
- n = lejp_get_wildcard(ctx, 1, a->p, lws_ptr_diff(a->end, a->p));
+ n = lejp_get_wildcard(ctx, 1, a->p, a->end - a->p);
/* ie, enable this protocol, no options yet */
pvo->next = a->pvo->options;
a->pvo->options = pvo;
@@ -684,12 +659,12 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->pvo_em = lwsws_align(a);
a->p += sizeof(*a->pvo_em);
- n = lejp_get_wildcard(ctx, 0, a->p, lws_ptr_diff(a->end, a->p));
+ n = lejp_get_wildcard(ctx, 0, a->p, a->end - a->p);
/* ie, enable this protocol, no options yet */
a->pvo_em->next = a->m.extra_mimetypes;
a->m.extra_mimetypes = a->pvo_em;
a->pvo_em->name = a->p;
- lwsl_notice(" + extra-mimetypes %s -> %s\n", a->p, ctx->buf);
+ lwsl_notice(" adding extra-mimetypes %s -> %s\n", a->p, ctx->buf);
a->p += n;
a->pvo_em->value = a->p;
a->pvo_em->options = NULL;
@@ -699,7 +674,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->pvo_int = lwsws_align(a);
a->p += sizeof(*a->pvo_int);
- n = lejp_get_wildcard(ctx, 0, a->p, lws_ptr_diff(a->end, a->p));
+ n = lejp_get_wildcard(ctx, 0, a->p, a->end - a->p);
/* ie, enable this protocol, no options yet */
a->pvo_int->next = a->m.interpret;
a->m.interpret = a->pvo_int;
@@ -762,15 +737,6 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
return 0;
- case LEJPVP_FLAG_STRICT_HOST_CHECK:
- if (arg_to_bool(ctx->buf))
- a->info->options |=
- LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK;
- else
- a->info->options &=
- ~(LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK);
- return 0;
-
case LEJPVP_ERROR_DOCUMENT_404:
a->info->error_document_404 = a->p;
break;
@@ -782,13 +748,6 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->info->ssl_options_clear |= atol(ctx->buf);
return 0;
- case LEJPVP_SSL_CLIENT_OPTION_SET:
- a->info->ssl_client_options_set |= atol(ctx->buf);
- return 0;
- case LEJPVP_SSL_CLIENT_OPTION_CLEAR:
- a->info->ssl_client_options_clear |= atol(ctx->buf);
- return 0;
-
case LEJPVP_ALPN:
a->info->alpn = a->p;
break;
@@ -802,13 +761,12 @@ dostring:
p[LEJP_STRING_CHUNK] = '\0';
p1 = strstr(p, ESC_INSTALL_DATADIR);
if (p1) {
- n = lws_ptr_diff(p1, p);
+ n = p1 - p;
if (n > a->end - a->p)
- n = lws_ptr_diff(a->end, a->p);
+ n = a->end - a->p;
lws_strncpy(a->p, p, n + 1);
a->p += n;
- a->p += lws_snprintf(a->p, a->end - a->p, "%s",
- LWS_INSTALL_DATADIR);
+ a->p += lws_snprintf(a->p, a->end - a->p, "%s", LWS_INSTALL_DATADIR);
p += n + strlen(ESC_INSTALL_DATADIR);
}
@@ -913,7 +871,7 @@ static int
lwsws_get_config_d(void *user, const char *d, const char * const *paths,
int count_paths, lejp_callback cb)
{
-#if !defined(_WIN32) && !defined(LWS_WITH_ESP32)
+#ifndef _WIN32
struct dirent **namelist;
char path[256];
int n, i, ret = 0;
@@ -983,14 +941,13 @@ lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d,
return 1;
lws_snprintf(dd, sizeof(dd) - 1, "%s/conf.d", d);
if (lwsws_get_config_d(&a, dd, paths_global,
- LWS_ARRAY_SIZE(paths_global),
- lejp_globals_cb) > 1)
+ LWS_ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
return 1;
a.plugin_dirs[a.count_plugin_dirs] = NULL;
*cs = a.p;
- *len = lws_ptr_diff(a.end, a.p);
+ *len = a.end - a.p;
return 0;
}
@@ -1023,7 +980,7 @@ lwsws_get_config_vhosts(struct lws_context *context,
return 1;
*cs = a.p;
- *len = lws_ptr_diff(a.end, a.p);
+ *len = a.end - a.p;
if (!a.any_vhosts) {
lwsl_err("Need at least one vhost\n");
diff --git a/thirdparty/libwebsockets/lib/roles/http/server/parsers.c b/thirdparty/libwebsockets/roles/http/server/parsers.c
index 641e9b8dac..482bdc676a 100644
--- a/thirdparty/libwebsockets/lib/roles/http/server/parsers.c
+++ b/thirdparty/libwebsockets/roles/http/server/parsers.c
@@ -240,9 +240,8 @@ lws_header_table_attach(struct lws *wsi, int autoservice)
wsi->http.ah->wsi = wsi; /* mark our owner */
pt->http.ah_count_in_use++;
-#if defined(LWS_WITH_PEER_LIMITS) && (defined(LWS_ROLE_H1) || \
- defined(LWS_ROLE_H2))
- lws_context_lock(context, "ah attach"); /* <========================= */
+#if defined(LWS_WITH_PEER_LIMITS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
+ lws_context_lock(context); /* <====================================== */
if (wsi->peer)
wsi->peer->http.count_ah++;
lws_context_unlock(context); /* ====================================> */
@@ -260,7 +259,7 @@ reset:
#ifndef LWS_NO_CLIENT
if (lwsi_role_client(wsi) && lwsi_state(wsi) == LRS_UNCONNECTED)
- if (!lws_http_client_connect_via_info2(wsi))
+ if (!lws_client_connect_via_info2(wsi))
/* our client connect has failed, the wsi
* has been closed
*/
@@ -354,16 +353,14 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)
if (!wsi) /* everybody waiting already has too many ah... */
goto nobody_usable_waiting;
- lwsl_info("%s: transferring ah to last eligible wsi in wait list "
- "%p (wsistate 0x%x)\n", __func__, wsi, wsi->wsistate);
+ lwsl_info("%s: transferring ah to last eligible wsi in wait list %p (wsistate 0x%x)\n", __func__, wsi, wsi->wsistate);
wsi->http.ah = ah;
ah->wsi = wsi; /* new owner */
__lws_header_table_reset(wsi, autoservice);
-#if defined(LWS_WITH_PEER_LIMITS) && (defined(LWS_ROLE_H1) || \
- defined(LWS_ROLE_H2))
- lws_context_lock(context, "ah detach"); /* <========================= */
+#if defined(LWS_WITH_PEER_LIMITS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
+ lws_context_lock(context); /* <====================================== */
if (wsi->peer)
wsi->peer->http.count_ah++;
lws_context_unlock(context); /* ====================================> */
@@ -389,7 +386,7 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)
if (lwsi_role_client(wsi) && lwsi_state(wsi) == LRS_UNCONNECTED) {
lws_pt_unlock(pt);
- if (!lws_http_client_connect_via_info2(wsi)) {
+ if (!lws_client_connect_via_info2(wsi)) {
/* our client connect has failed, the wsi
* has been closed
*/
@@ -400,8 +397,7 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)
}
#endif
- assert(!!pt->http.ah_wait_list_length ==
- !!(lws_intptr_t)pt->http.ah_wait_list);
+ assert(!!pt->http.ah_wait_list_length == !!(lws_intptr_t)pt->http.ah_wait_list);
bail:
lwsl_info("%s: wsi %p: ah %p (tsi=%d, count = %d)\n", __func__,
(void *)wsi, (void *)ah, pt->tid, pt->http.ah_count_in_use);
@@ -463,10 +459,6 @@ LWS_VISIBLE int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)
do {
len += wsi->http.ah->frags[n].len;
n = wsi->http.ah->frags[n].nfrag;
-
- if (n && h != WSI_TOKEN_HTTP_COOKIE)
- ++len;
-
} while (n);
return len;
@@ -508,11 +500,6 @@ LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dst, int len,
{
int toklen = lws_hdr_total_length(wsi, h);
int n;
- int comma;
-
- *dst = '\0';
- if (!toklen)
- return 0;
if (toklen >= len)
return -1;
@@ -525,20 +512,13 @@ LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dst, int len,
return 0;
do {
- comma = (wsi->http.ah->frags[n].nfrag &&
- h != WSI_TOKEN_HTTP_COOKIE) ? 1 : 0;
-
- if (wsi->http.ah->frags[n].len + comma >= len)
+ if (wsi->http.ah->frags[n].len >= len)
return -1;
strncpy(dst, &wsi->http.ah->data[wsi->http.ah->frags[n].offset],
wsi->http.ah->frags[n].len);
dst += wsi->http.ah->frags[n].len;
len -= wsi->http.ah->frags[n].len;
n = wsi->http.ah->frags[n].nfrag;
-
- if (comma)
- *dst++ = ',';
-
} while (n);
*dst = '\0';
@@ -549,9 +529,6 @@ char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)
{
int n;
- if (!wsi->http.ah)
- return NULL;
-
n = wsi->http.ah->frag_index[h];
if (!n)
return NULL;
@@ -562,9 +539,6 @@ char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)
static int LWS_WARN_UNUSED_RESULT
lws_pos_in_bounds(struct lws *wsi)
{
- if (!wsi->http.ah)
- return -1;
-
if (wsi->http.ah->pos <
(unsigned int)wsi->context->max_http_header_data)
return 0;
@@ -625,8 +599,7 @@ issue_char(struct lws *wsi, unsigned char c)
* If we haven't hit the token limit, just copy the character into
* the header
*/
- if (!wsi->http.ah->current_token_limit ||
- frag_len < wsi->http.ah->current_token_limit) {
+ if (frag_len < wsi->http.ah->current_token_limit) {
wsi->http.ah->data[wsi->http.ah->pos++] = c;
if (c)
wsi->http.ah->frags[wsi->http.ah->nfrag].len++;
@@ -895,9 +868,8 @@ lws_parse(struct lws *wsi, unsigned char *buf, int *len)
if (ah->ups == URIPS_SEEN_SLASH_DOT_DOT) {
/*
* back up one dir level if possible
- * safe against header fragmentation
- * because the method URI can only be
- * in 1 fragment
+ * safe against header fragmentation because
+ * the method URI can only be in 1 fragment
*/
if (ah->frags[ah->nfrag].len > 2) {
ah->pos--;
@@ -967,8 +939,7 @@ swallow:
pos = ah->lextable_pos;
while (1) {
- if (lextable[pos] & (1 << 7)) {
- /* 1-byte, fail on mismatch */
+ if (lextable[pos] & (1 << 7)) { /* 1-byte, fail on mismatch */
if ((lextable[pos] & 0x7f) != c) {
nope:
ah->lextable_pos = -1;
@@ -987,15 +958,14 @@ nope:
goto nope;
/* b7 = 0, end or 3-byte */
- if (lextable[pos] < FAIL_CHAR) { /* term mark */
+ if (lextable[pos] < FAIL_CHAR) { /* terminal marker */
ah->lextable_pos = pos;
break;
}
if (lextable[pos] == c) { /* goto */
- ah->lextable_pos = pos +
- (lextable[pos + 1]) +
- (lextable[pos + 2] << 8);
+ ah->lextable_pos = pos + (lextable[pos + 1]) +
+ (lextable[pos + 2] << 8);
break;
}
@@ -1068,13 +1038,13 @@ nope:
n = WSI_TOKEN_ORIGIN;
ah->parser_state = (enum lws_token_indexes)
- (WSI_TOKEN_GET_URI + n);
+ (WSI_TOKEN_GET_URI + n);
ah->ups = URIPS_IDLE;
if (context->token_limits)
ah->current_token_limit = context->
- token_limits->token_limit[
- ah->parser_state];
+ token_limits->token_limit[
+ ah->parser_state];
else
ah->current_token_limit =
wsi->context->max_http_header_data;
@@ -1146,7 +1116,6 @@ excessive:
set_parsing_complete:
if (ah->ues != URIES_IDLE)
goto forbid;
-
if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
if (lws_hdr_total_length(wsi, WSI_TOKEN_VERSION))
wsi->rx_frame_type = /* temp for ws version index */
diff --git a/thirdparty/libwebsockets/lib/roles/http/server/server.c b/thirdparty/libwebsockets/roles/http/server/server.c
index 729315602c..abd86dc9b5 100644
--- a/thirdparty/libwebsockets/lib/roles/http/server/server.c
+++ b/thirdparty/libwebsockets/roles/http/server/server.c
@@ -28,8 +28,6 @@ const char * const method_names[] = {
#endif
};
-static const char * const intermediates[] = { "private", "public" };
-
/*
* return 0: all done
* 1: nonfatal error
@@ -40,7 +38,7 @@ static const char * const intermediates[] = { "private", "public" };
int
_lws_vhost_init_server(const struct lws_context_creation_info *info,
- struct lws_vhost *vhost)
+ struct lws_vhost *vhost)
{
int n, opt = 1, limit = 1;
lws_sockfd_type sockfd;
@@ -83,22 +81,15 @@ _lws_vhost_init_server(const struct lws_context_creation_info *info,
* let's check before we do anything else about the disposition
* of the interface he wants to bind to...
*/
- is = lws_socket_bind(vhost, LWS_SOCK_INVALID, vhost->listen_port,
- vhost->iface);
+ is = lws_socket_bind(vhost, LWS_SOCK_INVALID, vhost->listen_port, vhost->iface);
lwsl_debug("initial if check says %d\n", is);
-
- if (is == LWS_ITOSA_BUSY)
- /* treat as fatal */
- return -1;
-
deal:
lws_start_foreach_llp(struct lws_vhost **, pv,
vhost->context->no_listener_vhost_list) {
if (is >= LWS_ITOSA_USABLE && *pv == vhost) {
/* on the list and shouldn't be: remove it */
- lwsl_debug("deferred iface: removing vh %s\n",
- (*pv)->name);
+ lwsl_debug("deferred iface: removing vh %s\n", (*pv)->name);
*pv = vhost->no_listener_vhost_list;
vhost->no_listener_vhost_list = NULL;
goto done_list;
@@ -114,8 +105,7 @@ deal:
/* ... but needs to be: so add it */
lwsl_debug("deferred iface: adding vh %s\n", vhost->name);
- vhost->no_listener_vhost_list =
- vhost->context->no_listener_vhost_list;
+ vhost->no_listener_vhost_list = vhost->context->no_listener_vhost_list;
vhost->context->no_listener_vhost_list = vhost;
}
@@ -231,16 +221,9 @@ done_list:
}
#endif
#endif
- lws_plat_set_socket_options(vhost, sockfd, 0);
+ lws_plat_set_socket_options(vhost, sockfd);
is = lws_socket_bind(vhost, sockfd, vhost->listen_port, vhost->iface);
- if (is == LWS_ITOSA_BUSY) {
- /* treat as fatal */
- compatible_close(sockfd);
-
- return -1;
- }
-
/*
* There is a race where the network device may come up and then
* go away and fail here. So correctly handle unexpected failure
@@ -251,29 +234,21 @@ done_list:
compatible_close(sockfd);
goto deal;
}
+ vhost->listen_port = is;
+
+ lwsl_debug("%s: lws_socket_bind says %d\n", __func__, is);
wsi = lws_zalloc(sizeof(struct lws), "listen wsi");
if (wsi == NULL) {
lwsl_err("Out of mem\n");
goto bail;
}
-
-#ifdef LWS_WITH_UNIX_SOCK
- if (!LWS_UNIX_SOCK_ENABLED(vhost))
-#endif
- {
- wsi->unix_skt = 1;
- vhost->listen_port = is;
-
- lwsl_debug("%s: lws_socket_bind says %d\n", __func__, is);
- }
-
wsi->context = vhost->context;
wsi->desc.sockfd = sockfd;
lws_role_transition(wsi, 0, LRS_UNCONNECTED, &role_ops_listen);
wsi->protocol = vhost->protocols;
wsi->tsi = m;
- lws_vhost_bind_wsi(vhost, wsi);
+ wsi->vhost = vhost;
wsi->listener = 1;
if (wsi->context->event_loop_ops->init_vhost_listen_wsi)
@@ -321,7 +296,7 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
{
struct lws_vhost *vhost = context->vhost_list;
const char *p;
- int n, colon;
+ int n, m, colon;
n = (int)strlen(servername);
colon = n;
@@ -349,8 +324,8 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
*/
vhost = context->vhost_list;
while (vhost) {
- int m = (int)strlen(vhost->name);
- if (port && port == vhost->listen_port &&
+ m = (int)strlen(vhost->name);
+ if (port == vhost->listen_port &&
m <= (colon - 2) &&
servername[colon - m - 1] == '.' &&
!strncmp(vhost->name, servername + colon - m, m)) {
@@ -365,7 +340,7 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
vhost = context->vhost_list;
while (vhost) {
- if (port && port == vhost->listen_port) {
+ if (port == vhost->listen_port) {
lwsl_info("%s: vhost match to %s based on port %d\n",
__func__, vhost->name, port);
return vhost;
@@ -381,8 +356,8 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
LWS_VISIBLE LWS_EXTERN const char *
lws_get_mimetype(const char *file, const struct lws_http_mount *m)
{
- const struct lws_protocol_vhost_options *pvo = NULL;
int n = (int)strlen(file);
+ const struct lws_protocol_vhost_options *pvo = NULL;
if (m)
pvo = m->extra_mimetypes;
@@ -482,7 +457,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
#endif
int spin = 0;
#endif
- char path[256], sym[2048];
+ char path[256], sym[512];
unsigned char *p = (unsigned char *)sym + 32 + LWS_PRE, *start = p;
unsigned char *end = p + sizeof(sym) - 32 - LWS_PRE;
#if !defined(WIN32) && !defined(LWS_WITH_ESP32)
@@ -519,7 +494,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
lwsl_info("%s: Unable to open '%s': errno %d\n",
__func__, path, errno);
- return 1;
+ return -1;
}
/* if it can't be statted, don't try */
@@ -531,18 +506,18 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
#if !defined(WIN32)
if (fstat(wsi->http.fop_fd->fd, &st)) {
lwsl_info("unable to stat %s\n", path);
- goto notfound;
+ goto bail;
}
#else
#if defined(LWS_HAVE__STAT32I64)
if (_stat32i64(path, &st)) {
lwsl_info("unable to stat %s\n", path);
- goto notfound;
+ goto bail;
}
#else
if (stat(path, &st)) {
lwsl_info("unable to stat %s\n", path);
- goto notfound;
+ goto bail;
}
#endif
#endif
@@ -555,7 +530,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
len = readlink(path, sym, sizeof(sym) - 1);
if (len) {
lwsl_err("Failed to read link %s\n", path);
- goto notfound;
+ goto bail;
}
sym[len] = '\0';
lwsl_debug("symlink %s -> %s\n", path, sym);
@@ -592,48 +567,19 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
if (!strcmp(sym, lws_hdr_simple_ptr(wsi,
WSI_TOKEN_HTTP_IF_NONE_MATCH))) {
- char cache_control[50], *cc = "no-store";
- int cclen = 8;
-
lwsl_debug("%s: ETAG match %s %s\n", __func__,
uri, origin);
/* we don't need to send the payload */
if (lws_add_http_header_status(wsi,
- HTTP_STATUS_NOT_MODIFIED, &p, end)) {
- lwsl_err("%s: failed adding not modified\n",
- __func__);
+ HTTP_STATUS_NOT_MODIFIED, &p, end))
return -1;
- }
if (lws_add_http_header_by_token(wsi,
WSI_TOKEN_HTTP_ETAG,
(unsigned char *)sym, n, &p, end))
return -1;
- /* but we still need to send cache control... */
-
- if (m->cache_max_age && m->cache_reusable) {
- if (!m->cache_revalidate) {
- cc = cache_control;
- cclen = sprintf(cache_control,
- "%s, max-age=%u",
- intermediates[wsi->cache_intermediaries],
- m->cache_max_age);
- } else {
- cc = cache_control;
- cclen = sprintf(cache_control,
- "must-revalidate, %s, max-age=%u",
- intermediates[wsi->cache_intermediaries],
- m->cache_max_age);
- }
- }
-
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_CACHE_CONTROL,
- (unsigned char *)cc, cclen, &p, end))
- return -1;
-
if (lws_finalize_http_header(wsi, &p, end))
return -1;
@@ -648,10 +594,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
lws_vfs_file_close(&wsi->http.fop_fd);
- if (lws_http_transaction_completed(wsi))
- return -1;
-
- return 0;
+ return lws_http_transaction_completed(wsi);
}
}
@@ -662,13 +605,8 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
mimetype = lws_get_mimetype(path, m);
if (!mimetype) {
- lwsl_info("unknown mimetype for %s\n", path);
- if (lws_return_http_status(wsi,
- HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE, NULL) ||
- lws_http_transaction_completed(wsi))
- return -1;
-
- return 0;
+ lwsl_err("unknown mimetype for %s\n", path);
+ goto bail;
}
if (!mimetype[0])
lwsl_debug("sending no mimetype for %s\n", path);
@@ -704,8 +642,8 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
const struct lws_protocols *pp = lws_vhost_name_to_protocol(
wsi->vhost, m->protocol);
- if (lws_bind_protocol(wsi, pp, __func__))
- return -1;
+ if (lws_bind_protocol(wsi, pp))
+ return 1;
args.p = (char *)p;
args.max_len = lws_ptr_diff(end, p);
if (pp->callback(wsi, LWS_CALLBACK_ADD_HEADERS,
@@ -714,7 +652,6 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
p = (unsigned char *)args.p;
}
- *p = '\0';
n = lws_serve_http_file(wsi, path, mimetype, (char *)start,
lws_ptr_diff(p, start));
@@ -722,10 +659,9 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
return -1; /* error or can't reuse connection: close the socket */
return 0;
+bail:
-notfound:
-
- return 1;
+ return -1;
}
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
@@ -813,7 +749,7 @@ lws_unauthorised_basic_auth(struct lws *wsi)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
unsigned char *start = pt->serv_buf + LWS_PRE,
- *p = start, *end = p + 2048;
+ *p = start, *end = p + 512;
char buf[64];
int n;
@@ -912,25 +848,24 @@ lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len)
return -1;
}
-static const char * const oprot[] = {
- "http://", "https://"
-};
-
int
lws_http_action(struct lws *wsi)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- const struct lws_http_mount *hit = NULL;
+ enum http_connection_type connection_type;
enum http_version request_version;
- struct lws_process_html_args args;
- enum http_conn_type conn_type;
char content_length_str[32];
- char http_version_str[12];
- char *uri_ptr = NULL, *s;
- int uri_len = 0, meth, m;
- char http_conn_str[25];
- int http_version_len;
+ struct lws_process_html_args args;
+ const struct lws_http_mount *hit = NULL;
unsigned int n;
+ char http_version_str[10];
+ char http_conn_str[20];
+ int http_version_len;
+ char *uri_ptr = NULL, *s;
+ int uri_len = 0, meth;
+ static const char * const oprot[] = {
+ "http://", "https://"
+ };
meth = lws_http_get_uri_and_method(wsi, &uri_ptr, &uri_len);
if (meth < 0 || meth >= (int)LWS_ARRAY_SIZE(method_names))
@@ -963,21 +898,16 @@ lws_http_action(struct lws *wsi)
/* HTTP header had a content length? */
wsi->http.rx_content_length = 0;
- wsi->http.content_length_explicitly_zero = 0;
if (lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI) ||
- lws_hdr_total_length(wsi, WSI_TOKEN_PATCH_URI) ||
- lws_hdr_total_length(wsi, WSI_TOKEN_PUT_URI))
+ lws_hdr_total_length(wsi, WSI_TOKEN_PATCH_URI) ||
+ lws_hdr_total_length(wsi, WSI_TOKEN_PUT_URI))
wsi->http.rx_content_length = 100 * 1024 * 1024;
- if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH) &&
- lws_hdr_copy(wsi, content_length_str,
- sizeof(content_length_str) - 1,
- WSI_TOKEN_HTTP_CONTENT_LENGTH) > 0) {
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {
+ lws_hdr_copy(wsi, content_length_str,
+ sizeof(content_length_str) - 1,
+ WSI_TOKEN_HTTP_CONTENT_LENGTH);
wsi->http.rx_content_length = atoll(content_length_str);
- if (!wsi->http.rx_content_length) {
- wsi->http.content_length_explicitly_zero = 1;
- lwsl_debug("%s: explicit 0 content-length\n", __func__);
- }
}
if (wsi->http2_substream) {
@@ -988,33 +918,35 @@ lws_http_action(struct lws *wsi)
/* Works for single digit HTTP versions. : */
http_version_len = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP);
- if (http_version_len > 7 &&
- lws_hdr_copy(wsi, http_version_str,
- sizeof(http_version_str) - 1,
- WSI_TOKEN_HTTP) > 0 &&
- http_version_str[5] == '1' && http_version_str[7] == '1')
- request_version = HTTP_VERSION_1_1;
-
+ if (http_version_len > 7) {
+ lws_hdr_copy(wsi, http_version_str,
+ sizeof(http_version_str) - 1,
+ WSI_TOKEN_HTTP);
+ if (http_version_str[5] == '1' &&
+ http_version_str[7] == '1')
+ request_version = HTTP_VERSION_1_1;
+ }
wsi->http.request_version = request_version;
/* HTTP/1.1 defaults to "keep-alive", 1.0 to "close" */
if (request_version == HTTP_VERSION_1_1)
- conn_type = HTTP_CONNECTION_KEEP_ALIVE;
+ connection_type = HTTP_CONNECTION_KEEP_ALIVE;
else
- conn_type = HTTP_CONNECTION_CLOSE;
+ connection_type = HTTP_CONNECTION_CLOSE;
/* Override default if http "Connection:" header: */
- if (lws_hdr_total_length(wsi, WSI_TOKEN_CONNECTION) &&
- lws_hdr_copy(wsi, http_conn_str, sizeof(http_conn_str) - 1,
- WSI_TOKEN_CONNECTION) > 0) {
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_CONNECTION)) {
+ lws_hdr_copy(wsi, http_conn_str,
+ sizeof(http_conn_str) - 1,
+ WSI_TOKEN_CONNECTION);
http_conn_str[sizeof(http_conn_str) - 1] = '\0';
if (!strcasecmp(http_conn_str, "keep-alive"))
- conn_type = HTTP_CONNECTION_KEEP_ALIVE;
+ connection_type = HTTP_CONNECTION_KEEP_ALIVE;
else
if (!strcasecmp(http_conn_str, "close"))
- conn_type = HTTP_CONNECTION_CLOSE;
+ connection_type = HTTP_CONNECTION_CLOSE;
}
- wsi->http.conn_type = conn_type;
+ wsi->http.connection_type = connection_type;
}
n = wsi->protocol->callback(wsi, LWS_CALLBACK_FILTER_HTTP_CONNECTION,
@@ -1038,7 +970,7 @@ lws_http_action(struct lws *wsi)
* URI from the host: header and ignore the path part
*/
unsigned char *start = pt->serv_buf + LWS_PRE, *p = start,
- *end = p + wsi->context->pt_serv_buf_size - LWS_PRE;
+ *end = p + 512;
if (!lws_hdr_total_length(wsi, WSI_TOKEN_HOST))
goto bail_nuke_ah;
@@ -1056,7 +988,7 @@ lws_http_action(struct lws *wsi)
#endif
#ifdef LWS_WITH_ACCESS_LOG
- lws_prepare_access_log_info(wsi, uri_ptr, uri_len, meth);
+ lws_prepare_access_log_info(wsi, uri_ptr, meth);
#endif
/* can we serve it from the mount list? */
@@ -1067,13 +999,12 @@ lws_http_action(struct lws *wsi)
lwsl_info("no hit\n");
- if (lws_bind_protocol(wsi, &wsi->vhost->protocols[0],
- "no mount hit"))
+ if (lws_bind_protocol(wsi, &wsi->vhost->protocols[0]))
return 1;
lwsi_set_state(wsi, LRS_DOING_TRANSACTION);
- m = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
+ n = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
wsi->user_space, uri_ptr, uri_len);
goto after;
@@ -1104,11 +1035,10 @@ lws_http_action(struct lws *wsi)
hit->origin_protocol == LWSMPRO_REDIR_HTTPS)) &&
(hit->origin_protocol != LWSMPRO_CGI &&
hit->origin_protocol != LWSMPRO_CALLBACK)) {
- unsigned char *start = pt->serv_buf + LWS_PRE, *p = start,
- *end = p + wsi->context->pt_serv_buf_size -
- LWS_PRE - 512;
+ unsigned char *start = pt->serv_buf + LWS_PRE,
+ *p = start, *end = p + 512;
- lwsl_info("Doing 301 '%s' org %s\n", s, hit->origin);
+ lwsl_debug("Doing 301 '%s' org %s\n", s, hit->origin);
/* > at start indicates deal with by redirect */
if (hit->origin_protocol == LWSMPRO_REDIR_HTTP ||
@@ -1145,21 +1075,12 @@ lws_http_action(struct lws *wsi)
/* basic auth? */
if (hit->basic_auth_login_file) {
- char b64[160], plain[(sizeof(b64) * 3) / 4], *pcolon;
- int m, ml, fi;
+ char b64[160], plain[(sizeof(b64) * 3) / 4];
+ int m;
/* Did he send auth? */
- ml = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_AUTHORIZATION);
- if (!ml)
- return lws_unauthorised_basic_auth(wsi);
-
- /* Disallow fragmentation monkey business */
-
- fi = wsi->http.ah->frag_index[WSI_TOKEN_HTTP_AUTHORIZATION];
- if (wsi->http.ah->frags[fi].nfrag) {
- lwsl_err("fragmented basic auth header not allowed\n");
+ if (!lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_AUTHORIZATION))
return lws_unauthorised_basic_auth(wsi);
- }
n = HTTP_STATUS_FORBIDDEN;
@@ -1178,36 +1099,21 @@ lws_http_action(struct lws *wsi)
/* It'll be like Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l */
- m = lws_b64_decode_string(b64 + 6, plain, sizeof(plain) - 1);
+ m = lws_b64_decode_string(b64 + 6, plain, sizeof(plain));
if (m < 0) {
lwsl_err("plain auth too long\n");
goto transaction_result_n;
}
- plain[m] = '\0';
- pcolon = strchr(plain, ':');
- if (!pcolon) {
- lwsl_err("basic auth format broken\n");
- return lws_unauthorised_basic_auth(wsi);
- }
if (!lws_find_string_in_file(hit->basic_auth_login_file,
plain, m)) {
lwsl_err("basic auth lookup failed\n");
return lws_unauthorised_basic_auth(wsi);
}
- /*
- * Rewrite WSI_TOKEN_HTTP_AUTHORIZATION so it is just the
- * authorized username
- */
+ lwsl_info("basic auth accepted\n");
- *pcolon = '\0';
- wsi->http.ah->frags[fi].len = lws_ptr_diff(pcolon, plain);
- pcolon = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_AUTHORIZATION);
- strncpy(pcolon, plain, ml - 1);
- pcolon[ml - 1] = '\0';
- lwsl_info("%s: basic auth accepted for %s\n", __func__,
- lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_AUTHORIZATION));
+ /* accept the auth */
}
#if defined(LWS_WITH_HTTP_PROXY)
@@ -1215,21 +1121,15 @@ lws_http_action(struct lws *wsi)
* The mount is a reverse proxy?
*/
- // lwsl_notice("%s: origin_protocol: %d\n", __func__, hit->origin_protocol);
-
if (hit->origin_protocol == LWSMPRO_HTTPS ||
hit->origin_protocol == LWSMPRO_HTTP) {
- char ads[96], rpath[256], *pcolon, *pslash, unix_skt = 0;
struct lws_client_connect_info i;
- struct lws *cwsi;
+ char ads[96], rpath[256], *pcolon, *pslash, *p;
int n, na;
memset(&i, 0, sizeof(i));
i.context = lws_get_context(wsi);
- if (hit->origin[0] == '+')
- unix_skt = 1;
-
pcolon = strchr(hit->origin, ':');
pslash = strchr(hit->origin, '/');
if (!pslash) {
@@ -1237,28 +1137,16 @@ lws_http_action(struct lws *wsi)
hit->origin);
return -1;
}
+ if (pcolon > pslash)
+ pcolon = NULL;
- if (unix_skt) {
- if (!pcolon) {
- lwsl_err("Proxy mount origin for unix skt must "
- "have address delimited by :\n");
-
- return -1;
- }
- n = lws_ptr_diff(pcolon, hit->origin);
- pslash = pcolon;
- } else {
- if (pcolon > pslash)
- pcolon = NULL;
-
- if (pcolon)
- n = (int)(pcolon - hit->origin);
- else
- n = (int)(pslash - hit->origin);
+ if (pcolon)
+ n = pcolon - hit->origin;
+ else
+ n = pslash - hit->origin;
- if (n >= (int)sizeof(ads) - 2)
- n = sizeof(ads) - 2;
- }
+ if (n >= (int)sizeof(ads) - 2)
+ n = sizeof(ads) - 2;
memcpy(ads, hit->origin, n);
ads[n] = '\0';
@@ -1272,75 +1160,41 @@ lws_http_action(struct lws *wsi)
if (pcolon)
i.port = atoi(pcolon + 1);
- n = lws_snprintf(rpath, sizeof(rpath) - 1, "/%s/%s",
- pslash + 1, uri_ptr + hit->mountpoint_len) - 2;
+ lws_snprintf(rpath, sizeof(rpath) - 1, "/%s/%s", pslash + 1,
+ uri_ptr + hit->mountpoint_len);
lws_clean_url(rpath);
na = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_URI_ARGS);
if (na) {
- char *p = rpath + n;
-
- if (na >= (int)sizeof(rpath) - n - 2) {
- lwsl_info("%s: query string %d longer "
- "than we can handle\n", __func__,
- na);
-
- return -1;
- }
-
+ p = rpath + strlen(rpath);
*p++ = '?';
- if (lws_hdr_copy(wsi, p,
- (int)(&rpath[sizeof(rpath) - 1] - p),
- WSI_TOKEN_HTTP_URI_ARGS) > 0)
- while (na--) {
- if (*p == '\0')
- *p = '&';
- p++;
- }
- *p = '\0';
+ lws_hdr_copy(wsi, p, &rpath[sizeof(rpath) - 1] - p,
+ WSI_TOKEN_HTTP_URI_ARGS);
+ while (--na) {
+ if (*p == '\0')
+ *p = '&';
+ p++;
+ }
}
+
i.path = rpath;
- if (i.address[0] != '+' ||
- !lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST))
- i.host = i.address;
- else
- i.host = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST);
+ i.host = i.address;
i.origin = NULL;
i.method = "GET";
- i.alpn = "http/1.1";
i.parent_wsi = wsi;
- i.pwsi = &cwsi;
-
- // i.uri_replace_from = hit->origin;
- // i.uri_replace_to = hit->mountpoint;
+ i.uri_replace_from = hit->origin;
+ i.uri_replace_to = hit->mountpoint;
- lwsl_info("proxying to %s port %d url %s, ssl %d, "
+ lwsl_notice("proxying to %s port %d url %s, ssl %d, "
"from %s, to %s\n",
i.address, i.port, i.path, i.ssl_connection,
i.uri_replace_from, i.uri_replace_to);
if (!lws_client_connect_via_info(&i)) {
lwsl_err("proxy connect fail\n");
-
- /*
- * ... we can't do the proxy action, but we can
- * cleanly return him a 503 and a description
- */
-
- lws_return_http_status(wsi,
- HTTP_STATUS_SERVICE_UNAVAILABLE,
- "<h1>Service Temporarily Unavailable</h1>"
- "The server is temporarily unable to service "
- "your request due to maintenance downtime or "
- "capacity problems. Please try again later.");
-
return 1;
}
- lwsl_info("%s: setting proxy clientside on %p (parent %p)\n",
- __func__, cwsi, lws_get_parent(cwsi));
- cwsi->http.proxy_clientside = 1;
-
return 0;
}
#endif
@@ -1365,7 +1219,7 @@ lws_http_action(struct lws *wsi)
return 1;
}
- if (lws_bind_protocol(wsi, pp, "http action CALLBACK bind"))
+ if (lws_bind_protocol(wsi, pp))
return 1;
args.p = uri_ptr;
@@ -1391,7 +1245,7 @@ lws_http_action(struct lws *wsi)
return 1;
if (lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI)) {
- m = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
+ n = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
wsi->user_space,
uri_ptr + hit->mountpoint_len,
uri_len - hit->mountpoint_len);
@@ -1425,7 +1279,7 @@ lws_http_action(struct lws *wsi)
}
#endif
- n = uri_len - lws_ptr_diff(s, uri_ptr); // (int)strlen(s);
+ n = (int)strlen(s);
if (s[0] == '\0' || (n == 1 && s[n - 1] == '/'))
s = (char *)hit->def;
if (!s)
@@ -1436,11 +1290,10 @@ lws_http_action(struct lws *wsi)
wsi->cache_revalidate = hit->cache_revalidate;
wsi->cache_intermediaries = hit->cache_intermediaries;
- m = 1;
+ n = 1;
if (hit->origin_protocol == LWSMPRO_FILE)
- m = lws_http_serve(wsi, s, hit->origin, hit);
-
- if (m > 0) {
+ n = lws_http_serve(wsi, s, hit->origin, hit);
+ if (n) {
/*
* lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
*/
@@ -1449,22 +1302,20 @@ lws_http_action(struct lws *wsi)
lws_vhost_name_to_protocol(
wsi->vhost, hit->protocol);
- lwsi_set_state(wsi, LRS_DOING_TRANSACTION);
-
- if (lws_bind_protocol(wsi, pp, "http_action HTTP"))
+ if (lws_bind_protocol(wsi, pp))
return 1;
- m = pp->callback(wsi, LWS_CALLBACK_HTTP,
+ n = pp->callback(wsi, LWS_CALLBACK_HTTP,
wsi->user_space,
uri_ptr + hit->mountpoint_len,
uri_len - hit->mountpoint_len);
} else
- m = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
+ n = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
wsi->user_space, uri_ptr, uri_len);
}
after:
- if (m) {
+ if (n) {
lwsl_info("LWS_CALLBACK_HTTP closing\n");
return 1;
@@ -1486,35 +1337,9 @@ deal_body:
lwsl_debug("wsi->http.rx_content_length %lld %d %d\n",
(long long)wsi->http.rx_content_length,
wsi->upgraded_to_http2, wsi->http2_substream);
-
- if (wsi->http.content_length_explicitly_zero &&
- lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI)) {
-
- /*
- * POST with an explicit content-length of zero
- *
- * If we don't give the user code the empty HTTP_BODY
- * callback, he may become confused to hear the
- * HTTP_BODY_COMPLETION (due to, eg, instantiation of
- * lws_spa never happened).
- *
- * HTTP_BODY_COMPLETION is responsible for sending the
- * result status code and result body if any, and
- * do the transaction complete processing.
- */
- if (wsi->protocol->callback(wsi,
- LWS_CALLBACK_HTTP_BODY,
- wsi->user_space, NULL, 0))
- return 1;
- if (wsi->protocol->callback(wsi,
- LWS_CALLBACK_HTTP_BODY_COMPLETION,
- wsi->user_space, NULL, 0))
- return 1;
-
- return 0;
- }
-
if (wsi->http.rx_content_length > 0) {
+ struct lws_tokens ebuf;
+ int m;
lwsi_set_state(wsi, LRS_BODY);
lwsl_info("%s: %p: LRS_BODY state set (0x%x)\n",
@@ -1530,18 +1355,12 @@ deal_body:
*/
while (1) {
- struct lws_tokens ebuf;
- int m;
-
ebuf.len = (int)lws_buflist_next_segment_len(
- &wsi->buflist,
- (uint8_t **)&ebuf.token);
+ &wsi->buflist, (uint8_t **)&ebuf.token);
if (!ebuf.len)
break;
- lwsl_notice("%s: consuming %d\n", __func__,
- (int)ebuf.len);
- m = lws_read_h1(wsi, (uint8_t *)ebuf.token,
- ebuf.len);
+ lwsl_notice("%s: consuming %d\n", __func__, (int)ebuf.len);
+ m = lws_read_h1(wsi, (uint8_t *)ebuf.token, ebuf.len);
if (m < 0)
return -1;
@@ -1565,75 +1384,6 @@ transaction_result_n:
}
int
-lws_confirm_host_header(struct lws *wsi)
-{
- struct lws_tokenize ts;
- lws_tokenize_elem e;
- char buf[128];
- int port = 80;
-
- /*
- * this vhost wants us to validate what the
- * client sent against our vhost name
- */
-
- if (!lws_hdr_total_length(wsi, WSI_TOKEN_HOST)) {
- lwsl_info("%s: missing host on upgrade\n", __func__);
-
- return 1;
- }
-
-#if defined(LWS_WITH_TLS)
- if (wsi->tls.ssl)
- port = 443;
-#endif
-
- lws_tokenize_init(&ts, buf, LWS_TOKENIZE_F_DOT_NONTERM /* server.com */|
- LWS_TOKENIZE_F_NO_FLOATS /* 1.server.com */|
- LWS_TOKENIZE_F_MINUS_NONTERM /* a-b.com */);
- ts.len = lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_HOST);
- if (ts.len <= 0) {
- lwsl_info("%s: missing or oversize host header\n", __func__);
- return 1;
- }
-
- if (lws_tokenize(&ts) != LWS_TOKZE_TOKEN)
- goto bad_format;
-
- if (strncmp(ts.token, wsi->vhost->name, ts.token_len)) {
- buf[(ts.token - buf) + ts.token_len] = '\0';
- lwsl_info("%s: '%s' in host hdr but vhost name %s\n",
- __func__, ts.token, wsi->vhost->name);
- return 1;
- }
-
- e = lws_tokenize(&ts);
- if (e == LWS_TOKZE_DELIMITER && ts.token[0] == ':') {
- if (lws_tokenize(&ts) != LWS_TOKZE_INTEGER)
- goto bad_format;
- else
- port = atoi(ts.token);
- } else
- if (e != LWS_TOKZE_ENDED)
- goto bad_format;
-
- if (wsi->vhost->listen_port != port) {
- lwsl_info("%s: host port %d mismatches vhost port %d\n",
- __func__, port, wsi->vhost->listen_port);
- return 1;
- }
-
- lwsl_debug("%s: host header OK\n", __func__);
-
- return 0;
-
-bad_format:
- lwsl_info("%s: bad host header format\n", __func__);
-
- return 1;
-}
-
-int
lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)
{
struct lws_context *context = lws_get_context(wsi);
@@ -1677,8 +1427,7 @@ raw_transition:
lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
lws_bind_protocol(wsi, &wsi->vhost->protocols[
wsi->vhost->
- raw_protocol_index],
- __func__);
+ raw_protocol_index]);
lwsl_info("transition to raw vh %s prot %d\n",
wsi->vhost->name,
wsi->vhost->raw_protocol_index);
@@ -1691,7 +1440,7 @@ raw_transition:
&role_ops_raw_skt);
lws_header_table_detach(wsi, 1);
- if (wsi->protocol->callback(wsi,
+ if (m == 2 && (wsi->protocol->callback)(wsi,
LWS_CALLBACK_RAW_RX,
wsi->user_space, obuf, olen))
return 1;
@@ -1709,14 +1458,13 @@ raw_transition:
/* select vhost */
- if (wsi->vhost->listen_port &&
- lws_hdr_total_length(wsi, WSI_TOKEN_HOST)) {
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_HOST)) {
struct lws_vhost *vhost = lws_select_vhost(
context, wsi->vhost->listen_port,
lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST));
if (vhost)
- lws_vhost_bind_wsi(vhost, wsi);
+ wsi->vhost = vhost;
} else
lwsl_info("no host\n");
@@ -1758,7 +1506,7 @@ raw_transition:
&uri_ptr, &uri_len);
if (meth >= 0)
lws_prepare_access_log_info(wsi,
- uri_ptr, uri_len, meth);
+ uri_ptr, meth);
/* wsi close will do the log */
#endif
@@ -1784,49 +1532,12 @@ raw_transition:
lwsi_set_state(wsi, LRS_PRE_WS_SERVING_ACCEPT);
lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
- if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
-
- const char *up = lws_hdr_simple_ptr(wsi,
- WSI_TOKEN_UPGRADE);
-
- if (strcasecmp(up, "websocket") &&
- strcasecmp(up, "h2c")) {
- lwsl_info("Unknown upgrade '%s'\n", up);
-
- if (lws_return_http_status(wsi,
- HTTP_STATUS_FORBIDDEN, NULL) ||
- lws_http_transaction_completed(wsi))
- goto bail_nuke_ah;
- }
-
- n = user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_HTTP_CONFIRM_UPGRADE,
- wsi->user_space, (char *)up, 0);
-
- /* just hang up? */
-
- if (n < 0)
- goto bail_nuke_ah;
-
- /* callback returned headers already, do t_c? */
-
- if (n > 0) {
- if (lws_http_transaction_completed(wsi))
- goto bail_nuke_ah;
-
- /* continue on */
-
- return 0;
- }
-
- /* callback said 0, it was allowed */
+ /* is this websocket protocol or normal http 1.0? */
- if (wsi->vhost->options &
- LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK &&
- lws_confirm_host_header(wsi))
- goto bail_nuke_ah;
-
- if (!strcasecmp(up, "websocket")) {
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
+ if (!strcasecmp(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_UPGRADE),
+ "websocket")) {
#if defined(LWS_ROLE_WS)
wsi->vhost->conn_stats.ws_upg++;
lwsl_info("Upgrade to ws\n");
@@ -1834,12 +1545,17 @@ raw_transition:
#endif
}
#if defined(LWS_WITH_HTTP2)
- if (!strcasecmp(up, "h2c")) {
+ if (!strcasecmp(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_UPGRADE),
+ "h2c")) {
wsi->vhost->conn_stats.h2_upg++;
lwsl_info("Upgrade to h2c\n");
goto upgrade_h2c;
}
#endif
+ lwsl_info("Unknown upgrade\n");
+ /* dunno what he wanted to upgrade to */
+ goto bail_nuke_ah;
}
/* no upgrade ack... he remained as HTTP */
@@ -1849,10 +1565,6 @@ raw_transition:
lwsi_set_state(wsi, LRS_ESTABLISHED);
wsi->http.fop_fd = NULL;
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- lws_http_compression_validate(wsi);
-#endif
-
lwsl_debug("%s: wsi %p: ah %p\n", __func__, (void *)wsi,
(void *)wsi->http.ah);
@@ -1929,17 +1641,91 @@ bail_nuke_ah:
}
+static int
+lws_get_idlest_tsi(struct lws_context *context)
+{
+ unsigned int lowest = ~0;
+ int n = 0, hit = -1;
+
+ for (; n < context->count_threads; n++) {
+ if ((unsigned int)context->pt[n].fds_count !=
+ context->fd_limit_per_thread - 1 &&
+ (unsigned int)context->pt[n].fds_count < lowest) {
+ lowest = context->pt[n].fds_count;
+ hit = n;
+ }
+ }
+
+ return hit;
+}
+
+struct lws *
+lws_create_new_server_wsi(struct lws_vhost *vhost, int fixed_tsi)
+{
+ struct lws *new_wsi;
+ int n = fixed_tsi;
+
+ if (n < 0)
+ n = lws_get_idlest_tsi(vhost->context);
+
+ if (n < 0) {
+ lwsl_err("no space for new conn\n");
+ return NULL;
+ }
+
+ new_wsi = lws_zalloc(sizeof(struct lws), "new server wsi");
+ if (new_wsi == NULL) {
+ lwsl_err("Out of memory for new connection\n");
+ return NULL;
+ }
+
+ new_wsi->tsi = n;
+ lwsl_debug("new wsi %p joining vhost %s, tsi %d\n", new_wsi,
+ vhost->name, new_wsi->tsi);
+
+ new_wsi->vhost = vhost;
+ new_wsi->context = vhost->context;
+ new_wsi->pending_timeout = NO_PENDING_TIMEOUT;
+ new_wsi->rxflow_change_to = LWS_RXFLOW_ALLOW;
+
+ /* initialize the instance struct */
+
+ lwsi_set_state(new_wsi, LRS_UNCONNECTED);
+ new_wsi->hdr_parsing_completed = 0;
+
+#ifdef LWS_WITH_TLS
+ new_wsi->tls.use_ssl = LWS_SSL_ENABLED(vhost);
+#endif
+
+ /*
+ * these can only be set once the protocol is known
+ * we set an un-established connection's protocol pointer
+ * to the start of the supported list, so it can look
+ * for matching ones during the handshake
+ */
+ new_wsi->protocol = vhost->protocols;
+ new_wsi->user_space = NULL;
+ new_wsi->desc.sockfd = LWS_SOCK_INVALID;
+ new_wsi->position_in_fds_table = LWS_NO_FDS_POS;
+
+ vhost->context->count_wsi_allocated++;
+
+ /*
+ * outermost create notification for wsi
+ * no user_space because no protocol selection
+ */
+ vhost->protocols[0].callback(new_wsi, LWS_CALLBACK_WSI_CREATE,
+ NULL, NULL, 0);
+
+ return new_wsi;
+}
+
LWS_VISIBLE int LWS_WARN_UNUSED_RESULT
lws_http_transaction_completed(struct lws *wsi)
{
int n = NO_PENDING_TIMEOUT;
- if (lws_has_buffered_out(wsi)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- || wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more
-#endif
- ) {
+ if (wsi->trunc_len) {
/*
* ...so he tried to send something large as the http reply,
* it went as a partial, but he immediately said the
@@ -1948,18 +1734,14 @@ lws_http_transaction_completed(struct lws *wsi)
* Defer the transaction completed until the last part of the
* partial is sent.
*/
- lwsl_debug("%s: %p: deferring due to partial\n", __func__, wsi);
+ lwsl_notice("%s: deferring due to partial\n", __func__);
wsi->http.deferred_transaction_completed = 1;
- lws_callback_on_writable(wsi);
return 0;
}
lwsl_info("%s: wsi %p\n", __func__, wsi);
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- lws_http_compression_destroy(wsi);
-#endif
lws_access_log(wsi);
if (!wsi->hdr_parsing_completed) {
@@ -1973,17 +1755,17 @@ lws_http_transaction_completed(struct lws *wsi)
/* if we can't go back to accept new headers, drop the connection */
if (wsi->http2_substream)
- return 1;
+ return 0;
if (wsi->seen_zero_length_recv)
return 1;
- if (wsi->http.conn_type != HTTP_CONNECTION_KEEP_ALIVE) {
- lwsl_info("%s: %p: close connection\n", __func__, wsi);
+ if (wsi->http.connection_type != HTTP_CONNECTION_KEEP_ALIVE) {
+ lwsl_notice("%s: %p: close connection\n", __func__, wsi);
return 1;
}
- if (lws_bind_protocol(wsi, &wsi->vhost->protocols[0], __func__))
+ if (lws_bind_protocol(wsi, &wsi->vhost->protocols[0]))
return 1;
/*
@@ -1998,7 +1780,6 @@ lws_http_transaction_completed(struct lws *wsi)
wsi->http.tx_content_length = 0;
wsi->http.tx_content_remain = 0;
wsi->hdr_parsing_completed = 0;
- wsi->sending_chunked = 0;
#ifdef LWS_WITH_ACCESS_LOG
wsi->http.access_log.sent = 0;
#endif
@@ -2022,7 +1803,7 @@ lws_http_transaction_completed(struct lws *wsi)
if (wsi->http.ah) {
// lws_buflist_describe(&wsi->buflist, wsi);
if (!lws_buflist_next_segment_len(&wsi->buflist, NULL)) {
- lwsl_debug("%s: %p: nothing in buflist, detaching ah\n",
+ lwsl_info("%s: %p: nothing in buflist so detaching ah\n",
__func__, wsi);
lws_header_table_detach(wsi, 1);
#ifdef LWS_WITH_TLS
@@ -2042,7 +1823,7 @@ lws_http_transaction_completed(struct lws *wsi)
}
#endif
} else {
- lwsl_info("%s: %p: resetting/keeping ah as pipeline\n",
+ lwsl_info("%s: %p: resetting and keeping ah as pipeline\n",
__func__, wsi);
lws_header_table_reset(wsi, 0);
/*
@@ -2058,41 +1839,360 @@ lws_http_transaction_completed(struct lws *wsi)
if (wsi->http.ah)
wsi->http.ah->ues = URIES_IDLE;
- //lwsi_set_state(wsi, LRS_ESTABLISHED); // !!!
+ //lwsi_set_state(wsi, LRS_ESTABLISHED);
} else
if (lws_buflist_next_segment_len(&wsi->buflist, NULL))
if (lws_header_table_attach(wsi, 0))
lwsl_debug("acquired ah\n");
- lwsl_debug("%s: %p: keep-alive await new transaction (state 0x%x)\n",
- __func__, wsi, wsi->wsistate);
+ lwsl_info("%s: %p: keep-alive await new transaction\n", __func__, wsi);
lws_callback_on_writable(wsi);
return 0;
}
+/* if not a socket, it's a raw, non-ssl file descriptor */
+
+LWS_VISIBLE struct lws *
+lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
+ lws_sock_file_fd_type fd, const char *vh_prot_name,
+ struct lws *parent)
+{
+ struct lws_context *context = vh->context;
+ struct lws *new_wsi;
+ struct lws_context_per_thread *pt;
+ int n, ssl = 0;
+
+#if defined(LWS_WITH_PEER_LIMITS)
+ struct lws_peer *peer = NULL;
+
+ if (type & LWS_ADOPT_SOCKET && !(type & LWS_ADOPT_WS_PARENTIO)) {
+ peer = lws_get_or_create_peer(vh, fd.sockfd);
+
+ if (peer && context->ip_limit_wsi &&
+ peer->count_wsi >= context->ip_limit_wsi) {
+ lwsl_notice("Peer reached wsi limit %d\n",
+ context->ip_limit_wsi);
+ lws_stats_atomic_bump(context, &context->pt[0],
+ LWSSTATS_C_PEER_LIMIT_WSI_DENIED, 1);
+ return NULL;
+ }
+ }
+#endif
+
+ n = -1;
+ if (parent)
+ n = parent->tsi;
+ new_wsi = lws_create_new_server_wsi(vh, n);
+ if (!new_wsi) {
+ if (type & LWS_ADOPT_SOCKET && !(type & LWS_ADOPT_WS_PARENTIO))
+ compatible_close(fd.sockfd);
+ return NULL;
+ }
+#if defined(LWS_WITH_PEER_LIMITS)
+ if (peer)
+ lws_peer_add_wsi(context, peer, new_wsi);
+#endif
+ pt = &context->pt[(int)new_wsi->tsi];
+ lws_stats_atomic_bump(context, pt, LWSSTATS_C_CONNECTIONS, 1);
+
+ if (parent) {
+ new_wsi->parent = parent;
+ new_wsi->sibling_list = parent->child_list;
+ parent->child_list = new_wsi;
+
+ if (type & LWS_ADOPT_WS_PARENTIO)
+ new_wsi->parent_carries_io = 1;
+ }
+
+ new_wsi->desc = fd;
+
+ if (vh_prot_name) {
+ new_wsi->protocol = lws_vhost_name_to_protocol(new_wsi->vhost,
+ vh_prot_name);
+ if (!new_wsi->protocol) {
+ lwsl_err("Protocol %s not enabled on vhost %s\n",
+ vh_prot_name, new_wsi->vhost->name);
+ goto bail;
+ }
+ if (lws_ensure_user_space(new_wsi)) {
+ lwsl_notice("OOM trying to get user_space\n");
+ goto bail;
+ }
+#if defined(LWS_ROLE_WS)
+ if (type & LWS_ADOPT_WS_PARENTIO) {
+ new_wsi->desc.sockfd = LWS_SOCK_INVALID;
+ lwsl_debug("binding to %s\n", new_wsi->protocol->name);
+ lws_bind_protocol(new_wsi, new_wsi->protocol);
+ lws_role_transition(new_wsi, LWSIFR_SERVER,
+ LRS_ESTABLISHED, &role_ops_ws);
+ /* allocate the ws struct for the wsi */
+ new_wsi->ws = lws_zalloc(sizeof(*new_wsi->ws), "ws struct");
+ if (!new_wsi->ws) {
+ lwsl_notice("OOM\n");
+ goto bail;
+ }
+ lws_server_init_wsi_for_ws(new_wsi);
+
+ return new_wsi;
+ }
+#endif
+ } else
+#if defined(LWS_ROLE_H1)
+ if (type & LWS_ADOPT_HTTP) {/* he will transition later */
+ new_wsi->protocol =
+ &vh->protocols[vh->default_protocol_index];
+ new_wsi->role_ops = &role_ops_h1;
+ }
+ else
+#endif
+ { /* this is the only time he will transition */
+ lws_bind_protocol(new_wsi,
+ &vh->protocols[vh->raw_protocol_index]);
+ lws_role_transition(new_wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_skt);
+ }
+
+ if (type & LWS_ADOPT_SOCKET) { /* socket desc */
+ lwsl_debug("%s: new wsi %p, sockfd %d\n", __func__, new_wsi,
+ (int)(lws_intptr_t)fd.sockfd);
+#if !defined(LWS_WITH_ESP32)
+ if (type & LWS_ADOPT_FLAG_UDP)
+ /*
+ * these can be >128 bytes, so just alloc for UDP
+ */
+ new_wsi->udp = lws_malloc(sizeof(*new_wsi->udp),
+ "udp struct");
+#endif
+
+ if (type & LWS_ADOPT_HTTP)
+ /* the transport is accepted...
+ * give him time to negotiate */
+ lws_set_timeout(new_wsi,
+ PENDING_TIMEOUT_ESTABLISH_WITH_SERVER,
+ context->timeout_secs);
+
+ } else /* file desc */
+ lwsl_debug("%s: new wsi %p, filefd %d\n", __func__, new_wsi,
+ (int)(lws_intptr_t)fd.filefd);
+
+ /*
+ * A new connection was accepted. Give the user a chance to
+ * set properties of the newly created wsi. There's no protocol
+ * selected yet so we issue this to the vhosts's default protocol,
+ * itself by default protocols[0]
+ */
+ n = LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED;
+ if (!(type & LWS_ADOPT_HTTP)) {
+ if (!(type & LWS_ADOPT_SOCKET))
+ n = LWS_CALLBACK_RAW_ADOPT_FILE;
+ else
+ n = LWS_CALLBACK_RAW_ADOPT;
+ }
+
+ if (!LWS_SSL_ENABLED(new_wsi->vhost) || !(type & LWS_ADOPT_ALLOW_SSL) ||
+ !(type & LWS_ADOPT_SOCKET)) {
+ /* non-SSL */
+ if (!(type & LWS_ADOPT_HTTP)) {
+ if (!(type & LWS_ADOPT_SOCKET))
+ lws_role_transition(new_wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_file);
+ else
+ lws_role_transition(new_wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_skt);
+ }
+#if defined(LWS_ROLE_H1)
+ else
+ lws_role_transition(new_wsi, LWSIFR_SERVER,
+ LRS_HEADERS, &role_ops_h1);
+#endif
+ } else {
+ /* SSL */
+ if (!(type & LWS_ADOPT_HTTP))
+ lws_role_transition(new_wsi, 0, LRS_SSL_INIT,
+ &role_ops_raw_skt);
+#if defined(LWS_ROLE_H1)
+ else
+ lws_role_transition(new_wsi, LWSIFR_SERVER,
+ LRS_SSL_INIT, &role_ops_h1);
+#endif
+ ssl = 1;
+ }
+
+ lwsl_debug("new wsi wsistate 0x%x\n", new_wsi->wsistate);
+
+ if (context->event_loop_ops->accept)
+ context->event_loop_ops->accept(new_wsi);
+
+ if (!ssl) {
+ lws_pt_lock(pt, __func__);
+ if (__insert_wsi_socket_into_fds(context, new_wsi)) {
+ lws_pt_unlock(pt);
+ lwsl_err("%s: fail inserting socket\n", __func__);
+ goto fail;
+ }
+ lws_pt_unlock(pt);
+ } else
+ if (lws_server_socket_service_ssl(new_wsi, fd.sockfd)) {
+ lwsl_info("%s: fail ssl negotiation\n", __func__);
+ goto fail;
+ }
+
+ /*
+ * by deferring callback to this point, after insertion to fds,
+ * lws_callback_on_writable() can work from the callback
+ */
+ if ((new_wsi->protocol->callback)(
+ new_wsi, n, new_wsi->user_space, NULL, 0))
+ goto fail;
+
+ if (type & LWS_ADOPT_HTTP) {
+ if (!lws_header_table_attach(new_wsi, 0))
+ lwsl_debug("Attached ah immediately\n");
+ else
+ lwsl_info("%s: waiting for ah\n", __func__);
+ }
+
+ lws_cancel_service_pt(new_wsi);
+
+ return new_wsi;
+
+fail:
+ if (type & LWS_ADOPT_SOCKET)
+ lws_close_free_wsi(new_wsi, LWS_CLOSE_STATUS_NOSTATUS, "adopt skt fail");
+
+ return NULL;
+
+bail:
+ lwsl_notice("%s: exiting on bail\n", __func__);
+ if (parent)
+ parent->child_list = new_wsi->sibling_list;
+ if (new_wsi->user_space)
+ lws_free(new_wsi->user_space);
+ lws_free(new_wsi);
+ compatible_close(fd.sockfd);
+
+ return NULL;
+}
+
+LWS_VISIBLE struct lws *
+lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd)
+{
+ lws_sock_file_fd_type fd;
+
+ fd.sockfd = accept_fd;
+ return lws_adopt_descriptor_vhost(vh, LWS_ADOPT_SOCKET |
+ LWS_ADOPT_HTTP | LWS_ADOPT_ALLOW_SSL, fd, NULL, NULL);
+}
+
+LWS_VISIBLE struct lws *
+lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd)
+{
+ return lws_adopt_socket_vhost(context->vhost_list, accept_fd);
+}
+
+/* Common read-buffer adoption for lws_adopt_*_readbuf */
+static struct lws*
+adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
+{
+ struct lws_context_per_thread *pt;
+ struct lws_pollfd *pfd;
+ int n;
+
+ if (!wsi)
+ return NULL;
+
+ if (!readbuf || len == 0)
+ return wsi;
+
+ if (wsi->position_in_fds_table == LWS_NO_FDS_POS)
+ return wsi;
+
+ pt = &wsi->context->pt[(int)wsi->tsi];
+
+ n = lws_buflist_append_segment(&wsi->buflist, (const uint8_t *)readbuf, len);
+ if (n < 0)
+ goto bail;
+ if (n)
+ lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
+
+ /*
+ * we can't process the initial read data until we can attach an ah.
+ *
+ * if one is available, get it and place the data in his ah rxbuf...
+ * wsi with ah that have pending rxbuf get auto-POLLIN service.
+ *
+ * no autoservice because we didn't get a chance to attach the
+ * readbuf data to wsi or ah yet, and we will do it next if we get
+ * the ah.
+ */
+ if (wsi->http.ah || !lws_header_table_attach(wsi, 0)) {
+
+ lwsl_notice("%s: calling service on readbuf ah\n", __func__);
+
+ /* unlike a normal connect, we have the headers already
+ * (or the first part of them anyway).
+ * libuv won't come back and service us without a network
+ * event, so we need to do the header service right here.
+ */
+ pfd = &pt->fds[wsi->position_in_fds_table];
+ pfd->revents |= LWS_POLLIN;
+ lwsl_err("%s: calling service\n", __func__);
+ if (lws_service_fd_tsi(wsi->context, pfd, wsi->tsi))
+ /* service closed us */
+ return NULL;
+
+ return wsi;
+ }
+ lwsl_err("%s: deferring handling ah\n", __func__);
+
+ return wsi;
+
+bail:
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "adopt skt readbuf fail");
+
+ return NULL;
+}
+
+LWS_VISIBLE struct lws *
+lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
+ const char *readbuf, size_t len)
+{
+ return adopt_socket_readbuf(lws_adopt_socket(context, accept_fd),
+ readbuf, len);
+}
+
+LWS_VISIBLE struct lws *
+lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost,
+ lws_sockfd_type accept_fd,
+ const char *readbuf, size_t len)
+{
+ return adopt_socket_readbuf(lws_adopt_socket_vhost(vhost, accept_fd),
+ readbuf, len);
+}
LWS_VISIBLE int
lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
const char *other_headers, int other_headers_len)
{
+ static const char * const intermediates[] = { "private", "public" };
struct lws_context *context = lws_get_context(wsi);
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- unsigned char *response = pt->serv_buf + LWS_PRE;
#if defined(LWS_WITH_RANGES)
struct lws_range_parsing *rp = &wsi->http.range;
#endif
- int ret = 0, cclen = 8, n = HTTP_STATUS_OK;
char cache_control[50], *cc = "no-store";
- lws_fop_flags_t fflags = LWS_O_RDONLY;
- const struct lws_plat_file_ops *fops;
- lws_filepos_t total_content_length;
+ unsigned char *response = pt->serv_buf + LWS_PRE;
unsigned char *p = response;
unsigned char *end = p + context->pt_serv_buf_size - LWS_PRE;
- const char *vpath;
+ lws_filepos_t total_content_length;
+ int ret = 0, cclen = 8, n = HTTP_STATUS_OK;
+ lws_fop_flags_t fflags = LWS_O_RDONLY;
#if defined(LWS_WITH_RANGES)
int ranges;
#endif
+ const struct lws_plat_file_ops *fops;
+ const char *vpath;
if (wsi->handling_404)
n = HTTP_STATUS_NOT_FOUND;
@@ -2112,8 +2212,7 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
if (!wsi->http.fop_fd) {
lwsl_info("%s: Unable to open: '%s': errno %d\n",
__func__, file, errno);
- if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND,
- NULL))
+ if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL))
return -1;
return !wsi->http2_substream;
}
@@ -2134,14 +2233,14 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
*/
if (ranges < 0) {
/* it means he expressed a range in Range:, but it was illegal */
- lws_return_http_status(wsi,
- HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE, NULL);
+ lws_return_http_status(wsi, HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE,
+ NULL);
if (lws_http_transaction_completed(wsi))
return -1; /* <0 means just hang up */
lws_vfs_file_close(&wsi->http.fop_fd);
- return 0; /* == 0 means we did the transaction complete */
+ return 0; /* == 0 means we dealt with the transaction complete */
}
if (ranges)
n = HTTP_STATUS_PARTIAL_CONTENT;
@@ -2159,20 +2258,6 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
return -1;
lwsl_info("file is being provided in gzip\n");
}
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- else {
- /*
- * if we know its very compressible, and we can use
- * compression, then use the most preferred compression
- * method that the client said he will accept
- */
-
- if (!strncmp(content_type, "text/", 5) ||
- !strcmp(content_type, "application/javascript") ||
- !strcmp(content_type, "image/svg+xml"))
- lws_http_compression_apply(wsi, NULL, &p, end, 0);
- }
-#endif
if (
#if defined(LWS_WITH_RANGES)
@@ -2254,78 +2339,40 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
#endif
if (!wsi->http2_substream) {
- /* for http/1.1 ... */
- if (!wsi->sending_chunked
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- && !wsi->http.lcs
-#endif
- ) {
- /* ... if not already using chunked and not using an
- * http compression translation, then send the naive
- * content length
- */
+ if (!wsi->sending_chunked) {
if (lws_add_http_header_content_length(wsi,
- total_content_length, &p, end))
+ total_content_length,
+ &p, end))
return -1;
} else {
-
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.lcs) {
-
- /* ...otherwise, for http 1 it must go chunked.
- * For the compression case, the reason is we
- * compress on the fly and do not know the
- * compressed content-length until it has all
- * been sent. Http/1.1 pipelining must be able
- * to know where the transaction boundaries are
- * ... so chunking...
- */
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_TRANSFER_ENCODING,
- (unsigned char *)"chunked", 7,
- &p, end))
- return -1;
-
- /*
- * ...this is fun, isn't it :-) For h1 that is
- * using an http compression translation, the
- * compressor must chunk its output privately.
- *
- * h2 doesn't need (or support) any of this
- * crap.
- */
- lwsl_debug("setting chunking\n");
- wsi->http.comp_ctx.chunking = 1;
- }
-#endif
+ if (lws_add_http_header_by_token(wsi,
+ WSI_TOKEN_HTTP_TRANSFER_ENCODING,
+ (unsigned char *)"chunked",
+ 7, &p, end))
+ return -1;
}
}
if (wsi->cache_secs && wsi->cache_reuse) {
- if (!wsi->cache_revalidate) {
+ if (wsi->cache_revalidate) {
cc = cache_control;
- cclen = sprintf(cache_control, "%s, max-age=%u",
+ cclen = sprintf(cache_control, "%s max-age: %u",
intermediates[wsi->cache_intermediaries],
wsi->cache_secs);
} else {
- cc = cache_control;
- cclen = sprintf(cache_control,
- "must-revalidate, %s, max-age=%u",
- intermediates[wsi->cache_intermediaries],
- wsi->cache_secs);
-
+ cc = "no-cache";
+ cclen = 8;
}
}
- /* Only add cache control if its not specified by any other_headers. */
- if (!other_headers ||
- (!strstr(other_headers, "cache-control") &&
- !strstr(other_headers, "Cache-Control"))) {
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_CACHE_CONTROL,
- (unsigned char *)cc, cclen, &p, end))
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CACHE_CONTROL,
+ (unsigned char *)cc, cclen, &p, end))
+ return -1;
+
+ if (wsi->http.connection_type == HTTP_CONNECTION_KEEP_ALIVE)
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_CONNECTION,
+ (unsigned char *)"keep-alive", 10, &p, end))
return -1;
- }
if (other_headers) {
if ((end - p) < other_headers_len)
@@ -2368,37 +2415,16 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
do {
- /* priority 1: buffered output */
-
- if (lws_has_buffered_out(wsi)) {
- if (lws_issue_raw(wsi, NULL, 0) < 0) {
+ if (wsi->trunc_len) {
+ if (lws_issue_raw(wsi, wsi->trunc_alloc +
+ wsi->trunc_offset,
+ wsi->trunc_len) < 0) {
lwsl_info("%s: closing\n", __func__);
goto file_had_it;
}
break;
}
- /* priority 2: buffered pre-compression-transform */
-
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- if (wsi->http.comp_ctx.buflist_comp ||
- wsi->http.comp_ctx.may_have_more) {
- enum lws_write_protocol wp = LWS_WRITE_HTTP;
-
- lwsl_info("%s: completing comp partial (buflist %p, may %d)\n",
- __func__, wsi->http.comp_ctx.buflist_comp,
- wsi->http.comp_ctx.may_have_more);
-
- if (wsi->role_ops->write_role_protocol(wsi, NULL, 0, &wp) < 0) {
- lwsl_info("%s signalling to close\n", __func__);
- goto file_had_it;
- }
- lws_callback_on_writable(wsi);
-
- break;
- }
-#endif
-
if (wsi->http.filepos == wsi->http.filelen)
goto all_sent;
@@ -2427,8 +2453,7 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
LWS_H2_FRAME_HEADER_LENGTH,
"_lws\x0d\x0a"
"Content-Type: %s\x0d\x0a"
- "Content-Range: bytes "
- "%llu-%llu/%llu\x0d\x0a"
+ "Content-Range: bytes %llu-%llu/%llu\x0d\x0a"
"\x0d\x0a",
wsi->http.multipart_content_type,
wsi->http.range.start,
@@ -2443,8 +2468,7 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
}
#endif
- poss = context->pt_serv_buf_size - n -
- LWS_H2_FRAME_HEADER_LENGTH;
+ poss = context->pt_serv_buf_size - n - LWS_H2_FRAME_HEADER_LENGTH;
if (wsi->http.tx_content_length)
if (poss > wsi->http.tx_content_remain)
@@ -2532,9 +2556,11 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
lwsl_debug("added trailing boundary\n");
}
#endif
- m = lws_write(wsi, p, n, wsi->http.filepos + amount ==
- wsi->http.filelen ?
- LWS_WRITE_HTTP_FINAL : LWS_WRITE_HTTP);
+ m = lws_write(wsi, p, n,
+ wsi->http.filepos + amount == wsi->http.filelen ?
+ LWS_WRITE_HTTP_FINAL :
+ LWS_WRITE_HTTP
+ );
if (m < 0)
goto file_had_it;
@@ -2566,18 +2592,12 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
}
all_sent:
- if ((!lws_has_buffered_out(wsi)
-#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION)
- && !wsi->http.comp_ctx.buflist_comp &&
- !wsi->http.comp_ctx.may_have_more
-#endif
- ) && (wsi->http.filepos >= wsi->http.filelen
+ if ((!wsi->trunc_len && wsi->http.filepos >= wsi->http.filelen)
#if defined(LWS_WITH_RANGES)
|| finished)
#else
)
#endif
- )
{
lwsi_set_state(wsi, LRS_ESTABLISHED);
/* we might be in keepalive, so close it off here */
@@ -2587,8 +2607,9 @@ all_sent:
if (wsi->protocol->callback &&
user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION,
- wsi->user_space, NULL, 0) < 0) {
+ wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION,
+ wsi->user_space, NULL,
+ 0) < 0) {
/*
* For http/1.x, the choices from
* transaction_completed are either
@@ -2611,7 +2632,7 @@ all_sent:
return 1; /* >0 indicates completed */
}
- } while (1); //(!lws_send_pipe_choked(wsi));
+ } while (0); // while (!lws_send_pipe_choked(wsi))
lws_callback_on_writable(wsi);
@@ -2692,7 +2713,8 @@ skip:
n = (int)strlen(pc);
s->swallow[s->pos] = '\0';
if (n != s->pos) {
- memmove(s->start + n, s->start + s->pos,
+ memmove(s->start + n,
+ s->start + s->pos,
old_len - (sp - args->p));
old_len += (n - s->pos) + 1;
}
diff --git a/thirdparty/libwebsockets/lib/roles/listen/ops-listen.c b/thirdparty/libwebsockets/roles/listen/ops-listen.c
index 977c4b0377..dbeb9753a2 100644
--- a/thirdparty/libwebsockets/lib/roles/listen/ops-listen.c
+++ b/thirdparty/libwebsockets/roles/listen/ops-listen.c
@@ -32,11 +32,6 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
struct sockaddr_storage cli_addr;
socklen_t clilen;
- /* if our vhost is going down, ignore it */
-
- if (wsi->vhost->being_destroyed)
- return LWS_HPI_RET_HANDLED;
-
/* pollin means a client has connected to us then
*
* pollout is a hack on esp32 for background accepts signalling
@@ -79,8 +74,8 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
* block the connect queue for other legit peers.
*/
- accept_fd = accept((int)pollfd->fd,
- (struct sockaddr *)&cli_addr, &clilen);
+ accept_fd = accept((int)pollfd->fd,
+ (struct sockaddr *)&cli_addr, &clilen);
lws_latency(context, wsi, "listener accept",
(int)accept_fd, accept_fd != LWS_SOCK_INVALID);
if (accept_fd == LWS_SOCK_INVALID) {
@@ -88,11 +83,12 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
LWS_ERRNO == LWS_EWOULDBLOCK) {
break;
}
- lwsl_err("accept: %s\n", strerror(LWS_ERRNO));
- return LWS_HPI_RET_HANDLED;
+ lwsl_err("ERROR on accept: %s\n",
+ strerror(LWS_ERRNO));
+ break;
}
- lws_plat_set_socket_options(wsi->vhost, accept_fd, 0);
+ lws_plat_set_socket_options(wsi->vhost, accept_fd);
#if defined(LWS_WITH_IPV6)
lwsl_debug("accepted new conn port %u on fd=%d\n",
@@ -129,12 +125,9 @@ rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
fd.sockfd = accept_fd;
cwsi = lws_adopt_descriptor_vhost(wsi->vhost, opts, fd,
NULL, NULL);
- if (!cwsi) {
- lwsl_err("%s: lws_adopt_descriptor_vhost failed\n",
- __func__);
+ if (!cwsi)
/* already closed cleanly as necessary */
return LWS_HPI_RET_WSI_ALREADY_DIED;
- }
if (lws_server_socket_service_ssl(cwsi, accept_fd)) {
lws_close_free_wsi(cwsi, LWS_CLOSE_STATUS_NOSTATUS,
@@ -178,11 +171,7 @@ struct lws_role_ops role_ops_listen = {
/* close_role */ NULL,
/* close_kill_connection */ NULL,
/* destroy_role */ NULL,
- /* adoption_bind */ NULL,
- /* client_bind */ NULL,
/* writeable cb clnt, srv */ { 0, 0 },
/* close cb clnt, srv */ { 0, 0 },
- /* protocol_bind_cb c,s */ { 0, 0 },
- /* protocol_unbind_cb c,s */ { 0, 0 },
/* file_handle */ 0,
};
diff --git a/thirdparty/libwebsockets/lib/roles/pipe/ops-pipe.c b/thirdparty/libwebsockets/roles/pipe/ops-pipe.c
index 659c9bd935..b9348d58d7 100644
--- a/thirdparty/libwebsockets/lib/roles/pipe/ops-pipe.c
+++ b/thirdparty/libwebsockets/roles/pipe/ops-pipe.c
@@ -39,18 +39,6 @@ rops_handle_POLLIN_pipe(struct lws_context_per_thread *pt, struct lws *wsi,
if (n < 0)
return LWS_HPI_RET_PLEASE_CLOSE_ME;
#endif
-
-#if defined(LWS_WITH_THREADPOOL)
- /*
- * threadpools that need to call for on_writable callbacks do it by
- * marking the task as needing one for its wsi, then cancelling service.
- *
- * Each tsi will call this to perform the actual callback_on_writable
- * from the correct service thread context
- */
- lws_threadpool_tsi_context(pt->context, pt->tid);
-#endif
-
/*
* the poll() wait, or the event loop for libuv etc is a
* process-wide resource that we interrupted. So let every
@@ -87,11 +75,7 @@ struct lws_role_ops role_ops_pipe = {
/* close_role */ NULL,
/* close_kill_connection */ NULL,
/* destroy_role */ NULL,
- /* adoption_bind */ NULL,
- /* client_bind */ NULL,
/* writeable cb clnt, srv */ { 0, 0 },
/* close cb clnt, srv */ { 0, 0 },
- /* protocol_bind_cb c,s */ { 0, 0 },
- /* protocol_unbind_cb c,s */ { 0, 0 },
/* file_handle */ 1,
};
diff --git a/thirdparty/libwebsockets/lib/roles/private.h b/thirdparty/libwebsockets/roles/private.h
index 5f93b86e8f..ae4278b5d3 100644
--- a/thirdparty/libwebsockets/lib/roles/private.h
+++ b/thirdparty/libwebsockets/roles/private.h
@@ -148,11 +148,9 @@ enum lwsi_state {
};
#define lwsi_state(wsi) ((enum lwsi_state)(wsi->wsistate & LRS_MASK))
-#define lwsi_state_PRE_CLOSE(wsi) \
- ((enum lwsi_state)(wsi->wsistate_pre_close & LRS_MASK))
+#define lwsi_state_PRE_CLOSE(wsi) ((enum lwsi_state)(wsi->wsistate_pre_close & LRS_MASK))
#define lwsi_state_est(wsi) (!(wsi->wsistate & LWSIFS_NOT_EST))
-#define lwsi_state_est_PRE_CLOSE(wsi) \
- (!(wsi->wsistate_pre_close & LWSIFS_NOT_EST))
+#define lwsi_state_est_PRE_CLOSE(wsi) (!(wsi->wsistate_pre_close & LWSIFS_NOT_EST))
#define lwsi_state_can_handle_POLLOUT(wsi) (wsi->wsistate & LWSIFS_POCB)
#if !defined (_DEBUG)
#define lwsi_set_state(wsi, lrs) wsi->wsistate = \
@@ -161,8 +159,6 @@ enum lwsi_state {
void lwsi_set_state(struct lws *wsi, lws_wsi_state_t lrs);
#endif
-#define _LWS_ADOPT_FINISH (1 << 24)
-
/*
* internal role-specific ops
*/
@@ -221,16 +217,6 @@ struct lws_role_ops {
/* role-specific destructor */
int (*destroy_role)(struct lws *wsi);
- /* role-specific socket-adopt */
- int (*adoption_bind)(struct lws *wsi, int type, const char *prot);
- /* role-specific client-bind:
- * ret 1 = bound, 0 = not bound, -1 = fail out
- * i may be NULL, indicating client_bind is being called after
- * a successful bind earlier, to finalize the binding. In that
- * case ret 0 = OK, 1 = fail, wsi needs freeing, -1 = fail, wsi freed */
- int (*client_bind)(struct lws *wsi,
- const struct lws_client_connect_info *i);
-
/*
* the callback reasons for WRITEABLE for client, server
* (just client applies if no concept of client or server)
@@ -241,16 +227,6 @@ struct lws_role_ops {
* (just client applies if no concept of client or server)
*/
uint16_t close_cb[2];
- /*
- * the callback reasons for protocol bind for client, server
- * (just client applies if no concept of client or server)
- */
- uint16_t protocol_bind_cb[2];
- /*
- * the callback reasons for protocol unbind for client, server
- * (just client applies if no concept of client or server)
- */
- uint16_t protocol_unbind_cb[2];
unsigned int file_handle:1; /* role operates on files not sockets */
};
@@ -291,12 +267,6 @@ extern struct lws_role_ops role_ops_raw_skt, role_ops_raw_file, role_ops_listen,
#define lwsi_role_cgi(wsi) (0)
#endif
-#if defined(LWS_ROLE_DBUS)
- #include "roles/dbus/private.h"
-#else
- #define lwsi_role_dbus(wsi) (0)
-#endif
-
enum {
LWS_HP_RET_BAIL_OK,
LWS_HP_RET_BAIL_DIE,
@@ -310,6 +280,3 @@ enum {
LWS_UPG_RET_CONTINUE,
LWS_UPG_RET_BAIL
};
-
-int
-lws_role_call_adoption_bind(struct lws *wsi, int type, const char *prot);
diff --git a/thirdparty/libwebsockets/lib/roles/raw-skt/ops-raw-skt.c b/thirdparty/libwebsockets/roles/raw/ops-raw.c
index 8b94de4bed..68b52bded6 100644
--- a/thirdparty/libwebsockets/lib/roles/raw-skt/ops-raw-skt.c
+++ b/thirdparty/libwebsockets/roles/raw/ops-raw.c
@@ -30,12 +30,12 @@ rops_handle_POLLIN_raw_skt(struct lws_context_per_thread *pt, struct lws *wsi,
/* pending truncated sends have uber priority */
- if (lws_has_buffered_out(wsi)) {
+ if (wsi->trunc_len) {
if (!(pollfd->revents & LWS_POLLOUT))
return LWS_HPI_RET_HANDLED;
- /* drain the output buflist */
- if (lws_issue_raw(wsi, NULL, 0) < 0)
+ if (lws_issue_raw(wsi, wsi->trunc_alloc + wsi->trunc_offset,
+ wsi->trunc_len) < 0)
goto fail;
/*
* we can't afford to allow input processing to send
@@ -109,7 +109,7 @@ try_pollout:
LWSSTATS_C_WRITEABLE_CB, 1);
#if defined(LWS_WITH_STATS)
if (wsi->active_writable_req_us) {
- uint64_t ul = lws_time_in_microseconds() -
+ uint64_t ul = time_in_microseconds() -
wsi->active_writable_req_us;
lws_stats_atomic_bump(wsi->context, pt,
@@ -135,62 +135,38 @@ fail:
return LWS_HPI_RET_WSI_ALREADY_DIED;
}
-#if !defined(LWS_NO_SERVER)
-static int
-rops_adoption_bind_raw_skt(struct lws *wsi, int type, const char *vh_prot_name)
-{
- /* no http but socket... must be raw skt */
- if ((type & LWS_ADOPT_HTTP) || !(type & LWS_ADOPT_SOCKET) ||
- (type & _LWS_ADOPT_FINISH))
- return 0; /* no match */
-
-#if !defined(LWS_WITH_ESP32)
- if (type & LWS_ADOPT_FLAG_UDP)
- /*
- * these can be >128 bytes, so just alloc for UDP
- */
- wsi->udp = lws_malloc(sizeof(*wsi->udp), "udp struct");
-#endif
- lws_role_transition(wsi, 0, (type & LWS_ADOPT_ALLOW_SSL) ? LRS_SSL_INIT :
- LRS_ESTABLISHED, &role_ops_raw_skt);
-
- if (vh_prot_name)
- lws_bind_protocol(wsi, wsi->protocol, __func__);
- else
- /* this is the only time he will transition */
- lws_bind_protocol(wsi,
- &wsi->vhost->protocols[wsi->vhost->raw_protocol_index],
- __func__);
-
- return 1; /* bound */
-}
-#endif
-
-#if !defined(LWS_NO_CLIENT)
static int
-rops_client_bind_raw_skt(struct lws *wsi,
- const struct lws_client_connect_info *i)
+rops_handle_POLLIN_raw_file(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
{
- if (!i) {
-
- /* finalize */
+ int n;
- if (!wsi->user_space && wsi->stash->method)
- if (lws_ensure_user_space(wsi))
- return 1;
-
- return 0;
+ if (pollfd->revents & LWS_POLLOUT) {
+ n = lws_callback_as_writeable(wsi);
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_info("failed at set pollfd\n");
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+ }
+ if (n)
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
}
- /* we are a fallback if nothing else matched */
+ if (pollfd->revents & LWS_POLLIN) {
+ if (user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_RAW_RX_FILE,
+ wsi->user_space, NULL, 0)) {
+ lwsl_debug("raw rx callback closed it\n");
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+ }
- lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
- &role_ops_raw_skt);
+ if (pollfd->revents & LWS_POLLHUP)
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
- return 1; /* matched */
+ return LWS_HPI_RET_HANDLED;
}
-#endif
+
struct lws_role_ops role_ops_raw_skt = {
/* role name */ "raw-skt",
@@ -213,21 +189,35 @@ struct lws_role_ops role_ops_raw_skt = {
/* close_role */ NULL,
/* close_kill_connection */ NULL,
/* destroy_role */ NULL,
-#if !defined(LWS_NO_SERVER)
- /* adoption_bind */ rops_adoption_bind_raw_skt,
-#else
- NULL,
-#endif
-#if !defined(LWS_NO_CLIENT)
- /* client_bind */ rops_client_bind_raw_skt,
-#else
- NULL,
-#endif
/* writeable cb clnt, srv */ { LWS_CALLBACK_RAW_WRITEABLE, 0 },
/* close cb clnt, srv */ { LWS_CALLBACK_RAW_CLOSE, 0 },
- /* protocol_bind cb c, srv */ { LWS_CALLBACK_RAW_SKT_BIND_PROTOCOL,
- LWS_CALLBACK_RAW_SKT_BIND_PROTOCOL },
- /* protocol_unbind cb c, srv */ { LWS_CALLBACK_RAW_SKT_DROP_PROTOCOL,
- LWS_CALLBACK_RAW_SKT_DROP_PROTOCOL },
/* file_handle */ 0,
};
+
+
+
+struct lws_role_ops role_ops_raw_file = {
+ /* role name */ "raw-file",
+ /* alpn id */ NULL,
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ NULL,
+ /* destroy_vhost */ NULL,
+ /* periodic_checks */ NULL,
+ /* service_flag_pending */ NULL,
+ /* handle_POLLIN */ rops_handle_POLLIN_raw_file,
+ /* handle_POLLOUT */ NULL,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ NULL,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ NULL,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ NULL,
+ /* close_via_role_protocol */ NULL,
+ /* close_role */ NULL,
+ /* close_kill_connection */ NULL,
+ /* destroy_role */ NULL,
+ /* writeable cb clnt, srv */ { LWS_CALLBACK_RAW_WRITEABLE_FILE, 0 },
+ /* close cb clnt, srv */ { LWS_CALLBACK_RAW_CLOSE_FILE, 0 },
+ /* file_handle */ 1,
+};
diff --git a/thirdparty/libwebsockets/lib/roles/ws/client-parser-ws.c b/thirdparty/libwebsockets/roles/ws/client-parser-ws.c
index f5aaa6dbb5..7287fb1590 100644
--- a/thirdparty/libwebsockets/lib/roles/ws/client-parser-ws.c
+++ b/thirdparty/libwebsockets/roles/ws/client-parser-ws.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -399,11 +399,9 @@ spill:
memcpy(wsi->ws->ping_payload_buf + LWS_PRE, pp,
wsi->ws->rx_ubuf_head);
- wsi->ws->close_in_ping_buffer_len =
- wsi->ws->rx_ubuf_head;
+ wsi->ws->close_in_ping_buffer_len = wsi->ws->rx_ubuf_head;
- lwsl_info("%s: scheduling return close as ack\n",
- __func__);
+ lwsl_info("%s: scheduling return close as ack\n", __func__);
__lws_change_pollfd(wsi, LWS_POLLIN, 0);
lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_SEND, 3);
wsi->waiting_to_send_close_frame = 1;
@@ -439,7 +437,7 @@ spill:
/* stash the pong payload */
memcpy(wsi->ws->ping_payload_buf + LWS_PRE,
&wsi->ws->rx_ubuf[LWS_PRE],
- wsi->ws->rx_ubuf_head);
+ wsi->ws->rx_ubuf_head);
wsi->ws->ping_payload_len = wsi->ws->rx_ubuf_head;
wsi->ws->ping_pending_flag = 1;
diff --git a/thirdparty/libwebsockets/lib/roles/ws/client-ws.c b/thirdparty/libwebsockets/roles/ws/client-ws.c
index d88833f381..fd6cf42551 100644
--- a/thirdparty/libwebsockets/lib/roles/ws/client-ws.c
+++ b/thirdparty/libwebsockets/roles/ws/client-ws.c
@@ -40,8 +40,7 @@ strtolower(char *s)
}
int
-lws_create_client_ws_object(const struct lws_client_connect_info *i,
- struct lws *wsi)
+lws_create_client_ws_object(struct lws_client_connect_info *i, struct lws *wsi)
{
int v = SPEC_LATEST_SUPPORTED;
@@ -114,7 +113,7 @@ lws_ws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
#endif
char *
-lws_generate_client_ws_handshake(struct lws *wsi, char *p, const char *conn1)
+lws_generate_client_ws_handshake(struct lws *wsi, char *p)
{
char buf[128], hash[20], key_b64[40];
int n;
@@ -136,8 +135,8 @@ lws_generate_client_ws_handshake(struct lws *wsi, char *p, const char *conn1)
lws_b64_encode_string(hash, 16, key_b64, sizeof(key_b64));
p += sprintf(p, "Upgrade: websocket\x0d\x0a"
- "Connection: %sUpgrade\x0d\x0a"
- "Sec-WebSocket-Key: ", conn1);
+ "Connection: Upgrade\x0d\x0a"
+ "Sec-WebSocket-Key: ");
strcpy(p, key_b64);
p += strlen(key_b64);
p += sprintf(p, "\x0d\x0a");
@@ -204,12 +203,10 @@ lws_generate_client_ws_handshake(struct lws *wsi, char *p, const char *conn1)
int
lws_client_ws_upgrade(struct lws *wsi, const char **cce)
{
- struct lws_context *context = wsi->context;
- struct lws_tokenize ts;
int n, len, okay = 0;
- lws_tokenize_elem e;
- char *p, buf[64];
+ struct lws_context *context = wsi->context;
const char *pc;
+ char *p;
#if !defined(LWS_WITHOUT_EXTENSIONS)
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
char *sb = (char *)&pt->serv_buf[0];
@@ -217,8 +214,8 @@ lws_client_ws_upgrade(struct lws *wsi, const char **cce)
const struct lws_extension *ext;
char ext_name[128];
const char *c, *a;
- int more = 1;
char ignore;
+ int more = 1;
#endif
if (wsi->client_h2_substream) {/* !!! client ws-over-h2 not there yet */
@@ -264,31 +261,18 @@ lws_client_ws_upgrade(struct lws *wsi, const char **cce)
goto bail3;
}
- /* connection: must have "upgrade" */
-
- lws_tokenize_init(&ts, buf, LWS_TOKENIZE_F_COMMA_SEP_LIST |
- LWS_TOKENIZE_F_MINUS_NONTERM);
- ts.len = lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_CONNECTION);
- if (ts.len <= 0) /* won't fit, or absent */
- goto bad_conn_format;
-
- do {
- e = lws_tokenize(&ts);
- switch (e) {
- case LWS_TOKZE_TOKEN:
- if (!strcasecmp(ts.token, "upgrade"))
- e = LWS_TOKZE_ENDED;
- break;
-
- case LWS_TOKZE_DELIMITER:
- break;
-
- default: /* includes ENDED */
-bad_conn_format:
- *cce = "HS: UPGRADE malformed";
- goto bail3;
- }
- } while (e > 0);
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_CONNECTION);
+ if (!p) {
+ lwsl_info("no Connection hdr\n");
+ *cce = "HS: CONNECTION missing";
+ goto bail3;
+ }
+ strtolower(p);
+ if (strcmp(p, "upgrade")) {
+ lwsl_warn("lws_client_int_s_hs: bad header %s\n", p);
+ *cce = "HS: UPGRADE malformed";
+ goto bail3;
+ }
pc = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
if (!pc) {
@@ -324,7 +308,7 @@ bad_conn_format:
}
while (*pc && *pc++ != ',')
;
- while (*pc == ' ')
+ while (*pc && *pc == ' ')
pc++;
}
@@ -392,7 +376,22 @@ check_extensions:
* X <-> pAn <-> pB
*/
- lws_same_vh_protocol_insert(wsi, n);
+ lws_vhost_lock(wsi->vhost);
+
+ wsi->same_vh_protocol_prev = /* guy who points to us */
+ &wsi->vhost->same_vh_protocol_list[n];
+ wsi->same_vh_protocol_next = /* old first guy is our next */
+ wsi->vhost->same_vh_protocol_list[n];
+ /* we become the new first guy */
+ wsi->vhost->same_vh_protocol_list[n] = wsi;
+
+ if (wsi->same_vh_protocol_next)
+ /* old first guy points back to us now */
+ wsi->same_vh_protocol_next->same_vh_protocol_prev =
+ &wsi->same_vh_protocol_next;
+ wsi->on_same_vh_list = 1;
+
+ lws_vhost_unlock(wsi->vhost);
#if !defined(LWS_WITHOUT_EXTENSIONS)
/* instantiate the accepted extensions */
@@ -469,8 +468,7 @@ check_extensions:
if (ext->callback(lws_get_context(wsi), ext, wsi,
LWS_EXT_CB_CLIENT_CONSTRUCT,
- (void *)&wsi->ws->act_ext_user[
- wsi->ws->count_act_ext],
+ (void *)&wsi->ws->act_ext_user[wsi->ws->count_act_ext],
(void *)&opts, 0)) {
lwsl_info(" ext %s failed construction\n",
ext_name);
@@ -492,10 +490,8 @@ check_extensions:
}
if (ext_name[0] &&
- lws_ext_parse_options(ext, wsi,
- wsi->ws->act_ext_user[
- wsi->ws->count_act_ext],
- opts, ext_name,
+ lws_ext_parse_options(ext, wsi, wsi->ws->act_ext_user[
+ wsi->ws->count_act_ext], opts, ext_name,
(int)strlen(ext_name))) {
lwsl_err("%s: unable to parse user defaults '%s'",
__func__, ext_name);
@@ -507,8 +503,7 @@ check_extensions:
* give the extension the server options
*/
if (a && lws_ext_parse_options(ext, wsi,
- wsi->ws->act_ext_user[
- wsi->ws->count_act_ext],
+ wsi->ws->act_ext_user[wsi->ws->count_act_ext],
opts, a, lws_ptr_diff(c, a))) {
lwsl_err("%s: unable to parse remote def '%s'",
__func__, a);
diff --git a/thirdparty/libwebsockets/lib/roles/ws/ops-ws.c b/thirdparty/libwebsockets/roles/ws/ops-ws.c
index 1cbc6ac6a6..665b2c9b74 100644
--- a/thirdparty/libwebsockets/lib/roles/ws/ops-ws.c
+++ b/thirdparty/libwebsockets/roles/ws/ops-ws.c
@@ -155,9 +155,7 @@ handle_first:
if (wsi->ws->opcode == LWSWSOPC_BINARY_FRAME)
wsi->ws->check_utf8 = 0;
if (wsi->ws->continuation_possible) {
- lws_close_reason(wsi,
- LWS_CLOSE_STATUS_PROTOCOL_ERR,
- (uint8_t *)"bad cont", 8);
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad cont", 8);
return -1;
}
wsi->ws->rsv_first_msg = (c & 0x70);
@@ -168,9 +166,7 @@ handle_first:
break;
case LWSWSOPC_CONTINUATION:
if (!wsi->ws->continuation_possible) {
- lws_close_reason(wsi,
- LWS_CLOSE_STATUS_PROTOCOL_ERR,
- (uint8_t *)"bad cont", 8);
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad cont", 8);
return -1;
}
break;
@@ -188,8 +184,7 @@ handle_first:
case 0xd:
case 0xe:
case 0xf:
- lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR,
- (uint8_t *)"bad opc", 7);
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad opc", 7);
lwsl_info("illegal opcode\n");
return -1;
}
@@ -198,8 +193,7 @@ handle_first:
(wsi->ws->opcode == LWSWSOPC_TEXT_FRAME ||
wsi->ws->opcode == LWSWSOPC_BINARY_FRAME)) {
lwsl_info("hey you owed us a FIN\n");
- lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR,
- (uint8_t *)"bad fin", 7);
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad fin", 7);
return -1;
}
if ((!(wsi->ws->opcode & 8)) && wsi->ws->final) {
@@ -379,19 +373,17 @@ handle_first:
}
if (!(already_processed & ALREADY_PROCESSED_IGNORE_CHAR)) {
if (wsi->ws->all_zero_nonce)
- wsi->ws->rx_ubuf[LWS_PRE +
- (wsi->ws->rx_ubuf_head++)] = c;
+ wsi->ws->rx_ubuf[LWS_PRE + (wsi->ws->rx_ubuf_head++)] =
+ c;
else
- wsi->ws->rx_ubuf[LWS_PRE +
- (wsi->ws->rx_ubuf_head++)] =
+ wsi->ws->rx_ubuf[LWS_PRE + (wsi->ws->rx_ubuf_head++)] =
c ^ wsi->ws->mask[(wsi->ws->mask_idx++) & 3];
--wsi->ws->rx_packet_length;
}
if (!wsi->ws->rx_packet_length) {
- lwsl_debug("%s: ws fragment length exhausted\n",
- __func__);
+ lwsl_debug("%s: ws fragment length exhausted\n", __func__);
/* spill because we have the whole frame */
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
@@ -459,8 +451,7 @@ spill:
* have to just close our end.
*/
wsi->socket_is_permanently_unusable = 1;
- lwsl_parser("Closing on peer close "
- "due to pending tx\n");
+ lwsl_parser("Closing on peer close due to Pending tx\n");
return -1;
}
@@ -579,8 +570,7 @@ drain_extension:
//if (lin)
// lwsl_hexdump_notice(ebuf.token, ebuf.len);
n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &ebuf, 0);
- lwsl_debug("%s: ext says %d / ebuf.len %d\n", __func__,
- n, ebuf.len);
+ lwsl_debug("%s: ext says %d / ebuf.len %d\n", __func__, n, ebuf.len);
if (wsi->ws->rx_draining_ext)
already_processed &= ~ALREADY_PROCESSED_NO_CB;
#endif
@@ -791,7 +781,8 @@ lws_server_init_wsi_for_ws(struct lws *wsi)
lwsl_debug("Allocating RX buffer %d\n", n);
#if !defined(LWS_WITH_ESP32)
- if (!wsi->h2_stream_carries_ws)
+ if (!wsi->parent_carries_io &&
+ !wsi->h2_stream_carries_ws)
if (setsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_SNDBUF,
(const char *)&n, sizeof n)) {
lwsl_warn("Failed to set SNDBUF to %d", n);
@@ -823,9 +814,9 @@ LWS_VISIBLE int
lws_is_final_fragment(struct lws *wsi)
{
#if !defined(LWS_WITHOUT_EXTENSIONS)
- lwsl_debug("%s: final %d, rx pk length %ld, draining %ld\n", __func__,
- wsi->ws->final, (long)wsi->ws->rx_packet_length,
- (long)wsi->ws->rx_draining_ext);
+ lwsl_debug("%s: final %d, rx pk length %ld, draining %ld\n", __func__,
+ wsi->ws->final, (long)wsi->ws->rx_packet_length,
+ (long)wsi->ws->rx_draining_ext);
return wsi->ws->final && !wsi->ws->rx_packet_length &&
!wsi->ws->rx_draining_ext;
#else
@@ -892,8 +883,8 @@ static int
rops_handle_POLLIN_ws(struct lws_context_per_thread *pt, struct lws *wsi,
struct lws_pollfd *pollfd)
{
- unsigned int pending = 0;
struct lws_tokens ebuf;
+ unsigned int pending = 0;
char buffered = 0;
int n = 0, m;
#if defined(LWS_WITH_HTTP2)
@@ -937,9 +928,7 @@ rops_handle_POLLIN_ws(struct lws_context_per_thread *pt, struct lws *wsi,
return LWS_HPI_RET_HANDLED;
}
- //lwsl_notice("%s: wsi->ws->tx_draining_ext %d revents 0x%x 0x%x %d\n",
- //__func__, wsi->ws->tx_draining_ext, pollfd->revents, wsi->wsistate,
- //lwsi_state_can_handle_POLLOUT(wsi));
+ //lwsl_notice("%s: wsi->ws->tx_draining_ext %d revents 0x%x 0x%x %d\n", __func__, wsi->ws->tx_draining_ext, pollfd->revents, wsi->wsistate, lwsi_state_can_handle_POLLOUT(wsi));
/* 1: something requested a callback when it was OK to write */
@@ -988,7 +977,7 @@ rops_handle_POLLIN_ws(struct lws_context_per_thread *pt, struct lws *wsi,
#if defined(LWS_WITH_HTTP2)
if (wsi->http2_substream || wsi->upgraded_to_http2) {
wsi1 = lws_get_network_wsi(wsi);
- if (wsi1 && lws_has_buffered_out(wsi1))
+ if (wsi1 && wsi1->trunc_len)
/* We cannot deal with any kind of new RX
* because we are dealing with a partial send
* (new RX may trigger new http_action() that
@@ -1211,9 +1200,8 @@ int rops_handle_POLLOUT_ws(struct lws *wsi)
if (n >= 0) {
if (wsi->close_needs_ack) {
lwsi_set_state(wsi, LRS_AWAITING_CLOSE_ACK);
- lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_ACK,
- 5);
- lwsl_debug("sent close, await ack\n");
+ lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_ACK, 5);
+ lwsl_debug("sent close indication, awaiting ack\n");
return LWS_HP_RET_BAIL_OK;
}
@@ -1238,8 +1226,7 @@ int rops_handle_POLLOUT_ws(struct lws *wsi)
wsi->ws->ping_pending_flag = 0;
return LWS_HP_RET_BAIL_OK;
}
- lwsl_info("issuing pong %d on wsi %p\n",
- wsi->ws->ping_payload_len, wsi);
+ lwsl_info("issuing pong %d on wsi %p\n", wsi->ws->ping_payload_len, wsi);
}
n = lws_write(wsi, &wsi->ws->ping_payload_buf[LWS_PRE],
@@ -1415,12 +1402,9 @@ rops_periodic_checks_ws(struct lws_context *context, int tsi, time_t now)
lws_vhost_lock(vh);
for (n = 0; n < vh->count_protocols; n++) {
+ struct lws *wsi = vh->same_vh_protocol_list[n];
- lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
- vh->same_vh_protocol_heads[n].next) {
- struct lws *wsi = lws_container_of(d,
- struct lws, same_vh_protocol);
-
+ while (wsi) {
if (lwsi_role_ws(wsi) &&
!wsi->socket_is_permanently_unusable &&
!wsi->ws->send_check_ping &&
@@ -1437,8 +1421,8 @@ rops_periodic_checks_ws(struct lws_context *context, int tsi, time_t now)
lws_callback_on_writable(wsi);
wsi->ws->time_next_ping_check = now;
}
-
- } lws_end_foreach_dll_safe(d, d1);
+ wsi = wsi->same_vh_protocol_next;
+ }
}
lws_vhost_unlock(vh);
@@ -1512,11 +1496,7 @@ rops_close_via_role_protocol_ws(struct lws *wsi, enum lws_close_status reason)
static int
rops_close_role_ws(struct lws_context_per_thread *pt, struct lws *wsi)
{
- if (!wsi->ws)
- return 0;
-
#if !defined(LWS_WITHOUT_EXTENSIONS)
-
if (wsi->ws->rx_draining_ext) {
struct lws **w = &pt->ws.rx_draining_ext_list;
@@ -1549,6 +1529,10 @@ rops_close_role_ws(struct lws_context_per_thread *pt, struct lws *wsi)
#endif
lws_free_set_NULL(wsi->ws->rx_ubuf);
+ if (wsi->trunc_alloc)
+ /* not going to be completed... nuke it */
+ lws_free_set_NULL(wsi->trunc_alloc);
+
wsi->ws->ping_payload_len = 0;
wsi->ws->ping_pending_flag = 0;
@@ -1606,9 +1590,8 @@ rops_write_role_protocol_ws(struct lws *wsi, unsigned char *buf, size_t len,
if (!(wpt & LWS_WRITE_NO_FIN) && len)
*wp &= ~LWS_WRITE_NO_FIN;
- lwsl_ext("FORCED draining wp to 0x%02X "
- "(stashed 0x%02X, incoming 0x%02X)\n", *wp,
- wsi->ws->tx_draining_stashed_wp, wpt);
+ lwsl_ext("FORCED draining wp to 0x%02X (stashed 0x%02X, incoming 0x%02X)\n", *wp,
+ wsi->ws->tx_draining_stashed_wp, wpt);
// assert(0);
}
#endif
@@ -1660,16 +1643,13 @@ rops_write_role_protocol_ws(struct lws *wsi, unsigned char *buf, size_t len,
n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_TX, &ebuf, *wp);
if (n < 0)
return -1;
- // lwsl_notice("ext processed %d plaintext into %d compressed"
- // " (wp 0x%x)\n", m, (int)ebuf.len, *wp);
+ // lwsl_notice("ext processed %d plaintext into %d compressed (wp 0x%x)\n", m, (int)ebuf.len, *wp);
if (n && ebuf.len) {
- lwsl_ext("write drain len %d (wp 0x%x) SETTING "
- "tx_draining_ext\n", (int)ebuf.len, *wp);
+ lwsl_ext("write drain len %d (wp 0x%x) SETTING tx_draining_ext\n", (int)ebuf.len, *wp);
/* extension requires further draining */
wsi->ws->tx_draining_ext = 1;
- wsi->ws->tx_draining_ext_list =
- pt->ws.tx_draining_ext_list;
+ wsi->ws->tx_draining_ext_list = pt->ws.tx_draining_ext_list;
pt->ws.tx_draining_ext_list = wsi;
/* we must come back to do more */
lws_callback_on_writable(wsi);
@@ -1706,8 +1686,7 @@ rops_write_role_protocol_ws(struct lws *wsi, unsigned char *buf, size_t len,
*/
if (len && !ebuf.len) {
if (!wsi->ws->stashed_write_pending)
- wsi->ws->stashed_write_type =
- (char)(*wp) & 0x3f;
+ wsi->ws->stashed_write_type = (char)(*wp) & 0x3f;
wsi->ws->stashed_write_pending = 1;
return (int)len;
}
@@ -1829,7 +1808,7 @@ do_more_inside_frame:
assert(encap != wsi);
return encap->role_ops->write_role_protocol(wsi, buf - pre,
- len + pre, wp);
+ len + pre, wp);
}
switch ((*wp) & 0x1f) {
@@ -2007,15 +1986,9 @@ struct lws_role_ops role_ops_ws = {
/* close_role */ rops_close_role_ws,
/* close_kill_connection */ rops_close_kill_connection_ws,
/* destroy_role */ rops_destroy_role_ws,
- /* adoption_bind */ NULL,
- /* client_bind */ NULL,
/* writeable cb clnt, srv */ { LWS_CALLBACK_CLIENT_WRITEABLE,
LWS_CALLBACK_SERVER_WRITEABLE },
/* close cb clnt, srv */ { LWS_CALLBACK_CLIENT_CLOSED,
LWS_CALLBACK_CLOSED },
- /* protocol_bind cb c, srv */ { LWS_CALLBACK_WS_CLIENT_BIND_PROTOCOL,
- LWS_CALLBACK_WS_SERVER_BIND_PROTOCOL },
- /* protocol_unbind cb c, srv */ { LWS_CALLBACK_WS_CLIENT_DROP_PROTOCOL,
- LWS_CALLBACK_WS_SERVER_DROP_PROTOCOL },
/* file handles */ 0
};
diff --git a/thirdparty/libwebsockets/lib/roles/ws/private.h b/thirdparty/libwebsockets/roles/ws/private.h
index 71ffcaea96..71ffcaea96 100644
--- a/thirdparty/libwebsockets/lib/roles/ws/private.h
+++ b/thirdparty/libwebsockets/roles/ws/private.h
diff --git a/thirdparty/libwebsockets/lib/roles/ws/server-ws.c b/thirdparty/libwebsockets/roles/ws/server-ws.c
index bdc45367d4..62bcd8524f 100644
--- a/thirdparty/libwebsockets/lib/roles/ws/server-ws.c
+++ b/thirdparty/libwebsockets/roles/ws/server-ws.c
@@ -104,7 +104,7 @@ lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
continue;
}
- while (args && *args == ' ')
+ while (args && *args && *args == ' ')
args++;
/* check a client's extension against our support */
@@ -124,7 +124,7 @@ lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
*/
for (m = 0; m < wsi->ws->count_act_ext; m++)
if (wsi->ws->active_extensions[m] == ext) {
- lwsl_info("ext mentioned twice\n");
+ lwsl_info("extension mentioned twice\n");
return 1; /* shenanigans */
}
@@ -209,17 +209,16 @@ lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
oa.len = 0;
lwsl_info("setting '%s'\n", po->name);
if (!ext->callback(lws_get_context(wsi),
- ext, wsi,
- LWS_EXT_CB_OPTION_SET,
- wsi->ws->act_ext_user[
- wsi->ws->count_act_ext],
+ ext, wsi,
+ LWS_EXT_CB_OPTION_SET,
+ wsi->ws->act_ext_user[
+ wsi->ws->count_act_ext],
&oa, (end - *p))) {
- *p += lws_snprintf(*p,
- (end - *p),
- "; %s", po->name);
+ *p += lws_snprintf(*p, (end - *p),
+ "; %s", po->name);
lwsl_debug("adding option %s\n",
- po->name);
+ po->name);
}
po++;
}
@@ -231,8 +230,7 @@ lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
}
wsi->ws->count_act_ext++;
- lwsl_parser("cnt_act_ext <- %d\n",
- wsi->ws->count_act_ext);
+ lwsl_parser("cnt_act_ext <- %d\n", wsi->ws->count_act_ext);
if (args && *args == ',')
more = 0;
@@ -248,149 +246,96 @@ lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
}
#endif
+
+
int
lws_process_ws_upgrade(struct lws *wsi)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- const struct lws_protocols *pcol = NULL;
- char buf[128], name[64];
- struct lws_tokenize ts;
- lws_tokenize_elem e;
+ char protocol_list[128], protocol_name[64], *p;
+ int protocol_len, hit, n = 0, non_space_char_found = 0;
if (!wsi->protocol)
lwsl_err("NULL protocol at lws_read\n");
/*
- * We are upgrading to ws, so http/1.1 + h2 and keepalive + pipelined
- * header considerations about keeping the ah around no longer apply.
- *
- * However it's common for the first ws protocol data to have been
- * coalesced with the browser upgrade request and to already be in the
- * ah rx buffer.
- */
-
- lws_pt_lock(pt, __func__);
-
- if (!wsi->h2_stream_carries_ws)
- lws_role_transition(wsi, LWSIFR_SERVER, LRS_ESTABLISHED,
- &role_ops_ws);
-
- lws_pt_unlock(pt);
-
- /*
* It's either websocket or h2->websocket
*
- * If we are on h1, confirm we got the required "connection: upgrade"
- * header. h2 / ws-over-h2 does not have this.
- */
-
-#if defined(LWS_WITH_HTTP2)
- if (wsi->http2_substream)
- goto check_protocol;
-#endif
-
- lws_tokenize_init(&ts, buf, LWS_TOKENIZE_F_COMMA_SEP_LIST |
- LWS_TOKENIZE_F_MINUS_NONTERM);
- ts.len = lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_CONNECTION);
- if (ts.len <= 0)
- goto bad_conn_format;
-
- do {
- e = lws_tokenize(&ts);
- switch (e) {
- case LWS_TOKZE_TOKEN:
- if (!strcasecmp(ts.token, "upgrade"))
- e = LWS_TOKZE_ENDED;
- break;
-
- case LWS_TOKZE_DELIMITER:
- break;
-
- default: /* includes ENDED */
-bad_conn_format:
- lwsl_err("%s: malformed or absent connection hdr\n",
- __func__);
-
- return 1;
- }
- } while (e > 0);
-
-#if defined(LWS_WITH_HTTP2)
-check_protocol:
-#endif
-
- /*
* Select the first protocol we support from the list
* the client sent us.
+ *
+ * Copy it to remove header fragmentation
*/
- lws_tokenize_init(&ts, buf, LWS_TOKENIZE_F_COMMA_SEP_LIST |
- LWS_TOKENIZE_F_MINUS_NONTERM |
- LWS_TOKENIZE_F_RFC7230_DELIMS);
- ts.len = lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_PROTOCOL);
- if (ts.len < 0) {
- lwsl_err("%s: protocol list too long\n", __func__);
+ if (lws_hdr_copy(wsi, protocol_list, sizeof(protocol_list) - 1,
+ WSI_TOKEN_PROTOCOL) < 0) {
+ lwsl_err("protocol list too long");
return 1;
}
- if (!ts.len) {
- int n = wsi->vhost->default_protocol_index;
- /*
- * some clients only have one protocol and do not send the
- * protocol list header... allow it and match to the vhost's
- * default protocol (which itself defaults to zero)
- */
- lwsl_info("%s: defaulting to prot handler %d\n", __func__, n);
-
- lws_bind_protocol(wsi, &wsi->vhost->protocols[n],
- "ws upgrade default pcol");
-
- goto alloc_ws;
- }
-
- /* otherwise go through the user-provided protocol list */
- do {
- e = lws_tokenize(&ts);
- switch (e) {
- case LWS_TOKZE_TOKEN:
+ protocol_len = lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL);
+ protocol_list[protocol_len] = '\0';
+ p = protocol_list;
+ hit = 0;
- if (lws_tokenize_cstr(&ts, name, sizeof(name))) {
- lwsl_err("%s: pcol name too long\n", __func__);
-
- return 1;
- }
- lwsl_debug("checking %s\n", name);
- pcol = lws_vhost_name_to_protocol(wsi->vhost, name);
- if (pcol) {
- /* if we know it, bind to it and stop looking */
- lws_bind_protocol(wsi, pcol, "ws upg pcol");
- e = LWS_TOKZE_ENDED;
+ while (*p && !hit) {
+ n = 0;
+ non_space_char_found = 0;
+ while (n < (int)sizeof(protocol_name) - 1 &&
+ *p && *p != ',') {
+ /* ignore leading spaces */
+ if (!non_space_char_found && *p == ' ') {
+ n++;
+ continue;
}
- break;
+ non_space_char_found = 1;
+ protocol_name[n++] = *p++;
+ }
+ protocol_name[n] = '\0';
+ if (*p)
+ p++;
- case LWS_TOKZE_DELIMITER:
- case LWS_TOKZE_ENDED:
- break;
+ lwsl_debug("checking %s\n", protocol_name);
- default:
- lwsl_err("%s: malformatted protocol list", __func__);
+ n = 0;
+ while (wsi->vhost->protocols[n].callback) {
+ lwsl_debug("try %s\n",
+ wsi->vhost->protocols[n].name);
+
+ if (wsi->vhost->protocols[n].name &&
+ !strcmp(wsi->vhost->protocols[n].name,
+ protocol_name)) {
+ wsi->protocol = &wsi->vhost->protocols[n];
+ hit = 1;
+ break;
+ }
- return 1;
+ n++;
}
- } while (e > 0);
+ }
/* we didn't find a protocol he wanted? */
- if (!pcol) {
- lwsl_notice("No supported protocol \"%s\"\n", buf);
-
- return 1;
+ if (!hit) {
+ if (lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL)) {
+ lwsl_notice("No protocol from \"%s\" supported\n",
+ protocol_list);
+ return 1;
+ }
+ /*
+ * some clients only have one protocol and
+ * do not send the protocol list header...
+ * allow it and match to the vhost's default
+ * protocol (which itself defaults to zero)
+ */
+ lwsl_info("defaulting to prot handler %d\n",
+ wsi->vhost->default_protocol_index);
+ n = wsi->vhost->default_protocol_index;
+ wsi->protocol = &wsi->vhost->protocols[
+ (int)wsi->vhost->default_protocol_index];
}
-alloc_ws:
-
/* allocate the ws struct for the wsi */
-
wsi->ws = lws_zalloc(sizeof(*wsi->ws), "ws struct");
if (!wsi->ws) {
lwsl_notice("OOM\n");
@@ -438,9 +383,6 @@ alloc_ws:
lwsl_notice("h2 ws handshake failed\n");
return 1;
}
- lws_role_transition(wsi,
- LWSIFR_SERVER | LWSIFR_P_ENCAP_H2,
- LRS_ESTABLISHED, &role_ops_ws);
} else
#endif
{
@@ -453,6 +395,28 @@ alloc_ws:
break;
}
+ lws_same_vh_protocol_insert(wsi, n);
+
+ /*
+ * We are upgrading to ws, so http/1.1 + h2 and keepalive + pipelined
+ * header considerations about keeping the ah around no longer apply.
+ *
+ * However it's common for the first ws protocol data to have been
+ * coalesced with the browser upgrade request and to already be in the
+ * ah rx buffer.
+ */
+
+ lws_pt_lock(pt, __func__);
+
+ if (wsi->h2_stream_carries_ws)
+ lws_role_transition(wsi, LWSIFR_SERVER | LWSIFR_P_ENCAP_H2,
+ LRS_ESTABLISHED, &role_ops_ws);
+ else
+ lws_role_transition(wsi, LWSIFR_SERVER, LRS_ESTABLISHED,
+ &role_ops_ws);
+
+ lws_pt_unlock(pt);
+
lws_server_init_wsi_for_ws(wsi);
lwsl_parser("accepted v%02d connection\n", wsi->ws->ietf_spec_revision);
@@ -479,8 +443,7 @@ handshake_0405(struct lws_context *context, struct lws *wsi)
goto bail;
}
- if (lws_hdr_total_length(wsi, WSI_TOKEN_KEY) >=
- MAX_WEBSOCKET_04_KEY_LEN) {
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_KEY) >= MAX_WEBSOCKET_04_KEY_LEN) {
lwsl_warn("Client key too long %d\n", MAX_WEBSOCKET_04_KEY_LEN);
goto bail;
}
@@ -510,8 +473,7 @@ handshake_0405(struct lws_context *context, struct lws *wsi)
/* make a buffer big enough for everything */
- response = (char *)pt->serv_buf + MAX_WEBSOCKET_04_KEY_LEN +
- 256 + LWS_PRE;
+ response = (char *)pt->serv_buf + MAX_WEBSOCKET_04_KEY_LEN + 256 + LWS_PRE;
p = response;
LWS_CPYAPP(p, "HTTP/1.1 101 Switching Protocols\x0d\x0a"
"Upgrade: WebSocket\x0d\x0a"
@@ -604,9 +566,9 @@ bail:
static int
lws_ws_frame_rest_is_payload(struct lws *wsi, uint8_t **buf, size_t len)
{
- unsigned int avail = (unsigned int)len;
uint8_t *buffer = *buf, mask[4];
struct lws_tokens ebuf;
+ unsigned int avail = (unsigned int)len;
#if !defined(LWS_WITHOUT_EXTENSIONS)
unsigned int old_packet_length = (int)wsi->ws->rx_packet_length;
#endif
@@ -638,7 +600,7 @@ lws_ws_frame_rest_is_payload(struct lws *wsi, uint8_t **buf, size_t len)
if (avail > len)
avail = (unsigned int)len;
- if (!avail)
+ if (avail <= 0)
return 0;
ebuf.token = (char *)buffer;
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/lws-genhash.c b/thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c
index ce4ee6e382..ce4ee6e382 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/lws-genhash.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/lws-genrsa.c b/thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c
index 99b2e75653..70a9fcf42c 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/lws-genrsa.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c
@@ -36,6 +36,8 @@ lws_jwk_destroy_genrsa_elements(struct lws_genrsa_elements *el)
LWS_VISIBLE int
lws_genrsa_create(struct lws_genrsa_ctx *ctx, struct lws_genrsa_elements *el)
{
+ int n;
+
memset(ctx, 0, sizeof(*ctx));
ctx->ctx = lws_zalloc(sizeof(*ctx->ctx), "genrsa");
if (!ctx->ctx)
@@ -44,8 +46,6 @@ lws_genrsa_create(struct lws_genrsa_ctx *ctx, struct lws_genrsa_elements *el)
mbedtls_rsa_init(ctx->ctx, MBEDTLS_RSA_PKCS_V15, 0);
{
- int n;
-
mbedtls_mpi *mpi[LWS_COUNT_RSA_ELEMENTS] = {
&ctx->ctx->E, &ctx->ctx->N, &ctx->ctx->D, &ctx->ctx->P,
&ctx->ctx->Q, &ctx->ctx->DP, &ctx->ctx->DQ,
@@ -129,7 +129,7 @@ cleanup_1:
LWS_VISIBLE int
lws_genrsa_public_decrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
- size_t in_len, uint8_t *out, size_t out_max)
+ size_t in_len, uint8_t *out, size_t out_max)
{
size_t olen = 0;
int n;
@@ -149,7 +149,7 @@ lws_genrsa_public_decrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
LWS_VISIBLE int
lws_genrsa_public_encrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
- size_t in_len, uint8_t *out)
+ size_t in_len, uint8_t *out)
{
int n;
@@ -213,8 +213,8 @@ lws_genrsa_public_verify(struct lws_genrsa_ctx *ctx, const uint8_t *in,
LWS_VISIBLE int
lws_genrsa_public_sign(struct lws_genrsa_ctx *ctx, const uint8_t *in,
- enum lws_genhash_types hash_type, uint8_t *sig,
- size_t sig_len)
+ enum lws_genhash_types hash_type, uint8_t *sig,
+ size_t sig_len)
{
int n, h = lws_genrsa_genrsa_hash_to_mbed_hash(hash_type);
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/mbedtls-client.c b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c
index 84270c15bc..a7864ab790 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/mbedtls-client.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c
@@ -30,6 +30,7 @@ OpenSSL_client_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
int
lws_ssl_client_bio_create(struct lws *wsi)
{
+ X509_VERIFY_PARAM *param;
char hostname[128], *p;
const char *alpn_comma = wsi->context->tls.alpn_default;
struct alpn_ctx protos;
@@ -62,7 +63,7 @@ lws_ssl_client_bio_create(struct lws *wsi)
SSL_set_info_callback(wsi->tls.ssl, lws_ssl_info_callback);
if (!(wsi->tls.use_ssl & LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK)) {
- X509_VERIFY_PARAM *param = SSL_get0_param(wsi->tls.ssl);
+ param = SSL_get0_param(wsi->tls.ssl);
/* Enable automatic hostname checks */
// X509_VERIFY_PARAM_set_hostflags(param,
// X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
@@ -187,8 +188,6 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
const struct lws_context_creation_info *info,
const char *cipher_list,
const char *ca_filepath,
- const void *ca_mem,
- unsigned int ca_mem_len,
const char *cert_filepath,
const char *private_key_filepath)
{
@@ -215,20 +214,16 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
return 1;
}
- if (!ca_filepath && (!ca_mem || !ca_mem_len))
+ if (!ca_filepath)
return 0;
- if (ca_filepath) {
- if (alloc_file(vh->context, ca_filepath, &buf, &len)) {
- lwsl_err("Load CA cert file %s failed\n", ca_filepath);
- return 1;
- }
- vh->tls.x509_client_CA = d2i_X509(NULL, buf, len);
- free(buf);
- } else {
- vh->tls.x509_client_CA = d2i_X509(NULL, (uint8_t*)ca_mem, ca_mem_len);
+ if (alloc_file(vh->context, ca_filepath, &buf, &len)) {
+ lwsl_err("Load CA cert file %s failed\n", ca_filepath);
+ return 1;
}
+ vh->tls.x509_client_CA = d2i_X509(NULL, buf, len);
+ free(buf);
if (!vh->tls.x509_client_CA) {
lwsl_err("client CA: x509 parse failed\n");
return 1;
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/mbedtls-server.c b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c
index df6ddf2c61..f17c7e5494 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/mbedtls-server.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c
@@ -294,20 +294,18 @@ lws_tls_server_accept(struct lws *wsi)
if (n == 1) {
if (strstr(wsi->vhost->name, ".invalid")) {
- lwsl_notice("%s: vhost has .invalid, "
- "rejecting accept\n", __func__);
+ lwsl_notice("%s: vhost has .invalid, rejecting accept\n", __func__);
return LWS_SSL_CAPABLE_ERROR;
}
- n = lws_tls_peer_cert_info(wsi, LWS_TLS_CERT_INFO_COMMON_NAME,
- &ir, sizeof(ir.ns.name));
+ n = lws_tls_peer_cert_info(wsi, LWS_TLS_CERT_INFO_COMMON_NAME, &ir,
+ sizeof(ir.ns.name));
if (!n)
lwsl_notice("%s: client cert CN '%s'\n",
__func__, ir.ns.name);
else
- lwsl_info("%s: couldn't get client cert CN\n",
- __func__);
+ lwsl_info("%s: couldn't get client cert CN\n", __func__);
return LWS_SSL_CAPABLE_DONE;
}
@@ -324,8 +322,7 @@ lws_tls_server_accept(struct lws *wsi)
if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->tls.ssl)) {
if (lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
- lwsl_info("%s: WANT_READ change_pollfd failed\n",
- __func__);
+ lwsl_info("%s: WANT_READ change_pollfd failed\n", __func__);
return LWS_SSL_CAPABLE_ERROR;
}
@@ -336,8 +333,7 @@ lws_tls_server_accept(struct lws *wsi)
lwsl_debug("%s: WANT_WRITE\n", __func__);
if (lws_change_pollfd(wsi, 0, LWS_POLLOUT)) {
- lwsl_info("%s: WANT_WRITE change_pollfd failed\n",
- __func__);
+ lwsl_info("%s: WANT_WRITE change_pollfd failed\n", __func__);
return LWS_SSL_CAPABLE_ERROR;
}
return LWS_SSL_CAPABLE_MORE_SERVICE_WRITE;
@@ -558,8 +554,7 @@ lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
//lwsl_hexdump_level(LLL_DEBUG, pkey_asn1, n);
/* and to use our generated private key */
- n = SSL_CTX_use_PrivateKey_ASN1(0, vhost->tls.ssl_ctx,
- pkey_asn1, m);
+ n = SSL_CTX_use_PrivateKey_ASN1(0, vhost->tls.ssl_ctx, pkey_asn1, m);
lws_free(pkey_asn1);
if (n != 1) {
lwsl_err("%s: SSL_CTX_use_PrivateKey_ASN1 failed\n",
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/ssl.c b/thirdparty/libwebsockets/tls/mbedtls/ssl.c
index b81f88862b..f311ef50e3 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/ssl.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/ssl.c
@@ -33,8 +33,7 @@ lws_context_init_ssl_library(const struct lws_context_creation_info *info)
lwsl_info(" Compiled with MbedTLS support\n");
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
- lwsl_info(" SSL disabled: no "
- "LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT\n");
+ lwsl_info(" SSL disabled: no LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT\n");
return 0;
}
@@ -70,17 +69,16 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
errno = 0;
n = SSL_read(wsi->tls.ssl, buf, len);
#if defined(LWS_WITH_ESP32)
- if (!n && errno == LWS_ENOTCONN) {
+ if (!n && errno == ENOTCONN) {
lwsl_debug("%p: SSL_read ENOTCONN\n", wsi);
return LWS_SSL_CAPABLE_ERROR;
}
#endif
#if defined(LWS_WITH_STATS)
- if (!wsi->seen_rx && wsi->accept_start_us) {
+ if (!wsi->seen_rx) {
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_MS_SSL_RX_DELAY,
- lws_time_in_microseconds() -
- wsi->accept_start_us);
+ time_in_microseconds() - wsi->accept_start_us);
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_C_SSL_CONNS_HAD_RX, 1);
wsi->seen_rx = 1;
@@ -135,12 +133,23 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
if (!wsi->tls.ssl)
goto bail;
- if (SSL_pending(wsi->tls.ssl) &&
- lws_dll_is_null(&wsi->tls.pending_tls_list)) {
+ if (!SSL_pending(wsi->tls.ssl))
+ goto bail;
- lws_dll_lws_add_front(&wsi->tls.pending_tls_list,
- &pt->tls.pending_tls_head);
- }
+ if (wsi->tls.pending_read_list_next)
+ return n;
+ if (wsi->tls.pending_read_list_prev)
+ return n;
+ if (pt->tls.pending_read_list == wsi)
+ return n;
+
+ /* add us to the linked list of guys with pending ssl */
+ if (pt->tls.pending_read_list)
+ pt->tls.pending_read_list->tls.pending_read_list_prev = wsi;
+
+ wsi->tls.pending_read_list_next = pt->tls.pending_read_list;
+ wsi->tls.pending_read_list_prev = NULL;
+ pt->tls.pending_read_list = wsi;
return n;
bail:
@@ -180,7 +189,7 @@ lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len)
if (m == SSL_ERROR_WANT_WRITE || SSL_want_write(wsi->tls.ssl)) {
lws_set_blocking_send(wsi);
- lwsl_debug("%s: want write\n", __func__);
+ lwsl_notice("%s: want write\n", __func__);
return LWS_SSL_CAPABLE_MORE_SERVICE;
}
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl3.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl3.h
index 007b392f3e..007b392f3e 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl3.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl3.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_cert.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_cert.h
index 86cf31ad51..86cf31ad51 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_cert.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_cert.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_code.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_code.h
index 80fdbb20f3..80fdbb20f3 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_code.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_code.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_dbg.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_dbg.h
index ad32cb92ff..ad32cb92ff 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_dbg.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_dbg.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_lib.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_lib.h
index 42b2de7501..42b2de7501 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_lib.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_lib.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_methods.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_methods.h
index cd2f8c0533..cd2f8c0533 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_methods.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_methods.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_pkey.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_pkey.h
index e790fcc995..e790fcc995 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_pkey.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_pkey.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_stack.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_stack.h
index 7a7051a026..7a7051a026 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_stack.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_stack.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_types.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_types.h
index 68ac748a28..68ac748a28 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_types.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_types.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_x509.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_x509.h
index 7594d064b4..7594d064b4 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/ssl_x509.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_x509.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/tls1.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/tls1.h
index 7af1b0157d..7af1b0157d 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/tls1.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/tls1.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/x509_vfy.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/x509_vfy.h
index 26bf6c88a8..26bf6c88a8 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/internal/x509_vfy.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/x509_vfy.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/openssl/ssl.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/openssl/ssl.h
index e2b74fc6af..e2b74fc6af 100755
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/openssl/ssl.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/openssl/ssl.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/platform/ssl_pm.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_pm.h
index cbbe3aa3a2..cbbe3aa3a2 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/platform/ssl_pm.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_pm.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/platform/ssl_port.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_port.h
index 74c7634355..74c7634355 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/include/platform/ssl_port.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_port.h
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_cert.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_cert.c
index 5c608125ac..5c608125ac 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_cert.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_cert.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_lib.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_lib.c
index 2f688ca9ef..2f688ca9ef 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_lib.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_lib.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_methods.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_methods.c
index 0002360846..0002360846 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_methods.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_methods.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_pkey.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_pkey.c
index 567a33e2c2..567a33e2c2 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_pkey.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_pkey.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_stack.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_stack.c
index da836daf9c..da836daf9c 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_stack.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_stack.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_x509.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_x509.c
index ed79150831..ed79150831 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/library/ssl_x509.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_x509.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/platform/ssl_pm.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_pm.c
index 4716c1ff56..4716c1ff56 100755
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/platform/ssl_pm.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_pm.c
diff --git a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/platform/ssl_port.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_port.c
index 8c7a31338b..8c7a31338b 100644
--- a/thirdparty/libwebsockets/lib/tls/mbedtls/wrapper/platform/ssl_port.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_port.c
diff --git a/thirdparty/libwebsockets/lib/tls/private.h b/thirdparty/libwebsockets/tls/private.h
index ad01bfd4fb..606e2574dc 100644
--- a/thirdparty/libwebsockets/lib/tls/private.h
+++ b/thirdparty/libwebsockets/tls/private.h
@@ -64,8 +64,6 @@
#include <openssl/err.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
- #include <openssl/rsa.h>
- #include <openssl/bn.h>
#ifdef LWS_HAVE_OPENSSL_ECDH_H
#include <openssl/ecdh.h>
#endif
@@ -73,9 +71,8 @@
#endif /* not mbedtls */
#if defined(OPENSSL_VERSION_NUMBER)
#if (OPENSSL_VERSION_NUMBER < 0x0009080afL)
-/*
- * later openssl defines this to negate the presence of tlsext... but it was
- * only introduced at 0.9.8j. Earlier versions don't know it exists so don't
+/* later openssl defines this to negate the presence of tlsext... but it was only
+ * introduced at 0.9.8j. Earlier versions don't know it exists so don't
* define it... making it look like the feature exists...
*/
#define OPENSSL_NO_TLSEXT
@@ -118,7 +115,7 @@ struct lws_context_tls {
};
struct lws_pt_tls {
- struct lws_dll_lws pending_tls_head;
+ struct lws *pending_read_list; /* linked list */
};
struct lws_tls_ss_pieces;
@@ -152,7 +149,7 @@ struct lws_vhost_tls {
struct lws_lws_tls {
lws_tls_conn *ssl;
lws_tls_bio *client_bio;
- struct lws_dll_lws pending_tls_list;
+ struct lws *pending_read_list_prev, *pending_read_list_next;
unsigned int use_ssl;
unsigned int redirect_to_https:1;
};
@@ -214,8 +211,8 @@ lws_tls_generic_cert_checks(struct lws_vhost *vhost, const char *cert,
const char *private_key);
LWS_EXTERN int
lws_tls_alloc_pem_to_der_file(struct lws_context *context, const char *filename,
- const char *inbuf, lws_filepos_t inlen,
- uint8_t **buf, lws_filepos_t *amount);
+ const char *inbuf, lws_filepos_t inlen,
+ uint8_t **buf, lws_filepos_t *amount);
#if !defined(LWS_NO_SERVER)
LWS_EXTERN int
@@ -263,8 +260,6 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
const struct lws_context_creation_info *info,
const char *cipher_list,
const char *ca_filepath,
- const void *ca_mem,
- unsigned int ca_mem_len,
const char *cert_filepath,
const char *private_key_filepath);
@@ -283,4 +278,4 @@ lws_ssl_info_callback(const lws_tls_conn *ssl, int where, int ret);
int
lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt);
-#endif
+#endif \ No newline at end of file
diff --git a/thirdparty/libwebsockets/lib/tls/tls-client.c b/thirdparty/libwebsockets/tls/tls-client.c
index f69c685fa7..70eb6f6078 100644
--- a/thirdparty/libwebsockets/lib/tls/tls-client.c
+++ b/thirdparty/libwebsockets/tls/tls-client.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - client-related ssl code independent of backend
*
- * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -89,10 +89,10 @@ lws_ssl_client_connect2(struct lws *wsi, char *errbuf, int len)
int lws_context_init_client_ssl(const struct lws_context_creation_info *info,
struct lws_vhost *vhost)
{
- const char *private_key_filepath = info->ssl_private_key_filepath;
- const char *cert_filepath = info->ssl_cert_filepath;
const char *ca_filepath = info->ssl_ca_filepath;
const char *cipher_list = info->ssl_cipher_list;
+ const char *private_key_filepath = info->ssl_private_key_filepath;
+ const char *cert_filepath = info->ssl_cert_filepath;
struct lws wsi;
if (vhost->options & LWS_SERVER_OPTION_ONLY_RAW)
@@ -128,10 +128,7 @@ int lws_context_init_client_ssl(const struct lws_context_creation_info *info,
}
if (lws_tls_client_create_vhost_context(vhost, info, cipher_list,
- ca_filepath,
- info->client_ssl_ca_mem,
- info->client_ssl_ca_mem_len,
- cert_filepath,
+ ca_filepath, cert_filepath,
private_key_filepath))
return 1;
@@ -142,12 +139,12 @@ int lws_context_init_client_ssl(const struct lws_context_creation_info *info,
* lws_get_context() in the callback
*/
memset(&wsi, 0, sizeof(wsi));
- wsi.vhost = vhost; /* not a real bound wsi */
+ wsi.vhost = vhost;
wsi.context = vhost->context;
vhost->protocols[0].callback(&wsi,
LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS,
- vhost->tls.ssl_client_ctx, NULL, 0);
+ vhost->tls.ssl_client_ctx, NULL, 0);
return 0;
}
diff --git a/thirdparty/libwebsockets/lib/tls/tls-server.c b/thirdparty/libwebsockets/tls/tls-server.c
index 9d3f70dbea..440e790660 100644
--- a/thirdparty/libwebsockets/lib/tls/tls-server.c
+++ b/thirdparty/libwebsockets/tls/tls-server.c
@@ -56,8 +56,7 @@ lws_context_init_alpn(struct lws_vhost *vhost)
vhost->tls.alpn_ctx.data,
sizeof(vhost->tls.alpn_ctx.data) - 1);
- SSL_CTX_set_alpn_select_cb(vhost->tls.ssl_ctx, alpn_cb,
- &vhost->tls.alpn_ctx);
+ SSL_CTX_set_alpn_select_cb(vhost->tls.ssl_ctx, alpn_cb, &vhost->tls.alpn_ctx);
#else
lwsl_err(
" HTTP2 / ALPN configured but not supported by OpenSSL 0x%lx\n",
@@ -140,7 +139,7 @@ lws_context_init_server_ssl(const struct lws_context_creation_info *info,
* lws_get_context() in the callback
*/
memset(&wsi, 0, sizeof(wsi));
- wsi.vhost = vhost; /* not a real bound wsi */
+ wsi.vhost = vhost;
wsi.context = context;
/*
@@ -178,10 +177,10 @@ LWS_VISIBLE int
lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
{
struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
struct lws_vhost *vh;
- char buf[256];
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
int n;
+ char buf[256];
(void)buf;
@@ -313,14 +312,12 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
/* normal SSL connection processing path */
#if defined(LWS_WITH_STATS)
- /* only set this the first time around */
if (!wsi->accept_start_us)
- wsi->accept_start_us = lws_time_in_microseconds();
+ wsi->accept_start_us = time_in_microseconds();
#endif
errno = 0;
lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN,
- 1);
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN, 1);
n = lws_tls_server_accept(wsi);
lws_latency(context, wsi,
"SSL_accept LRS_SSL_ACK_PENDING\n", n, n == 1);
@@ -330,8 +327,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
break;
case LWS_SSL_CAPABLE_ERROR:
lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_SSL_CONNECTIONS_FAILED,
- 1);
+ LWSSTATS_C_SSL_CONNECTIONS_FAILED, 1);
lwsl_info("SSL_accept failed socket %u: %d\n",
wsi->desc.sockfd, n);
wsi->socket_is_permanently_unusable = 1;
@@ -344,12 +340,10 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED, 1);
#if defined(LWS_WITH_STATS)
- if (wsi->accept_start_us)
- lws_stats_atomic_bump(wsi->context, pt,
+ lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY,
- lws_time_in_microseconds() -
- wsi->accept_start_us);
- wsi->accept_start_us = lws_time_in_microseconds();
+ time_in_microseconds() - wsi->accept_start_us);
+ wsi->accept_start_us = time_in_microseconds();
#endif
accepted:
@@ -360,7 +354,7 @@ accepted:
if (!vh->being_destroyed && wsi->tls.ssl &&
vh->tls.ssl_ctx == lws_tls_ctx_from_wsi(wsi)) {
lwsl_info("setting wsi to vh %s\n", vh->name);
- lws_vhost_bind_wsi(vh, wsi);
+ wsi->vhost = vh;
break;
}
vh = vh->vhost_next;
diff --git a/thirdparty/libwebsockets/lib/tls/tls.c b/thirdparty/libwebsockets/tls/tls.c
index a32951689f..92b7c5593c 100644
--- a/thirdparty/libwebsockets/lib/tls/tls.c
+++ b/thirdparty/libwebsockets/tls/tls.c
@@ -30,18 +30,18 @@
int
lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt)
{
+ struct lws *wsi, *wsi_next;
int ret = 0;
- lws_start_foreach_dll_safe(struct lws_dll_lws *, p, p1,
- pt->tls.pending_tls_head.next) {
- struct lws *wsi = lws_container_of(p, struct lws,
- tls.pending_tls_list);
-
+ wsi = pt->tls.pending_read_list;
+ while (wsi && wsi->position_in_fds_table != LWS_NO_FDS_POS) {
+ wsi_next = wsi->tls.pending_read_list_next;
pt->fds[wsi->position_in_fds_table].revents |=
pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
ret |= pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN;
- } lws_end_foreach_dll_safe(p, p1);
+ wsi = wsi_next;
+ }
return !!ret;
}
@@ -49,10 +49,29 @@ lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt)
void
__lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi)
{
- if (lws_dll_is_null(&wsi->tls.pending_tls_list))
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+
+ if (!wsi->tls.pending_read_list_prev &&
+ !wsi->tls.pending_read_list_next &&
+ pt->tls.pending_read_list != wsi)
+ /* we are not on the list */
return;
- lws_dll_lws_remove(&wsi->tls.pending_tls_list);
+ /* point previous guy's next to our next */
+ if (!wsi->tls.pending_read_list_prev)
+ pt->tls.pending_read_list = wsi->tls.pending_read_list_next;
+ else
+ wsi->tls.pending_read_list_prev->tls.pending_read_list_next =
+ wsi->tls.pending_read_list_next;
+
+ /* point next guy's previous to our previous */
+ if (wsi->tls.pending_read_list_next)
+ wsi->tls.pending_read_list_next->tls.pending_read_list_prev =
+ wsi->tls.pending_read_list_prev;
+
+ wsi->tls.pending_read_list_prev = NULL;
+ wsi->tls.pending_read_list_next = NULL;
}
void
@@ -154,12 +173,12 @@ bail:
int
lws_tls_alloc_pem_to_der_file(struct lws_context *context, const char *filename,
- const char *inbuf, lws_filepos_t inlen,
- uint8_t **buf, lws_filepos_t *amount)
+ const char *inbuf, lws_filepos_t inlen,
+ uint8_t **buf, lws_filepos_t *amount)
{
const uint8_t *pem, *p, *end;
- lws_filepos_t len;
uint8_t *q;
+ lws_filepos_t len;
int n;
if (filename) {
@@ -219,25 +238,23 @@ bail:
int
lws_tls_check_cert_lifetime(struct lws_vhost *v)
{
+ union lws_tls_cert_info_results ir;
time_t now = (time_t)lws_now_secs(), life = 0;
struct lws_acme_cert_aging_args caa;
- union lws_tls_cert_info_results ir;
int n;
if (v->tls.ssl_ctx && !v->tls.skipped_certs) {
- if (now < 1542933698) /* Nov 23 2018 00:42 UTC */
+ if (now < 1464083026) /* May 2016 */
/* our clock is wrong and we can't judge the certs */
return -1;
- n = lws_tls_vhost_cert_info(v, LWS_TLS_CERT_INFO_VALIDITY_TO,
- &ir, 0);
+ n = lws_tls_vhost_cert_info(v, LWS_TLS_CERT_INFO_VALIDITY_TO, &ir, 0);
if (n)
return 1;
life = (ir.time - now) / (24 * 3600);
- lwsl_notice(" vhost %s: cert expiry: %dd\n", v->name,
- (int)life);
+ lwsl_notice(" vhost %s: cert expiry: %dd\n", v->name, (int)life);
} else
lwsl_notice(" vhost %s: no cert\n", v->name);
@@ -429,7 +446,7 @@ lws_tls_cert_updated(struct lws_context *context, const char *certpath,
wsi.context = context;
lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
- wsi.vhost = v; /* not a real bound wsi */
+ wsi.vhost = v;
if (v->tls.alloc_cert_path && v->tls.key_path &&
!strcmp(v->tls.alloc_cert_path, certpath) &&
!strcmp(v->tls.key_path, keypath)) {
diff --git a/thirdparty/libwebsockets/uwp_fixes.diff b/thirdparty/libwebsockets/uwp_fixes.diff
index 3350f2a661..21c3275bba 100644
--- a/thirdparty/libwebsockets/uwp_fixes.diff
+++ b/thirdparty/libwebsockets/uwp_fixes.diff
@@ -1,8 +1,8 @@
-diff --git a/thirdparty/libwebsockets/lib/plat/windows/windows-file.c b/thirdparty/libwebsockets/lib/plat/windows/windows-file.c
-index 6516b70b0..eb73aab7f 100644
---- a/thirdparty/libwebsockets/lib/plat/windows/windows-file.c
-+++ b/thirdparty/libwebsockets/lib/plat/windows/windows-file.c
-@@ -36,9 +36,20 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
+index bd513b494..1850b6425 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
+@@ -641,9 +641,20 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
HANDLE ret;
WCHAR buf[MAX_PATH];
lws_fop_fd_t fop_fd;
@@ -24,7 +24,7 @@ index 6516b70b0..eb73aab7f 100644
if (((*flags) & 7) == _O_RDONLY) {
ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-@@ -46,6 +57,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+@@ -651,6 +662,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
}
@@ -32,7 +32,7 @@ index 6516b70b0..eb73aab7f 100644
if (ret == LWS_INVALID_FILE)
goto bail;
-@@ -58,9 +70,9 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+@@ -663,9 +675,9 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
fop_fd->fd = ret;
fop_fd->filesystem_priv = NULL; /* we don't use it */
fop_fd->flags = *flags;
diff --git a/thirdparty/libwebsockets/win32helpers/getopt.c b/thirdparty/libwebsockets/win32helpers/getopt.c
index 2181f1cb12..3bb21f6f28 100644
--- a/thirdparty/libwebsockets/win32helpers/getopt.c
+++ b/thirdparty/libwebsockets/win32helpers/getopt.c
@@ -1,153 +1,153 @@
-/* $NetBSD: getopt.c,v 1.16 1999/12/02 13:15:56 kleink Exp $ */
-
-/*
- * Copyright (c) 1987, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#define __P(x) x
-#define _DIAGASSERT(x) assert(x)
-
-#ifdef __weak_alias
-__weak_alias(getopt,_getopt);
-#endif
-
-
-int opterr = 1, /* if error message should be printed */
- optind = 1, /* index into parent argv vector */
- optopt, /* character checked for validity */
- optreset; /* reset getopt */
-char *optarg; /* argument associated with option */
-
-static char * _progname __P((char *));
-int getopt_internal __P((int, char * const *, const char *));
-
-static char *
-_progname(nargv0)
- char * nargv0;
-{
- char * tmp;
-
- _DIAGASSERT(nargv0 != NULL);
-
- tmp = strrchr(nargv0, '/');
- if (tmp)
- tmp++;
- else
- tmp = nargv0;
- return(tmp);
-}
-
-#define BADCH (int)'?'
-#define BADARG (int)':'
-#define EMSG ""
-
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt(nargc, nargv, ostr)
- int nargc;
- char * const nargv[];
- const char *ostr;
-{
- static char *__progname = 0;
- static char *place = EMSG; /* option letter processing */
- char *oli; /* option letter list index */
- __progname = __progname?__progname:_progname(*nargv);
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(ostr != NULL);
-
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
- place = EMSG;
- return (-1);
- }
- if (place[1] && *++place == '-' /* found "--" */
- && place[1] == '\0') {
- ++optind;
- place = EMSG;
- return (-1);
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
- /*
- * if the user didn't specify '-' as an option,
- * assume it means -1.
- */
- if (optopt == (int)'-')
- return (-1);
- if (!*place)
- ++optind;
- if (opterr && *ostr != ':')
- (void)fprintf(stderr,
- "%s: illegal option -- %c\n", __progname, optopt);
- return (BADCH);
- }
- if (*++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place)
- ++optind;
- }
- else { /* need an argument */
- if (*place) /* no white space */
- optarg = place;
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- if (*ostr == ':')
- return (BADARG);
- if (opterr)
- (void)fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- __progname, optopt);
- return (BADCH);
- }
- else /* white space */
- optarg = nargv[optind];
- place = EMSG;
- ++optind;
- }
- return (optopt); /* dump back option letter */
-}
-
+/* $NetBSD: getopt.c,v 1.16 1999/12/02 13:15:56 kleink Exp $ */
+
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if 0
+static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#define __P(x) x
+#define _DIAGASSERT(x) assert(x)
+
+#ifdef __weak_alias
+__weak_alias(getopt,_getopt);
+#endif
+
+
+int opterr = 1, /* if error message should be printed */
+ optind = 1, /* index into parent argv vector */
+ optopt, /* character checked for validity */
+ optreset; /* reset getopt */
+char *optarg; /* argument associated with option */
+
+static char * _progname __P((char *));
+int getopt_internal __P((int, char * const *, const char *));
+
+static char *
+_progname(nargv0)
+ char * nargv0;
+{
+ char * tmp;
+
+ _DIAGASSERT(nargv0 != NULL);
+
+ tmp = strrchr(nargv0, '/');
+ if (tmp)
+ tmp++;
+ else
+ tmp = nargv0;
+ return(tmp);
+}
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt(nargc, nargv, ostr)
+ int nargc;
+ char * const nargv[];
+ const char *ostr;
+{
+ static char *__progname = 0;
+ static char *place = EMSG; /* option letter processing */
+ char *oli; /* option letter list index */
+ __progname = __progname?__progname:_progname(*nargv);
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(ostr != NULL);
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (-1);
+ }
+ if (place[1] && *++place == '-' /* found "--" */
+ && place[1] == '\0') {
+ ++optind;
+ place = EMSG;
+ return (-1);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1.
+ */
+ if (optopt == (int)'-')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)fprintf(stderr,
+ "%s: illegal option -- %c\n", __progname, optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ }
+ else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if (*ostr == ':')
+ return (BADARG);
+ if (opterr)
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %c\n",
+ __progname, optopt);
+ return (BADCH);
+ }
+ else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
+
diff --git a/thirdparty/libwebsockets/win32helpers/getopt_long.c b/thirdparty/libwebsockets/win32helpers/getopt_long.c
index 22e5fa8945..6dfccf367d 100644
--- a/thirdparty/libwebsockets/win32helpers/getopt_long.c
+++ b/thirdparty/libwebsockets/win32helpers/getopt_long.c
@@ -1,240 +1,240 @@
-
-/*
- * Copyright (c) 1987, 1993, 1994, 1996
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "getopt.h"
-
-#define lws_ptr_diff(head, tail) \
- ((int)((char *)(head) - (char *)(tail)))
-
-extern int opterr; /* if error message should be printed */
-extern int optind; /* index into parent argv vector */
-extern int optopt; /* character checked for validity */
-extern int optreset; /* reset getopt */
-extern char *optarg; /* argument associated with option */
-
-#define __P(x) x
-#define _DIAGASSERT(x) assert(x)
-
-static char * __progname __P((char *));
-int getopt_internal __P((int, char * const *, const char *));
-
-static char *
-__progname(nargv0)
- char * nargv0;
-{
- char * tmp;
-
- _DIAGASSERT(nargv0 != NULL);
-
- tmp = strrchr(nargv0, '/');
- if (tmp)
- tmp++;
- else
- tmp = nargv0;
- return(tmp);
-}
-
-#define BADCH (int)'?'
-#define BADARG (int)':'
-#define EMSG ""
-
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt_internal(nargc, nargv, ostr)
- int nargc;
- char * const *nargv;
- const char *ostr;
-{
- static char *place = EMSG; /* option letter processing */
- char *oli; /* option letter list index */
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(ostr != NULL);
-
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
- place = EMSG;
- return (-1);
- }
- if (place[1] && *++place == '-') { /* found "--" */
- /* ++optind; */
- place = EMSG;
- return (-2);
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
- /*
- * if the user didn't specify '-' as an option,
- * assume it means -1.
- */
- if (optopt == (int)'-')
- return (-1);
- if (!*place)
- ++optind;
- if (opterr && *ostr != ':')
- (void)fprintf(stderr,
- "%s: illegal option -- %c\n", __progname(nargv[0]), optopt);
- return (BADCH);
- }
- if (*++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place)
- ++optind;
- } else { /* need an argument */
- if (*place) /* no white space */
- optarg = place;
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- if ((opterr) && (*ostr != ':'))
- (void)fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- __progname(nargv[0]), optopt);
- return (BADARG);
- } else /* white space */
- optarg = nargv[optind];
- place = EMSG;
- ++optind;
- }
- return (optopt); /* dump back option letter */
-}
-
-#if 0
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt2(nargc, nargv, ostr)
- int nargc;
- char * const *nargv;
- const char *ostr;
-{
- int retval;
-
- if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) {
- retval = -1;
- ++optind;
- }
- return(retval);
-}
-#endif
-
-/*
- * getopt_long --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long(nargc, nargv, options, long_options, index)
- int nargc;
- char ** nargv;
- char * options;
- struct option * long_options;
- int * index;
-{
- int retval;
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(options != NULL);
- _DIAGASSERT(long_options != NULL);
- /* index may be NULL */
-
- if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
- char *current_argv = nargv[optind++] + 2, *has_equal;
- int i, current_argv_len, match = -1;
-
- if (*current_argv == '\0') {
- return(-1);
- }
- if ((has_equal = strchr(current_argv, '=')) != NULL) {
- current_argv_len = lws_ptr_diff(has_equal, current_argv);
- has_equal++;
- } else
- current_argv_len = (int)strlen(current_argv);
-
- for (i = 0; long_options[i].name; i++) {
- if (strncmp(current_argv, long_options[i].name, current_argv_len))
- continue;
-
- if (strlen(long_options[i].name) == (unsigned)current_argv_len) {
- match = i;
- break;
- }
- if (match == -1)
- match = i;
- }
- if (match != -1) {
- if (long_options[match].has_arg == required_argument ||
- long_options[match].has_arg == optional_argument) {
- if (has_equal)
- optarg = has_equal;
- else
- optarg = nargv[optind++];
- }
- if ((long_options[match].has_arg == required_argument)
- && (optarg == NULL)) {
- /*
- * Missing argument, leading :
- * indicates no error should be generated
- */
- if ((opterr) && (*options != ':'))
- (void)fprintf(stderr,
- "%s: option requires an argument -- %s\n",
- __progname(nargv[0]), current_argv);
- return (BADARG);
- }
- } else { /* No matching argument */
- if ((opterr) && (*options != ':'))
- (void)fprintf(stderr,
- "%s: illegal option -- %s\n", __progname(nargv[0]), current_argv);
- return (BADCH);
- }
- if (long_options[match].flag) {
- *long_options[match].flag = long_options[match].val;
- retval = 0;
- } else
- retval = long_options[match].val;
- if (index)
- *index = match;
- }
- return(retval);
-}
+
+/*
+ * Copyright (c) 1987, 1993, 1994, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "getopt.h"
+
+#define lws_ptr_diff(head, tail) \
+ ((int)((char *)(head) - (char *)(tail)))
+
+extern int opterr; /* if error message should be printed */
+extern int optind; /* index into parent argv vector */
+extern int optopt; /* character checked for validity */
+extern int optreset; /* reset getopt */
+extern char *optarg; /* argument associated with option */
+
+#define __P(x) x
+#define _DIAGASSERT(x) assert(x)
+
+static char * __progname __P((char *));
+int getopt_internal __P((int, char * const *, const char *));
+
+static char *
+__progname(nargv0)
+ char * nargv0;
+{
+ char * tmp;
+
+ _DIAGASSERT(nargv0 != NULL);
+
+ tmp = strrchr(nargv0, '/');
+ if (tmp)
+ tmp++;
+ else
+ tmp = nargv0;
+ return(tmp);
+}
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_internal(nargc, nargv, ostr)
+ int nargc;
+ char * const *nargv;
+ const char *ostr;
+{
+ static char *place = EMSG; /* option letter processing */
+ char *oli; /* option letter list index */
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(ostr != NULL);
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (-1);
+ }
+ if (place[1] && *++place == '-') { /* found "--" */
+ /* ++optind; */
+ place = EMSG;
+ return (-2);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1.
+ */
+ if (optopt == (int)'-')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)fprintf(stderr,
+ "%s: illegal option -- %c\n", __progname(nargv[0]), optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ } else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if ((opterr) && (*ostr != ':'))
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %c\n",
+ __progname(nargv[0]), optopt);
+ return (BADARG);
+ } else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
+
+#if 0
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt2(nargc, nargv, ostr)
+ int nargc;
+ char * const *nargv;
+ const char *ostr;
+{
+ int retval;
+
+ if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) {
+ retval = -1;
+ ++optind;
+ }
+ return(retval);
+}
+#endif
+
+/*
+ * getopt_long --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_long(nargc, nargv, options, long_options, index)
+ int nargc;
+ char ** nargv;
+ char * options;
+ struct option * long_options;
+ int * index;
+{
+ int retval;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+ _DIAGASSERT(long_options != NULL);
+ /* index may be NULL */
+
+ if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
+ char *current_argv = nargv[optind++] + 2, *has_equal;
+ int i, current_argv_len, match = -1;
+
+ if (*current_argv == '\0') {
+ return(-1);
+ }
+ if ((has_equal = strchr(current_argv, '=')) != NULL) {
+ current_argv_len = lws_ptr_diff(has_equal, current_argv);
+ has_equal++;
+ } else
+ current_argv_len = (int)strlen(current_argv);
+
+ for (i = 0; long_options[i].name; i++) {
+ if (strncmp(current_argv, long_options[i].name, current_argv_len))
+ continue;
+
+ if (strlen(long_options[i].name) == (unsigned)current_argv_len) {
+ match = i;
+ break;
+ }
+ if (match == -1)
+ match = i;
+ }
+ if (match != -1) {
+ if (long_options[match].has_arg == required_argument ||
+ long_options[match].has_arg == optional_argument) {
+ if (has_equal)
+ optarg = has_equal;
+ else
+ optarg = nargv[optind++];
+ }
+ if ((long_options[match].has_arg == required_argument)
+ && (optarg == NULL)) {
+ /*
+ * Missing argument, leading :
+ * indicates no error should be generated
+ */
+ if ((opterr) && (*options != ':'))
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %s\n",
+ __progname(nargv[0]), current_argv);
+ return (BADARG);
+ }
+ } else { /* No matching argument */
+ if ((opterr) && (*options != ':'))
+ (void)fprintf(stderr,
+ "%s: illegal option -- %s\n", __progname(nargv[0]), current_argv);
+ return (BADCH);
+ }
+ if (long_options[match].flag) {
+ *long_options[match].flag = long_options[match].val;
+ retval = 0;
+ } else
+ retval = long_options[match].val;
+ if (index)
+ *index = match;
+ }
+ return(retval);
+}
diff --git a/thirdparty/libwebsockets/win32helpers/gettimeofday.c b/thirdparty/libwebsockets/win32helpers/gettimeofday.c
index 08385c2320..35dd73531d 100644
--- a/thirdparty/libwebsockets/win32helpers/gettimeofday.c
+++ b/thirdparty/libwebsockets/win32helpers/gettimeofday.c
@@ -1,36 +1,36 @@
-#include <time.h>
-#include <windows.h> //I've omitted context line
-
-#include "gettimeofday.h"
-
-int gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- FILETIME ft;
- unsigned __int64 tmpres = 0;
- static int tzflag;
-
- if (NULL != tv) {
- GetSystemTimeAsFileTime(&ft);
-
- tmpres |= ft.dwHighDateTime;
- tmpres <<= 32;
- tmpres |= ft.dwLowDateTime;
-
- /*converting file time to unix epoch*/
- tmpres /= 10; /*convert into microseconds*/
+#include <time.h>
+#include <windows.h> //I've omitted context line
+
+#include "gettimeofday.h"
+
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ unsigned __int64 tmpres = 0;
+ static int tzflag;
+
+ if (NULL != tv) {
+ GetSystemTimeAsFileTime(&ft);
+
+ tmpres |= ft.dwHighDateTime;
+ tmpres <<= 32;
+ tmpres |= ft.dwLowDateTime;
+
+ /*converting file time to unix epoch*/
+ tmpres /= 10; /*convert into microseconds*/
tmpres -= DELTA_EPOCH_IN_MICROSECS;
- tv->tv_sec = (long)(tmpres / 1000000UL);
- tv->tv_usec = (long)(tmpres % 1000000UL);
- }
-
- if (NULL != tz) {
- if (!tzflag) {
- _tzset();
- tzflag++;
- }
- tz->tz_minuteswest = _timezone / 60;
- tz->tz_dsttime = _daylight;
- }
-
- return 0;
-}
+ tv->tv_sec = (long)(tmpres / 1000000UL);
+ tv->tv_usec = (long)(tmpres % 1000000UL);
+ }
+
+ if (NULL != tz) {
+ if (!tzflag) {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
diff --git a/thirdparty/misc/clipper-exceptions.patch b/thirdparty/misc/clipper-exceptions.patch
new file mode 100644
index 0000000000..537afd59b3
--- /dev/null
+++ b/thirdparty/misc/clipper-exceptions.patch
@@ -0,0 +1,154 @@
+diff --git a/thirdparty/misc/clipper.cpp b/thirdparty/misc/clipper.cpp
+index 8c3a59c4ca..c67045d113 100644
+--- a/thirdparty/misc/clipper.cpp
++++ b/thirdparty/misc/clipper.cpp
+@@ -48,6 +48,38 @@
+ #include <ostream>
+ #include <functional>
+
++//Explicitly disables exceptions handling for target platform
++//#define CLIPPER_NOEXCEPTION
++
++#define CLIPPER_THROW(exception) std::abort()
++#define CLIPPER_TRY if(true)
++#define CLIPPER_CATCH(exception) if(false)
++
++#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
++ #ifndef CLIPPER_NOEXCEPTION
++ #undef CLIPPER_THROW
++ #define CLIPPER_THROW(exception) throw exception
++ #undef CLIPPER_TRY
++ #define CLIPPER_TRY try
++ #undef CLIPPER_CATCH
++ #define CLIPPER_CATCH(exception) catch(exception)
++ #endif
++#endif
++
++//Optionally allows to override exception macros
++#if defined(CLIPPER_THROW_USER)
++ #undef CLIPPER_THROW
++ #define CLIPPER_THROW CLIPPER_THROW_USER
++#endif
++#if defined(CLIPPER_TRY_USER)
++ #undef CLIPPER_TRY
++ #define CLIPPER_TRY CLIPPER_TRY_USER
++#endif
++#if defined(CLIPPER_CATCH_USER)
++ #undef CLIPPER_CATCH
++ #define CLIPPER_CATCH CLIPPER_CATCH_USER
++#endif
++
+ namespace ClipperLib {
+
+ static double const pi = 3.141592653589793238;
+@@ -898,7 +930,7 @@ void RangeTest(const IntPoint& Pt, bool& useFullRange)
+ if (useFullRange)
+ {
+ if (Pt.X > hiRange || Pt.Y > hiRange || -Pt.X > hiRange || -Pt.Y > hiRange)
+- throw clipperException("Coordinate outside allowed range");
++ CLIPPER_THROW(clipperException("Coordinate outside allowed range"));
+ }
+ else if (Pt.X > loRange|| Pt.Y > loRange || -Pt.X > loRange || -Pt.Y > loRange)
+ {
+@@ -1046,10 +1078,10 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
+ {
+ #ifdef use_lines
+ if (!Closed && PolyTyp == ptClip)
+- throw clipperException("AddPath: Open paths must be subject.");
++ CLIPPER_THROW(clipperException("AddPath: Open paths must be subject."));
+ #else
+ if (!Closed)
+- throw clipperException("AddPath: Open paths have been disabled.");
++ CLIPPER_THROW(clipperException("AddPath: Open paths have been disabled."));
+ #endif
+
+ int highI = (int)pg.size() -1;
+@@ -1062,7 +1094,7 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
+
+ bool IsFlat = true;
+ //1. Basic (first) edge initialization ...
+- try
++ CLIPPER_TRY
+ {
+ edges[1].Curr = pg[1];
+ RangeTest(pg[0], m_UseFullRange);
+@@ -1075,10 +1107,10 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
+ InitEdge(&edges[i], &edges[i+1], &edges[i-1], pg[i]);
+ }
+ }
+- catch(...)
++ CLIPPER_CATCH(...)
+ {
+ delete [] edges;
+- throw; //range test fails
++ CLIPPER_THROW(); //range test fails
+ }
+ TEdge *eStart = &edges[0];
+
+@@ -1442,7 +1474,7 @@ void ClipperBase::SwapPositionsInAEL(TEdge *Edge1, TEdge *Edge2)
+ void ClipperBase::UpdateEdgeIntoAEL(TEdge *&e)
+ {
+ if (!e->NextInLML)
+- throw clipperException("UpdateEdgeIntoAEL: invalid call");
++ CLIPPER_THROW(clipperException("UpdateEdgeIntoAEL: invalid call"));
+
+ e->NextInLML->OutIdx = e->OutIdx;
+ TEdge* AelPrev = e->PrevInAEL;
+@@ -1510,7 +1542,7 @@ bool Clipper::Execute(ClipType clipType, Paths &solution,
+ {
+ if( m_ExecuteLocked ) return false;
+ if (m_HasOpenPaths)
+- throw clipperException("Error: PolyTree struct is needed for open path clipping.");
++ CLIPPER_THROW(clipperException("Error: PolyTree struct is needed for open path clipping."));
+ m_ExecuteLocked = true;
+ solution.resize(0);
+ m_SubjFillType = subjFillType;
+@@ -1560,7 +1592,7 @@ void Clipper::FixHoleLinkage(OutRec &outrec)
+ bool Clipper::ExecuteInternal()
+ {
+ bool succeeded = true;
+- try {
++ CLIPPER_TRY {
+ Reset();
+ m_Maxima = MaximaList();
+ m_SortedEdges = 0;
+@@ -1583,7 +1615,7 @@ bool Clipper::ExecuteInternal()
+ InsertLocalMinimaIntoAEL(botY);
+ }
+ }
+- catch(...)
++ CLIPPER_CATCH(...)
+ {
+ succeeded = false;
+ }
+@@ -2827,18 +2859,18 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
+ bool Clipper::ProcessIntersections(const cInt topY)
+ {
+ if( !m_ActiveEdges ) return true;
+- try {
++ CLIPPER_TRY {
+ BuildIntersectList(topY);
+ size_t IlSize = m_IntersectList.size();
+ if (IlSize == 0) return true;
+ if (IlSize == 1 || FixupIntersectionOrder()) ProcessIntersectList();
+ else return false;
+ }
+- catch(...)
++ CLIPPER_CATCH(...)
+ {
+ m_SortedEdges = 0;
+ DisposeIntersectNodes();
+- throw clipperException("ProcessIntersections error");
++ CLIPPER_THROW(clipperException("ProcessIntersections error"));
+ }
+ m_SortedEdges = 0;
+ return true;
+@@ -3002,7 +3034,7 @@ void Clipper::DoMaxima(TEdge *e)
+ DeleteFromAEL(eMaxPair);
+ }
+ #endif
+- else throw clipperException("DoMaxima error");
++ else CLIPPER_THROW(clipperException("DoMaxima error"));
+ }
+ //------------------------------------------------------------------------------
+
diff --git a/thirdparty/misc/clipper.cpp b/thirdparty/misc/clipper.cpp
index d3143fe5ab..c67045d113 100644
--- a/thirdparty/misc/clipper.cpp
+++ b/thirdparty/misc/clipper.cpp
@@ -48,6 +48,38 @@
#include <ostream>
#include <functional>
+//Explicitly disables exceptions handling for target platform
+//#define CLIPPER_NOEXCEPTION
+
+#define CLIPPER_THROW(exception) std::abort()
+#define CLIPPER_TRY if(true)
+#define CLIPPER_CATCH(exception) if(false)
+
+#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
+ #ifndef CLIPPER_NOEXCEPTION
+ #undef CLIPPER_THROW
+ #define CLIPPER_THROW(exception) throw exception
+ #undef CLIPPER_TRY
+ #define CLIPPER_TRY try
+ #undef CLIPPER_CATCH
+ #define CLIPPER_CATCH(exception) catch(exception)
+ #endif
+#endif
+
+//Optionally allows to override exception macros
+#if defined(CLIPPER_THROW_USER)
+ #undef CLIPPER_THROW
+ #define CLIPPER_THROW CLIPPER_THROW_USER
+#endif
+#if defined(CLIPPER_TRY_USER)
+ #undef CLIPPER_TRY
+ #define CLIPPER_TRY CLIPPER_TRY_USER
+#endif
+#if defined(CLIPPER_CATCH_USER)
+ #undef CLIPPER_CATCH
+ #define CLIPPER_CATCH CLIPPER_CATCH_USER
+#endif
+
namespace ClipperLib {
static double const pi = 3.141592653589793238;
@@ -898,7 +930,7 @@ void RangeTest(const IntPoint& Pt, bool& useFullRange)
if (useFullRange)
{
if (Pt.X > hiRange || Pt.Y > hiRange || -Pt.X > hiRange || -Pt.Y > hiRange)
- throw clipperException("Coordinate outside allowed range");
+ CLIPPER_THROW(clipperException("Coordinate outside allowed range"));
}
else if (Pt.X > loRange|| Pt.Y > loRange || -Pt.X > loRange || -Pt.Y > loRange)
{
@@ -1046,10 +1078,10 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
{
#ifdef use_lines
if (!Closed && PolyTyp == ptClip)
- throw clipperException("AddPath: Open paths must be subject.");
+ CLIPPER_THROW(clipperException("AddPath: Open paths must be subject."));
#else
if (!Closed)
- throw clipperException("AddPath: Open paths have been disabled.");
+ CLIPPER_THROW(clipperException("AddPath: Open paths have been disabled."));
#endif
int highI = (int)pg.size() -1;
@@ -1062,7 +1094,7 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
bool IsFlat = true;
//1. Basic (first) edge initialization ...
- try
+ CLIPPER_TRY
{
edges[1].Curr = pg[1];
RangeTest(pg[0], m_UseFullRange);
@@ -1075,10 +1107,10 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
InitEdge(&edges[i], &edges[i+1], &edges[i-1], pg[i]);
}
}
- catch(...)
+ CLIPPER_CATCH(...)
{
delete [] edges;
- throw; //range test fails
+ CLIPPER_THROW(); //range test fails
}
TEdge *eStart = &edges[0];
@@ -1442,7 +1474,7 @@ void ClipperBase::SwapPositionsInAEL(TEdge *Edge1, TEdge *Edge2)
void ClipperBase::UpdateEdgeIntoAEL(TEdge *&e)
{
if (!e->NextInLML)
- throw clipperException("UpdateEdgeIntoAEL: invalid call");
+ CLIPPER_THROW(clipperException("UpdateEdgeIntoAEL: invalid call"));
e->NextInLML->OutIdx = e->OutIdx;
TEdge* AelPrev = e->PrevInAEL;
@@ -1510,7 +1542,7 @@ bool Clipper::Execute(ClipType clipType, Paths &solution,
{
if( m_ExecuteLocked ) return false;
if (m_HasOpenPaths)
- throw clipperException("Error: PolyTree struct is needed for open path clipping.");
+ CLIPPER_THROW(clipperException("Error: PolyTree struct is needed for open path clipping."));
m_ExecuteLocked = true;
solution.resize(0);
m_SubjFillType = subjFillType;
@@ -1560,7 +1592,7 @@ void Clipper::FixHoleLinkage(OutRec &outrec)
bool Clipper::ExecuteInternal()
{
bool succeeded = true;
- try {
+ CLIPPER_TRY {
Reset();
m_Maxima = MaximaList();
m_SortedEdges = 0;
@@ -1583,7 +1615,7 @@ bool Clipper::ExecuteInternal()
InsertLocalMinimaIntoAEL(botY);
}
}
- catch(...)
+ CLIPPER_CATCH(...)
{
succeeded = false;
}
@@ -2827,18 +2859,18 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
bool Clipper::ProcessIntersections(const cInt topY)
{
if( !m_ActiveEdges ) return true;
- try {
+ CLIPPER_TRY {
BuildIntersectList(topY);
size_t IlSize = m_IntersectList.size();
if (IlSize == 0) return true;
if (IlSize == 1 || FixupIntersectionOrder()) ProcessIntersectList();
else return false;
}
- catch(...)
+ CLIPPER_CATCH(...)
{
m_SortedEdges = 0;
DisposeIntersectNodes();
- throw clipperException("ProcessIntersections error");
+ CLIPPER_THROW(clipperException("ProcessIntersections error"));
}
m_SortedEdges = 0;
return true;
@@ -3002,7 +3034,7 @@ void Clipper::DoMaxima(TEdge *e)
DeleteFromAEL(eMaxPair);
}
#endif
- else throw clipperException("DoMaxima error");
+ else CLIPPER_THROW(clipperException("DoMaxima error"));
}
//------------------------------------------------------------------------------
@@ -4329,10 +4361,10 @@ double DistanceFromLineSqrd(
const IntPoint& pt, const IntPoint& ln1, const IntPoint& ln2)
{
//The equation of a line in general form (Ax + By + C = 0)
- //given 2 points (x¹,y¹) & (x²,y²) is ...
- //(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0
- //A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹
- //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²)
+ //given 2 points (x¹,y¹) & (x²,y²) is ...
+ //(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0
+ //A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹
+ //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²)
//see http://en.wikipedia.org/wiki/Perpendicular_distance
double A = double(ln1.Y - ln2.Y);
double B = double(ln2.X - ln1.X);
diff --git a/thirdparty/misc/yuv2rgb.h b/thirdparty/misc/yuv2rgb.h
index 3ec8388246..d8f7fd6de2 100644
--- a/thirdparty/misc/yuv2rgb.h
+++ b/thirdparty/misc/yuv2rgb.h
@@ -24,6 +24,14 @@ does not infringe any patents that apply in your area before you
ship it.
*/
+/*
+ * Please note that this version has been modified for various reasons:
+ * 1. Using the Godot core typedefs
+ * 2. At some point or another the code relied on the byte order of a uint32_t, this has been fixed
+ * 3. Output has been reordered to struct { uint8_t r, g, b, a; } precisely in accordance with the function names
+ * 4. Removing unused 'dither' parameter
+ */
+
#ifndef YUV2RGB_H
#define YUV2RGB_H
@@ -803,6 +811,8 @@ static const uint32_t tables[256*3] = {
0xE6365800U
};
+/* -- Common -- */
+
#define FLAGS 0x40080100
#define READUV(U,V) (tables[256 + (U)] + tables[512 + (V)])
#define READY(Y) tables[Y]
@@ -820,12 +830,14 @@ do { \
#define STORE(Y,DSTPTR) \
do { \
- *(DSTPTR)++ = (Y); \
- *(DSTPTR)++ = (Y)>>22; \
*(DSTPTR)++ = (Y)>>11; \
- *(DSTPTR)++ = 255; \
+ *(DSTPTR)++ = (Y)>>22; \
+ *(DSTPTR)++ = (Y); \
+ *(DSTPTR)++ = 255; \
} while (0 == 1)
+/* -- End Common -- */
+
static void yuv422_2_rgb8888(uint8_t *dst_ptr,
const uint8_t *y_ptr,
const uint8_t *u_ptr,
@@ -834,8 +846,7 @@ static void yuv422_2_rgb8888(uint8_t *dst_ptr,
int32_t height,
int32_t y_span,
int32_t uv_span,
- int32_t dst_span,
- int32_t dither)
+ int32_t dst_span)
{
height -= 1;
while (height > 0)
@@ -909,35 +920,7 @@ static void yuv422_2_rgb8888(uint8_t *dst_ptr,
}
}
-
-#undef FLAGS
-#undef READUV
-#undef READY
-#undef FIXUP
-#undef STORE
-
-
-#define FLAGS 0x40080100
-#define READUV(U,V) (tables[256 + (U)] + tables[512 + (V)])
-#define READY(Y) tables[Y]
-#define FIXUP(Y) \
-do { \
- int tmp = (Y) & FLAGS; \
- if (tmp != 0) \
- { \
- tmp -= tmp>>8; \
- (Y) |= tmp; \
- tmp = FLAGS & ~(Y>>1); \
- (Y) += tmp>>8; \
- } \
-} while (0 == 1)
-
-#define STORE(Y,DSTPTR) \
-do { \
- (DSTPTR) = 0xFF000000 | (Y & 0xFF) | (0xFF00 & (Y>>14)) | (0xFF0000 & (Y<<5));\
-} while (0 == 1)
-
-static void yuv420_2_rgb8888(uint8_t *dst_ptr_,
+static void yuv420_2_rgb8888(uint8_t *dst_ptr,
const uint8_t *y_ptr,
const uint8_t *u_ptr,
const uint8_t *v_ptr,
@@ -945,12 +928,9 @@ static void yuv420_2_rgb8888(uint8_t *dst_ptr_,
int32_t height,
int32_t y_span,
int32_t uv_span,
- int32_t dst_span,
- int32_t dither)
+ int32_t dst_span)
{
- uint32_t *dst_ptr = (uint32_t *)(void *)dst_ptr_;
- dst_span >>= 2;
-
+ /* The 'dst_ptr as uint32_t' thing is not endianness-aware, so that's been removed. */
height -= 1;
while (height > 0)
{
@@ -960,36 +940,38 @@ static void yuv420_2_rgb8888(uint8_t *dst_ptr_,
{
/* Do 2 column pairs */
uint32_t uv, y0, y1;
+ uint8_t * dst_ptr_1span = dst_ptr + dst_span;
uv = READUV(*u_ptr++,*v_ptr++);
y1 = uv + READY(y_ptr[y_span]);
y0 = uv + READY(*y_ptr++);
FIXUP(y1);
FIXUP(y0);
- STORE(y1, dst_ptr[dst_span]);
- STORE(y0, *dst_ptr++);
+ STORE(y1, dst_ptr_1span);
+ STORE(y0, dst_ptr);
y1 = uv + READY(y_ptr[y_span]);
y0 = uv + READY(*y_ptr++);
FIXUP(y1);
FIXUP(y0);
- STORE(y1, dst_ptr[dst_span]);
- STORE(y0, *dst_ptr++);
+ STORE(y1, dst_ptr_1span);
+ STORE(y0, dst_ptr);
height += (2<<16);
}
if ((height>>16) == 0)
{
/* Trailing column pair */
uint32_t uv, y0, y1;
+ uint8_t * dst_ptr_1span = dst_ptr + dst_span;
uv = READUV(*u_ptr,*v_ptr);
y1 = uv + READY(y_ptr[y_span]);
y0 = uv + READY(*y_ptr++);
FIXUP(y1);
FIXUP(y0);
- STORE(y0, dst_ptr[dst_span]);
- STORE(y1, *dst_ptr++);
+ STORE(y0, dst_ptr_1span);
+ STORE(y1, dst_ptr);
}
- dst_ptr += dst_span*2-width;
+ dst_ptr += (dst_span * 2) - (width * 4);
y_ptr += y_span*2-width;
u_ptr += uv_span-(width>>1);
v_ptr += uv_span-(width>>1);
@@ -1011,8 +993,8 @@ static void yuv420_2_rgb8888(uint8_t *dst_ptr_,
y0 = uv + READY(*y_ptr++);
FIXUP(y1);
FIXUP(y0);
- STORE(y1, *dst_ptr++);
- STORE(y0, *dst_ptr++);
+ STORE(y1, dst_ptr);
+ STORE(y0, dst_ptr);
height += (2<<16);
}
if ((height>>16) == 0)
@@ -1023,42 +1005,11 @@ static void yuv420_2_rgb8888(uint8_t *dst_ptr_,
uv = READUV(*u_ptr++,*v_ptr++);
y0 = uv + READY(*y_ptr++);
FIXUP(y0);
- STORE(y0, *dst_ptr++);
+ STORE(y0, dst_ptr);
}
}
}
-
-
-#undef FLAGS
-#undef READUV
-#undef READY
-#undef FIXUP
-#undef STORE
-
-#define FLAGS 0x40080100
-#define READUV(U,V) (tables[256 + (U)] + tables[512 + (V)])
-#define READY(Y) tables[Y]
-#define FIXUP(Y) \
-do { \
- int tmp = (Y) & FLAGS; \
- if (tmp != 0) \
- { \
- tmp -= tmp>>8; \
- (Y) |= tmp; \
- tmp = FLAGS & ~(Y>>1); \
- (Y) += tmp>>8; \
- } \
-} while (0 == 1)
-
-#define STORE(Y,DSTPTR) \
-do { \
- *(DSTPTR)++ = (Y); \
- *(DSTPTR)++ = (Y)>>22; \
- *(DSTPTR)++ = (Y)>>11; \
- *(DSTPTR)++ = 255; \
-} while (0 == 1)
-
static void yuv444_2_rgb8888(uint8_t *dst_ptr,
const uint8_t *y_ptr,
const uint8_t *u_ptr,
@@ -1067,8 +1018,7 @@ static void yuv444_2_rgb8888(uint8_t *dst_ptr,
int32_t height,
int32_t y_span,
int32_t uv_span,
- int32_t dst_span,
- int32_t dither)
+ int32_t dst_span)
{
height -= 1;
while (height > 0)
@@ -1143,4 +1093,11 @@ static void yuv444_2_rgb8888(uint8_t *dst_ptr,
height -= 1;
}
}
+
+#undef FLAGS
+#undef READUV
+#undef READY
+#undef FIXUP
+#undef STORE
+
#endif // YUV2RGB_H
diff --git a/thirdparty/xatlas/xatlas.cpp b/thirdparty/xatlas/xatlas.cpp
index eb0824a517..2cc2905eee 100644
--- a/thirdparty/xatlas/xatlas.cpp
+++ b/thirdparty/xatlas/xatlas.cpp
@@ -4388,7 +4388,7 @@ private:
class Solver
{
public:
- // Solve the symmetric system: At·A·x = At·b
+ // Solve the symmetric system: At·A·x = At·b
static bool LeastSquaresSolver(const sparse::Matrix &A, const FullVector &b, FullVector &x, float epsilon = 1e-5f)
{
xaDebugAssert(A.width() == x.dimension());
@@ -4477,22 +4477,22 @@ private:
* Gradient method.
*
* Solving sparse linear systems:
- * (1) A·x = b
+ * (1) A·x = b
*
* The conjugate gradient algorithm solves (1) only in the case that A is
* symmetric and positive definite. It is based on the idea of minimizing the
* function
*
- * (2) f(x) = 1/2·x·A·x - b·x
+ * (2) f(x) = 1/2·x·A·x - b·x
*
* This function is minimized when its gradient
*
- * (3) df = A·x - b
+ * (3) df = A·x - b
*
* is zero, which is equivalent to (1). The minimization is carried out by
* generating a succession of search directions p.k and improved minimizers x.k.
- * At each stage a quantity alfa.k is found that minimizes f(x.k + alfa.k·p.k),
- * and x.k+1 is set equal to the new point x.k + alfa.k·p.k. The p.k and x.k are
+ * At each stage a quantity alfa.k is found that minimizes f(x.k + alfa.k·p.k),
+ * and x.k+1 is set equal to the new point x.k + alfa.k·p.k. The p.k and x.k are
* built up in such a way that x.k+1 is also the minimizer of f over the whole
* vector space of directions already taken, {p.1, p.2, . . . , p.k}. After N
* iterations you arrive at the minimizer over the entire vector space, i.e., the
@@ -4520,7 +4520,7 @@ private:
float delta_new;
float alpha;
float beta;
- // r = b - A·x;
+ // r = b - A·x;
sparse::copy(b, r);
sparse::sgemv(-1, A, x, 1, r);
// p = r;
@@ -4529,24 +4529,24 @@ private:
delta_0 = delta_new;
while (i < i_max && delta_new > epsilon * epsilon * delta_0) {
i++;
- // q = A·p
+ // q = A·p
mult(A, p, q);
- // alpha = delta_new / p·q
+ // alpha = delta_new / p·q
alpha = delta_new / sparse::dot( p, q );
- // x = alfa·p + x
+ // x = alfa·p + x
sparse::saxpy(alpha, p, x);
if ((i & 31) == 0) { // recompute r after 32 steps
- // r = b - A·x
+ // r = b - A·x
sparse::copy(b, r);
sparse::sgemv(-1, A, x, 1, r);
} else {
- // r = r - alpha·q
+ // r = r - alpha·q
sparse::saxpy(-alpha, q, r);
}
delta_old = delta_new;
delta_new = sparse::dot( r, r );
beta = delta_new / delta_old;
- // p = beta·p + r
+ // p = beta·p + r
sparse::scal(beta, p);
sparse::saxpy(1, r, p);
}
@@ -4572,35 +4572,35 @@ private:
float delta_new;
float alpha;
float beta;
- // r = b - A·x
+ // r = b - A·x
sparse::copy(b, r);
sparse::sgemv(-1, A, x, 1, r);
- // p = M^-1 · r
+ // p = M^-1 · r
preconditioner.apply(r, p);
delta_new = sparse::dot(r, p);
delta_0 = delta_new;
while (i < i_max && delta_new > epsilon * epsilon * delta_0) {
i++;
- // q = A·p
+ // q = A·p
mult(A, p, q);
- // alpha = delta_new / p·q
+ // alpha = delta_new / p·q
alpha = delta_new / sparse::dot(p, q);
- // x = alfa·p + x
+ // x = alfa·p + x
sparse::saxpy(alpha, p, x);
if ((i & 31) == 0) { // recompute r after 32 steps
- // r = b - A·x
+ // r = b - A·x
sparse::copy(b, r);
sparse::sgemv(-1, A, x, 1, r);
} else {
- // r = r - alfa·q
+ // r = r - alfa·q
sparse::saxpy(-alpha, q, r);
}
- // s = M^-1 · r
+ // s = M^-1 · r
preconditioner.apply(r, s);
delta_old = delta_new;
delta_new = sparse::dot( r, s );
beta = delta_new / delta_old;
- // p = s + beta·p
+ // p = s + beta·p
sparse::scal(beta, p);
sparse::saxpy(1, s, p);
}